LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: Trouble with setLoopMode  (Read 8149 times)

Serandel

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
Trouble with setLoopMode
« on: December 26, 2005, 11:32:15 »

Hi,

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:

Code: [Select]
// 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.
Logged

Matzon

  • Demigod
  • *****
  • Offline Offline
  • Posts: 2242
Trouble with setLoopMode
« Reply #1 on: December 26, 2005, 19:36:30 »

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

Serandel

  • Newbie
  • *
  • Offline Offline
  • Posts: 2
Trouble with setLoopMode
« Reply #2 on: December 27, 2005, 08:38:22 »

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

Code: [Select]
FSound.FSOUND_Stream_SetMode(sound, (loop ? FSound.FSOUND_LOOP_NORMAL : FSound.FSOUND_LOOP_OFF));

From the FMOD forums:

Quote
you 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.
Logged