gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Announcements And Comments > XMid for GBA/DS official release

#170256 - Ruben - Sun Sep 13, 2009 2:28 pm

Hi guys!

So just then, I finished zipping up all the files for XMid.
From the e-mail sent to news...
Quote:
So, at long last, XMid is completed, for both GBA and DS.
Here are a few specs:
-16 note polyphony (on both GBA and DS)
-Assembler optimized sound mixing (GBA only)
-Assembler written sound code (GBA/DS)
-GBA: ~5KB EWRAM, ~2KB IWRAM
-DS: ~0.7KB ARM7 RAM, ~3KB main RAM
-Four music players, to allow special effect 'songs'
-No timers used on DS (timer 0 used on GBA)
Included are the sources for the conversion tools, and demos, along with all executables and sound data (including Midi files and raw sound data + config file).

You can also get a copy here.

Note, however, that I forgot about the GBA version while working on the DS one and.. well... the sound converter won't work half the time for the GBA ><'

The GBA mixer takes *unsigned* 8-bit sound data, whilst the converter outputs the original data, therefore to get it to work, you'll need to make all your data unsigned *before* converting.

That aside, the RAW->XMid conversion program works with a 'config' file, which is somewhat set out like this:
Code:
Filename : DataFormat LoopFlag C4Freq Root LoopStart LoopEnd--or--Size

Example:

Smp_Brass_C4.sw : PCM16 Y 22150 60 13180 26492

Input file is Smp_Brass_C4.sw. It has 16-bit data, and is looped. Its middle-C frequency is 22150Hz, its root key is 60 (note: it doesn't matter what value you set this to.. I'm not sure why I added this >>'), loop start is at 13180 samples and loop end is at 26492 samples.

Another example:

Smp_HHClosed.sw : PCM8 N 22050 60 0 1342

Input file is Smp_HHClosed.sw, it is 8-bit data, non-looped @ 22050Hz, with a length of 1342 samples; however, it will be truncated to 1340 samples, as hardware mixing required word-aligned points.


Hopefully that wasn't too confusing. If you need any further help, drop me a line at my e-mail or PM me.

-- Aik

EDIT:
On further inspection, the sound converter won't work at ALL for GBA, as PCM8 data's loop points and lengths will be divided by 4. Sorry ><'

EDIT 2:
Link 'fixed:' Got it up on RapidShare.
_________________
I'm 18 and have Asperger's, so if I don't get something at first, just bear with me. *nod*


Last edited by Ruben on Tue Sep 15, 2009 8:42 am; edited 2 times in total

#170261 - Ruben - Sun Sep 13, 2009 6:56 pm

Err... I'm gonna feel so stupid for this but anyway...

There's a MAJOR code screwup on XMid_Demo9.c, where it shows that I don't know basic fixed-point math >>'

(I actually do, I was just lacking sleep at the time ^_^')

So uh... if you still need the 'proper' code, here it is:

(From line 113 to 129)
Code:
UsageHi9 = (Clks*100<<8)/280095;
      UsageLo9 = (UsageHi9&255)*100>>8;
      UsageHi9 = (UsageHi9   )>>8;
      
      if((UsageHi9<<8)+UsageLo9 > (PeakHi9<<8)+PeakLo9) {
         PeakHi9 = UsageHi9;
         PeakLo9 = UsageLo9;
      }
      
      UsageHi7 = (rClk*100<<8)/280095;
      UsageLo7 = (UsageHi7&255)*100>>8;
      UsageHi7 = (UsageHi7   )>>8;
      
      if((UsageHi7<<8)+UsageLo7 > (PeakHi7<<8)+PeakLo7) {
         PeakHi7 = UsageHi7;
         PeakLo7 = UsageLo7;
      }

EDIT:
Phooey, even then it's screwed up ><'
Oh well, at least you know it uses very little CPU regardless of the fractional portion being incorrect. I would bother to fix it but I'm tired and about to pass out >>'
_________________
I'm 18 and have Asperger's, so if I don't get something at first, just bear with me. *nod*


Last edited by Ruben on Mon Sep 14, 2009 1:13 am; edited 1 time in total

#170262 - keldon - Sun Sep 13, 2009 9:12 pm

Woot woot, hot stuff!