Bluebugs / freebox-elixir

Automatically exported from code.google.com/p/freebox-elixir
0 stars 0 forks source link

Mix_PlayChannel doesn't want to infinite loop. #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup an infinite loop playback with Mix_PlayChannel
2. Call Mix_HaltChannel on it.

What is the expected output? What do you see instead?

Music doesn't stop.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by moa.blue...@gmail.com on 20 Aug 2010 at 1:27

GoogleCodeExporter commented 9 years ago
any news on this issue ?
Or any work around ?

Original comment by asmodehn@gmail.com on 16 Jan 2011 at 12:45

GoogleCodeExporter commented 9 years ago
For a workaround, you may want to:

1- create a 'slient' wav file ; it could be the shortest possible.

2- When you want to stop the inifite loop, don't call Mix_HaltChannel ; play 
instead the silent wav file *on the same channel than the infinite loop*. It 
will cause the initial loop to be automatically stopped and replaced by the 
'silent' sound.

Original comment by noukn...@gmail.com on 16 Jan 2011 at 4:14

GoogleCodeExporter commented 9 years ago
News on that issue : I manage to get it working ( in js ) after reviewing the 
SDL_mixer doc. It s now working on the VM. I cannot test on FB right now.

//load soundfile.ogg
var chunk = Mix_LoadWAV("soundfile.ogg");
//loops -1 will loop indefinitely. you dont have to.
var loops = 42;
var mychan = -1; // -1 here choose a random channel
mychan = Mix_PlayChannel(mychan,chunk,loops);
//wait here, and listen to it a bit ;)
elx.sleep(5) // or timers...
//stop it
Mix_HaltChannel(mychan);

So I guess it looks like a cauldron problem only...

Original comment by asmodehn@gmail.com on 30 Jan 2011 at 12:41