Page 1 of 2

Running out of channels (on GBA)

Posted: Mon Jun 10, 2013 10:36 am
by sverx
It looks like when I play an XM (though it doesn't happen with every XM), it eats up all the available 'channels' and none is left for sound effects... even if the XM is using 8 channels only and MaxMod has been initialized with 12 channels.

Code: Select all

mmInitDefault((mm_addr)soundbank_bin, 12);
Is there a MaxMod function that checks how many channels are currently used, as in the demo?
Thanks!

Re: Running out of channels (on GBA)

Posted: Tue Jun 11, 2013 9:59 am
by sverx
... there's something I really don't get :|
Why is an 8 channels XM using more than 8 'MaxMod' channels?
AFAIK MaxMod on GBA doesn't feature "volume ramping" so I'm really puzzled.
Anyone?

Re: Running out of channels (on GBA)

Posted: Wed Jun 12, 2013 10:05 am
by sverx
I tried increasing channels from 12 to 16, but the problem persists.
It really sounds like some channels get 'stuck' busy -even if not playing anything- and they never get back to the 'free' state.
The XM causing this uses volume envelopes and key-off commands... I'll try remove those and see if something changes.

Re: Running out of channels (on GBA)

Posted: Thu Jun 13, 2013 10:29 am
by sverx
I am using the

Code: Select all

mmMixerChannelActive(channel_number)
function now to see the state of the channel(s).
Let's see if I can sort out the problem...

Re: Running out of channels (on GBA)

Posted: Thu Jun 13, 2013 12:46 pm
by sverx
Quite curious: in mm_mixer_gba.s there's this:

Code: Select all

@ MIXER CHANNEL FORMAT

.equ	CHN_SIZE, 24

.equ	CHN_SRC,0
.equ	CHN_READ,4
.equ	CHN_VOL,8
.equ	CHN_PAN,9
// 10
// 11
.equ	CHN_FREQ,12
.equ	CHN_SIZE,16
if I'm right, the last line redefines CHN_SIZE to value 16.

But then in MaxMod.h there's

Code: Select all

#define MM_SIZEOF_MIXCH		24
which should be wrong, then.

BTW I yet don't know if this is causing the problem I'm having. :?

(Oh wait, MaxMod on sourceforge.net is 1.0.8, in the dev kit package is 1.0.7, but the compiled files have the same datestamps... :shock: )

Re: Running out of channels (on GBA)

Posted: Thu Jun 13, 2013 1:41 pm
by elhobbs
are you sure this is referring to the number of channels and not the size of an internal data structure?

Re: Running out of channels (on GBA)

Posted: Thu Jun 13, 2013 2:28 pm
by sverx
Indeed it's the size of the internal data structure...

Re: Running out of channels (on GBA)

Posted: Thu Jun 13, 2013 7:35 pm
by sverx
Looks like it's a problem that arises when I stop a module and start another... am I not supposed to start a module immediately after stopping another?
I'm trying to reproduce it in a test program...

Re: Running out of channels (on GBA)

Posted: Fri Jun 14, 2013 10:49 am
by sverx
It seems that the problem may be caused by a vblank happening while I'm stopping the old module/starting the new one, so I solved adding this:

Code: Select all

mmFrame();
VBlankIntrWait();
before stop/start.
I hope that's enough, and that this info would be useful to others :)

Re: Running out of channels (on GBA)

Posted: Sat Jun 15, 2013 4:21 pm
by sverx
mmm... I spoke too soon :x