Trouble with setLoopMode

Started by Serandel, December 26, 2005, 11:32:15

Previous topic - Next topic



by reading the docs I thought that setting the loop mode of the channel my sound sample is going to play to FSound.FSOUND_LOOP_OFF would mean that the sample is not looping and that setting it to FSound.FSOUND_LOOP_NORMAL would make it loop. (I have no idea what the heck FSOUND_LOOP_BIDI means. :D) So my code looks like:

// Assign the channel but don't play the sound yet
int channel = FSound.FSOUND_Stream_PlayEx(FSound.FSOUND_FREE, sound, null, true);

FSound.FSOUND_SetLoopMode(channel, (loop ? FSound.FSOUND_LOOP_NORMAL	: FSound.FSOUND_LOOP_OFF));

FSound.FSOUND_SetPaused(channel, false);

But it doesn't work.  :?

Without looping, the sample stops after a couple of seconds, but when I enable looping it plays ok till the end... and doesn't loop. Also I have seen that if you don't set the loop mode of the channel it defaults to FSOUND_LOOP_NORMAL and not FSOUND_LOOP_OFF, like I thought.

Can anybody help me, please? Thanks a lot.


do you have a simple test so that we can reproduce it ?


It's Murphy's law: I have been trying to fix the problem for two weeks and I stumble upon the solution a couple of hours after I post here.  :roll:

Just have to substitute setLoopMode for

FSound.FSOUND_Stream_SetMode(sound, (loop ? FSound.FSOUND_LOOP_NORMAL	: FSound.FSOUND_LOOP_OFF));

From the FMOD forums:

Quoteyou are altering the loop mode on the stream channel handle, you should not be doing this.
every stream contains a small looping FSOUND_SAMPLE, and when you turn off the looping, it stops the stream.

Thanks a lot nevertheless.