GP32 Playing Mods


pea

developer
Joined
Oct 3, 2004
Messages
1,089
Age
45
Location
New Zealand
Website
www.projectitis.com
Hey guys,

Firstly, thanks again Mr.Mirko for the SDK :) Just starting on my first sound bits and pieces now :p A few Qs that I haven't really been able to find answers for:
1) How many channels can the mod files have?
2) How many MHz does the mod playing take? (e.g. Normal code at 40MHz with no sound, will this run about the same WITH sound at 66MHz? or 45MHz? or 100MHz?)
3) How many samples can be played at once using the 'addSample' function? What about when a mod is playing?
4) How do you stop a mod file? Using 'pauseModfile' ?

Cheers!
 
1. Probably 64 (mod standard).
2. I dunno
3. You lost me there.
4. Something like that.

Well, that's all I know...
 
on (3) - How many samples can I play at once (like a shooting noise, and an engine sound, and a bird tweeting etc)? And is it affected by playing a mod (e.g. If a mod is playing, can I play less samples?)
 
1. Probably 64 (mod standard).
2. I dunno
3. You lost me there.
4. Something like that.

Well, that's all I know...

1. Mod standard is 4 channels, not 64.
2. It's rather cheap on CPU, i think it was less than 10% at 66mhz
3. 2 samples with the last non-GPL version (dunno if mirko changed the mixer)
4. I think i just killed the mixer and restarted it.
 
Last edited by a moderator:
Hey guys,

Firstly, thanks again Mr.Mirko for the SDK :) Just starting on my first sound bits and pieces now :p A few Qs that I haven't really been able to find answers for:
1) How many channels can the mod files have?
2) How many MHz does the mod playing take? (e.g. Normal code at 40MHz with no sound, will this run about the same WITH sound at 66MHz? or 45MHz? or 100MHz?)
3) How many samples can be played at once using the 'addSample' function? What about when a mod is playing?
4) How do you stop a mod file? Using 'pauseModfile' ?

Cheers!

1. 4 channels standard amiga mod file format
2. at 40mhz it will slow down your programm about 5%, at 133Mhz, you will notice no slow down at all.
3. you can playback one modfile, and at the same time ( using gp_addSample ) one sample.
4. gp_pauseModfile() set a playing modfile to pause
gp_resumeModfile() resume modfile playback at the position you paused it

read the docs here : http://home.t-online.de/home/mirkoroller/gp32/doc.html
 
Last edited by a moderator:
Thanks for the replies guys.

Mr.Mirko - I have read the docs :) But there is no 'stop' function, so I wondered what would happen if I 'pause' thje mod, and then start a new one. Does this result in a memory leak of any kind?

Is there a mod player available that can do more channels?

And I have read a lot of posts that mp3 takes up a lot of processing, but who knows exactly how much? For example, how much processing does a 48kbs, 22KHz mono mp3 take to decode? Is it feasible to do this on an interrupt?
 
>Mr.Mirko - I have read the docs :) But there is no 'stop' function, so I wondered what would happen if I 'pause' thje mod, and then start a new one. Does this result in a memory leak of any kind?

No


>Is there a mod player available that can do more channels?
There are over 200+ different mod formats, they do diff a little bit, or absolutely new things.
( XM S3M MOD15, MOD32, MOD4, ... ) The MOD4 format is the orginal Amiga mod format, and it is VERY CPU friendly. A Amiga 500 with 7.14 MHz, can playback a modfile, while playing a game :)

And I have read a lot of posts that mp3 takes up a lot of processing, but who knows exactly how much? For example, how much processing does a 48kbs, 22KHz mono mp3 take to decode? Is it feasible to do this on an interrupt?

MP3 decoding is VERY CPU expensive, on a 66Mhz machine it would take about 50-70% CPU power. And the main problem is that the gp32 suffers from a DMA-SOUND bug. This means, if you want to playback a SAMPLE, it is not possible to put the CPU/DMA bus to heavy load.
And mp3 decoding puts the CPU/bus/dma to its limit.
I tryed it, you can use libmad to decode a mp3, works out of the box crosscompiled. Problem is, the DMA soundout at the same time was corrupt. ( GP32 SOUND bug )

What you can do is, store your gp32 samples as mp3 data, decode them on your game start, and then later only use the raw sample data.

Timer based mp3 decoding + dma sound output at the same time on a gp32, IS possible, if you want to spend some Month in rewriting a new mp3 decoder ...
 
Traditionally, mods have 4 channels. Now, various trackers allow you to have more than 4 channels (modplug lets you have an insane amount of channels). The number or channels usually appears in the "expansion identifier" word:

"M.K." = 31 samples/4 channels
"5CHN" = 31 samples/5 channels
"6CHN" = 31 samples/6 channels
...
"10CH" = 31 samples/10 channels
"11CH" = 31 samples/11 channels
...
"99CH" = suicide. :p

The format of the patterns are stored in order:

(identifier word) 6CHN (this is start of row 1) track1 track2 track3 track4 track5 track6 (now row 2) track1 track2 track3 track4 track5 track6 (row 3 comes next)
etc...

(identifier word) M.K. (row 1) track1 track2 track3 track4 (row 2) track1 track2 track3 track4 (row 3)
etc...

all right after one another. Each note takes up 4 bytes, which to my knowledge is a GP32 word.

The original 4-channel base comes from the Amiga's sound processor, which had 4 channels which could play at different frequencies (or periods, I can't remember) completely independent from each other.

So anyway, you can get any amount of channels from a mod.
 
Sometimes the DMA won't be able to send sound data to the speakers if the bus is being hogged up by something, so random stuff appears in the sound output, making it sound crackly, or complete white noise at times.
 
There are many ways around it. I'm pretty sure there's a thread around here somewhere that sheds more light on this bug.

Edit: here
 
Last edited by a moderator:
MP3 decoding is VERY CPU expensive, on a 66Mhz machine it would take about 50-70% CPU power.
And the main problem is that the gp32 suffers from a DMA-SOUND bug.
Has anyone benched the performance of MP3 vs OGG decoding, using the Tremor library for OGG? From what I recall, Tremor is fixed-point optimized OGG decoding, and works quite well on the GP32, with lower CPU usage than MP3 decoding.

Is the DMA bug less of an issue when doing OGG playback? Can anyone verify this? :)
 
Last edited by a moderator:
Back
Top