*** Please see my second post at first, I you want not to lose your time, thanks ***
at first, I want to say two things :
– Congratulation for this great library, FMod is really the coolest and fastest library I’ve ever seen.
– Sorry for my english, I’m French, hence I hope you’ll understand my question 😉
I’m currently coding a small engine which uses stream callbacks to read and expand in real time a MP3 loaded in memory. I do that to reduce disk access and not to decompress to whole file in memory : this is for a small game, and I need memory for other stuff.
My problem is the following :
I want to use the same streamcallback function to read different MP3 files. (Not in the same time). For example :
1) I “create” my stream with FSOUND_Stream_Create(), play it with FSOUND_PlayEx() (at this time, all works great). In my program, it’s something like that :
musique[ind].stream = FSOUND_Stream_Create(streamcallback, 4608*n_blocs, FSOUND_LOOP_OFF | FSOUND_16BITS | FSOUND_STEREO, 44100, 0);
musique[ind].channel = FSOUND_Stream_PlayEx(FSOUND_FREE, musique[ind].stream, NULL, true);
2) Then, I want to stop the music. I do :
// where musique[ind].stream is the pointer to my stream
3) And now, I want to play another music (or the same music, it is not the problem). I do what I’ve done in 1), but my streamcallback function is called 1 time, and never again.
But when I reinitialize FSOUND before playng another music, it works :
FSOUND_Init(44100, 32, 0);
Of course, I want to play samples in my program too, because it’s for a small game. If I call FSOUND_Close() when samples are playing, it’s not what I want to have 😉
Do I close correctly my stream ?
Any idea to resolve this problem ?
- Fremen^SF asked 16 years ago
Thank you for your answer Brett,
in fact, I had a confusion between the TRUE answer and the error message 1.
My problem has been resolved, using your helpful suggestions. When I used PlayEx function, I didn’t get the channel value, consequently when I called the SetPaused(false) function, it didn’t worked :
if (musique[ind].channel = FSOUND_Stream_PlayEx(FSOUND_FREE, musique[ind].stream, NULL, true) == -1)
In this line, 0 was always returned in my musique[ind].channel variable (because I’ve forgotten brackets ^^)
So, thank you very much for your help 😉 Now it works !
Please login first to submit.