0
0

Well, I decided that I’d prefer to have my collection of notes
From 1 to 96, sampled piano notes, in an array like this:

FSOUND_SAMPLE *Notes[96];

(note: I loaded all 96 notes like this, this is just the first piano octave)
(just to give you an idea of how I loading the sounds. Let me know)
(If there is something wrong)

// first octave
sFileName = “C1.wav”;
Notes[1] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “C#1.wav”;
Notes[2] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “D1.wav”;
Notes[3] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “D#1.wav”;
Notes[4] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “E1.wav”;
Notes[5] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “F1.wav”;
Notes[6] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “F#1.wav”;
Notes[7] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “G1.wav”;
Notes[8] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “G#1.wav”;
Notes[9] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “A1.wav”;
Notes[10] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “A#1.wav”;
Notes[11] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);
sFileName = “B1.wav”;
Notes[12] = FSOUND_Sample_Load (-1, sFileName, FSOUND_LOOP_OFF, 0, 0);

// test run
// sStart is just a variable to store the result, if it’s “-1” it means error
// if it’s “1” then the sample loaded properly
// test the C Major chord in the in the highest octave here
sStart = FSOUND_PlaySound (FSOUND_FREE, Notes[85]);
sStart = FSOUND_PlaySound (FSOUND_FREE, Notes[89]);
sStart = FSOUND_PlaySound (FSOUND_FREE, Notes[91]);

It compiled alright, but alas the sounds just didn’t load. I made sure all the notes from C1.wav to B8.wav were in the same directory. I use a 256MB Storage Card on my PPC to store/debug my project since I’m using about 24mb worth of WAV samples in total. I plan on compressing them to OGG when the project is finalised but I’m just using WAV because it’s faster to load.

But for some reason it wouldn’t load the sounds. I checked the pointers and seemed to be getting the same pointer value for some reason. Not sure what I did wrong, but whatever it is it isn’t working. I’m fairly new to C/C++, so please forgive me if I made a silly mistake.

If there is something wrong with my code I’d really appreciate it if someone would correct my mistake. I believe it’s a small mistake. Any help would be appreciated.

Thankyou
Ben

  • You must to post comments
0
0

I meant the return value from FSOUND_PlaySound was -1

I think -1 means failure. But I don’t know why.

Now, I was using an array of FSOUND_SAMPLE *Notes[96]

When I was doing this:

FSOUND_SAMPLE *Sample;
FSOUND_SAMPLE *Sample1;
FSOUND_SAMPLE *Sample2;

It worked, and the sounds played when I called FSOUND_PlaySound.

I have a very strong feeling that this problem is because I am using an array of FSOUND_SAMPLE structs and maybe I’m not accessing the individual FSOUND_SAMPLE structures properly?

Not sure what is causing this problem, I’m still pulling my hair out.

Ben

  • You must to post comments
0
0

I checked using the debugger. The sounds seemed to load as there was a slight delay when executing the loading commands, and I checked every line.

They wouldn’t play. Yes, I did try the 1 2 and 3rd sounds. Still no luck. It may be a problem with my pointer/FSOUND_SAMPLE structure array. Still not sure.

Thanks
Ben

  • You must to post comments
0
0

Yes, I’ve checked. The pointer returned always seems to be the same pointer address. Not sure what’s happening, but it won’t play the sounds. That’s all I really know going by what I found whilst debugging my app.

Ben

  • You must to post comments
0
0

I just tried loading only 12 samples instead of 96.

Didn’t work.

I tried loading to a single sample (MySample), and it wouldn’t work either, but it seemed to work with OGG samples though. But wouldn’t work with WAV.

Have no idea what is causing this.

Ben

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.