ADPCM sample

zeromus
Posts: 212
Joined: Wed Mar 31, 2010 6:05 pm

Re: ADPCM sample

Post by zeromus » Tue Jun 28, 2011 5:44 pm

mysoft, if you can send me your buildable project zipped up I will investigate why it sounds so crappy in desmume. advanced spu logic is supposed to be flawless.

Mysoft
Posts: 20
Joined: Thu Jun 09, 2011 11:56 am

Re: ADPCM sample

Post by Mysoft » Tue Jun 28, 2011 7:12 pm

zeromus wrote:mysoft, if you can send me your buildable project zipped up I will investigate why it sounds so crappy in desmume. advanced spu logic is supposed to be flawless.
well, i see... but the project is made on freebasic using the "-gen gcc" switch, that uses GCC as a "high level assembler", because that's what i'm doing, porting freebasic runtlime/gfxlib to DS... so the generated C looks something similar to this:

Code: Select all

static void fb_ctor__main( void )
{
	string BORDER$;
	string LETTERS$[5];
	TMP$117 tmp$116$;
	string TEXT$[5];
	TMP$119 tmp$118$;
	string MESSAGE$;
	integer BORDERPOSI$;
	integer TEXTPOSI$;
	integer TEXTLEN$;
	label$0:;
	*(integer*)((ubyte *)67108864) = ((integer)65536);
	*(integer*)((ubyte *)67112960) = ((integer)65536);
	*(ubyte*)((ubyte *)67109440) = ((ubyte)129);
	*(ubyte*)((ubyte *)67109442) = ((ubyte)132);
	FBKEYBOARD$ = ((KEYBOARD*)0);
	consoleInit( (PRINTCONSOLE *)&FBTOPCONSOLE$, (integer)3, (integer)1, (integer)65536, (integer)31, (integer)0, (integer)((-0) - 1), (integer)((-0) - 1) );
	consoleInit( (PRINTCONSOLE *)&FBBOTTOMCONSOLE$, (integer)3, (integer)1, (integer)65536, (integer)31, (integer)0, (integer)0, (integer)((-0) - 1) );
	irqSet( (integer)2, &HBLANKINTERRUPT );
	irqSet( (integer)1, &VBLANKINTERRUPT );
	irqEnable( (integer)2 );
	irqEnable( (integer)1 );
	soundEnable(  );
	keysSetRepeat( (ubyte)40, (ubyte)3 );
	FBCONSOLE$ = ((PRINTCONSOLE *)&FBTOPCONSOLE$);
and so the C only will not be useful to you, and with the ".bat" that calls freebasic to generate the .C file and then call the makefile, isnt in a good state yet (too hardcoded), so maybe later?

but essentially all that i'm doing... is... i increment my "ticks" variable every hblank.... and so my Timer() function returns
Ticks/15766 as a double float (altough that is not nice since DS it doesnt have FPU, but for now, it's fine...)
then i start the adpcm sample for the MIDI NOTE, wait for the period and then kill the sound (or start a new one before kill, if it's suppose to be LEGATO mode).
also. i pool the Timer() function with swiIntrWait(1,IRQ_HBLANK) delays.... until the period is over...

btw before that i also made it play MP3's with madlib/mpg123lib using the same HBLANK while waiting for a new MP3 frame to play (and some compensation, because stream buffers require high precision)... and so i noticed that on DESMUME, higher the CPU usage, more unstable the hblank timer fires.... it was firing several times in a row every 50ms or something like that... while that option was on.... but sadly i dunno how much CPU desmume is using, because unlike no$gba, desmume always use 100% of one core...

and so that's all info about it i can give to you for now :)
i hope it was clear enough ehheheh

zeromus
Posts: 212
Joined: Wed Mar 31, 2010 6:05 pm

Re: ADPCM sample

Post by zeromus » Tue Jun 28, 2011 10:19 pm

yes, maybe later.
the real-time speed at which desmume runs hblanks is irrelevant. it runs at the exactly right rate for the emulation. it may run in 0.0001 msec real-time if your computer is very fast, and then it will sit and do nothing until 1/60 second has passed.
desmume is just decoding your adpcm samples wrongly for some reason.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests