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.
IndexProgramming Questions & HelpSound,  Music Libraries › Possible to store SONIA Samples in an Array
Page Index Toggle Pages: 1
Possible to store SONIA Samples in an Array? (Read 705 times)
Possible to store SONIA Samples in an Array?
Dec 30th, 2009, 7:50am
 
Hy,

I'm trying the following:

 test = new Sample("click.aiff");

(this works!)

when I try instead:

test[0] new Sample("click.aiff");

I get the error:

Exception in thread "Animation Thread" java.lang.NullPointerException
     at p_read_serial_onesensortest.setup(p_read_serial_onesensortest.java:124)
     at processing.core.PApplet.handleDraw(PApplet.java:1402)
     at processing.core.PApplet.run(PApplet.java:1327)
     at java.lang.Thread.run(Thread.java:613)


So it looks like Sonia can't store the sound Samples in an Array. Is that true?


thanks
n


EDIT: I tried it now with the ESS library, and I have the same error. so this looks more like a general problem. thanks for any help!
Re: Possible to store SONIA Samples in an Array?
Reply #1 - Dec 30th, 2009, 12:30pm
 
You can store any object in arrays, there's absolutely no reason you could not store a sample. Maybe a missing declaration?

Code:
Sample[] test;
test = new Sample[1];
test[0] = new Sample("click.aiff");
Page Index Toggle Pages: 1