Page 1 of 1

samples stop playing

Posted: Mon Feb 16, 2009 12:20 pm
by manopac
I wrote a music-based game where I use my own routines to play a simple instrument loop (two simultaniously actually, bass and drums) and a few samples on top of that based on user actions. I only use the Sample-play option of maxmod and am not playing and modules.

Everything is fine for about 15-30 mins, but after that there slowly starts to be a problem with playing the samples, it starts by missing a few samples, which are not played and gets worse over time. I think its running out of sound channels, which it shouldn't, as the samples are rather short and the number is well below the 30 samples maxmod should be able to play.

my workaround so far is a pause-button which initializes the whole sound process again (

mmInitDefaultMem((mm_addr)soundbank_bin);
mmSelectMode(MM_MODE_C);

and loading the samples (mmLoadEffect).

after that everything works fine again for the next 15-30 mins ... any idea what could go wrong ?

Re: samples stop playing

Posted: Tue Feb 17, 2009 6:35 pm
by eKid
Hmm, interesting problem, this lead me to finding a bug in the sound effect system that may cause looped samples to be 'forgotten' in some cases and lock up the channels.
A fix has been added to the SVN, I'm not sure if this will fix your problem or not, but it's probably related.

Another note, the sound effect system only has 16 sound handles, so only 16 of the 30 channels available in mode C can be used for sound effects.

Re: samples stop playing

Posted: Mon Feb 15, 2010 3:04 pm
by manopac
Finally got around to compile my game with the newest version of libnds and maxmod ... and the problem got actually worse, it happend after maybe 5 mins in the previous version of maxmod, now samples are stopped being played after 128 samples ... (made a debug message that shows the number of calls to mmEffect)

any help is very appreciated !!

thanks

EDIT: and the workaround described before doesn't work anymore btw. ...