GP32 Different Samplerates In Mirkos


Blah

Wanna Be Programmer
Joined
Dec 18, 2003
Messages
3,253
Age
35
Location
Oregon, USA
Website
Visit site
My program has some sound effects that are 11.025khz, 8bit mono, and the gp_addsample function only supports 22050khz 16bit mono or stereo. I know some of you must have modified Mirko's code to support more samplerates, I know DrMD does it. I don't think I'd need to keep the mod support, so if its just a quick hack that just happens to break that part of the code, it'd work for me. I *could* just convert the files, but I don't want a 5mb fxe ;) Any help?
 
Look at mixermod.c,

change gp_initSound(22050,16,SEGMENTSIZE*2);
to: gp_initSound(11025,16,SEGMENTSIZE*2);

So you can now use 11.025khz samples, 16 bit, mono or stereo.
 
What about 8bit? That would help a lot. I tried modifiying it to 8 bit in the same way, but it didn't work.
 
Well, now 11.025khz 16bit works, but not 11.025khz 8bit. Changing 16 to 8 just makes garbage come out of the speakers.

edit:
Hmm...Telling it that it is 5512.5 (11025/2) 16bit seems to work. But it sounds a little muffled...weird.
 
you could use mlib sample playing functions.. they are for 8bits mono samples at any rate :blink:
 
Blah posted on May 26 2005 at 04:00 AM said:
Well, now 11.025khz 16bit works, but not 11.025khz 8bit. Changing 16 to 8 just makes garbage come out of the speakers.

edit:
Hmm...Telling it that it is 5512.5 (11025/2) 16bit seems to work. But it sounds a little muffled...weird.

Yes, the Problem is that i wrote only a 16Bit mixer, just changeging it to 8Bit is not working :)
But why not add the missing 8Bit to 16Bit conversion ? Its only (i think) <10 lines of code :)
 
Last edited by a moderator:
Well, I'll try MLIB when I get around to it, and if I can't get that to work, then I'll modify the mixer.
 
Back
Top