We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
minim_Array help (Read 487 times)
minim_Array help
Feb 28th, 2008, 10:21pm
 
this isnt working, if i take out the array part it works fine.
any suggestions?
///////////

import ddf.minim.*;

AudioSnippet[] snareArray = new AudioSnippet[8];

void setup()
{
 size(100,100);
 Minim.start(this);
 Minim.debugOn();
 for(int i = 0; i < snareArray.length; i++)
 {
   snareArray[i] = Minim.loadSnippet("snare" + i+1 + ".aif");
 }
}

void draw ()
{
 background (0);
}

void mousePressed()
{
 snareArray[1].play();
 snareArray[1].rewind();  
}

void stop()
{
 snareArray[1].close();
 super.stop();
}

/////
thanks
-nate
Re: minim_Array help
Reply #1 - Mar 3rd, 2008, 2:55am
 
Could you explain in what way it isn't working?
Re: minim_Array help
Reply #2 - Mar 5th, 2008, 4:17am
 
well, im trying to setup the sketch so i can play a random soundclip for a drum machine. i keep getting a nullpointer error when i dont think i should be getting one. i want to use an array for the "random" sounds so i can have different versions of snare, bass,etc  for different mouse presses but once the array portion is introduced the sound clips no longer work. any suggestions would be appreciated.

-
Re: minim_Array help
Reply #3 - Mar 8th, 2008, 8:06pm
 
If Minim can't find the sound you are trying to load, it will return null from the loadSnippet function, this would cause the null pointers in your array. What do you see printed to the console when you run your sketch?
Page Index Toggle Pages: 1