ofsoundPlayer array's size is over?

Hi,(im sorry my english is bad)

I am trying to set up an array of sounds like this…

#define NUM 8(in .h file)

(↓.cpp file)
char filename[1024];
for (int i=1; i<NUM; i++) {
     sprintf(filename, "piano%d.wav",i);
     cout << filename << " is loaded" << endl;

when NUM <=7 is no error(log is piano6.wav is loaded),
but when NUM >=8 is EXC_BAD_ACCESS error at sounds[i].loadSound(filename);

please tell me how can i debug.thanks

just a quick note that array access in c++ is starting at 0, so you access an 8 element array as 0 through 7… ie:


can you post the whole code ? It seems like there’s maybe something simple with array access happening.

sorry, i could fix the error.(by product clean in Xcode)

i wanna make gadget like Reactable by using reactivision & ofxTuio.
because i wanna fit “fiducial Marker’s ID(is starting at 1)” with soundfile’name,
load soundfile is starting at 1 like this.

for(int i=1; i <NUM; i++)

thank you for your reply!
i will post when there is other question!