Running out of channels (on GBA)

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Running out of channels (on GBA)

Post by sverx » Mon Jun 10, 2013 10:36 am

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!

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Re: Running out of channels (on GBA)

Post by sverx » Tue Jun 11, 2013 9:59 am

... 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?

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Re: Running out of channels (on GBA)

Post by sverx » Wed Jun 12, 2013 10:05 am

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.

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Re: Running out of channels (on GBA)

Post by sverx » Thu Jun 13, 2013 10:29 am

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...

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Re: Running out of channels (on GBA)

Post by sverx » Thu Jun 13, 2013 12:46 pm

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: )

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Running out of channels (on GBA)

Post by elhobbs » Thu Jun 13, 2013 1:41 pm

are you sure this is referring to the number of channels and not the size of an internal data structure?

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Re: Running out of channels (on GBA)

Post by sverx » Thu Jun 13, 2013 2:28 pm

Indeed it's the size of the internal data structure...

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Re: Running out of channels (on GBA)

Post by sverx » Thu Jun 13, 2013 7:35 pm

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...

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Re: Running out of channels (on GBA)

Post by sverx » Fri Jun 14, 2013 10:49 am

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 :)

sverx
Posts: 94
Joined: Wed Aug 12, 2009 2:56 pm
Location: github.com/sverx
Contact:

Re: Running out of channels (on GBA)

Post by sverx » Sat Jun 15, 2013 4:21 pm

mmm... I spoke too soon :x

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests