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.

Audio > NMOD Help

#9503 - Vortex - Wed Aug 06, 2003 4:27 pm

Hello,

After long and exausting unsuccessful attempts to link the MNOD player to my program I finally decided to ask for help. For some reason the examples supplied with the player cannot be compiled or linked. It shows tons of error messages about unresolved external references. My kit includes gcc, devkitadv and crt0.s. I checked some previous discussion regarding the problem but still was not able to find any nice and clear example how to compile/link the player.

Any help will be appreciated.

Thanks

#9507 - tepples - Wed Aug 06, 2003 7:23 pm

If you get unresolved external references, we can't do much to help you unless you paste the exact error output of the linker.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#9508 - Vortex - Wed Aug 06, 2003 7:38 pm

Thank you for the replay. I managed to resolve most of the problems, except one:

Code:

int main(int argc, char argv[])
{
int i;
//Set timer1 interrupt handler to NMOD_Timer1iRQ
iTimer1Intr=NMOD_Timer1iRQ;
//Set mastervolumes to maximum
NMOD_SetMasterVol(64,0);
NMOD_SetMasterVol(64,1);
NMOD_SetMasterVol(64,2);
NMOD_SetMasterVol(64,3);
//Start playing
NMOD_Play( (u32)(&BIN(module)) );
for(;;)
   {
   pad=Joypad();
   if (!(pad&Pad1Start))
      {
      break;
      }
   VSync();
   }
//Stop playing
NMOD_Stop();
for(;;);
}


This is part of the source taken from one of the NMOD examples. The problem is with the following line:

iTimer1Intr=NMOD_Timer1iRQ;

NMOD_Timer1iRQ is a function declared in one of the header files. iTimer1Intr however is not declared anywhere. My best guess this is an interrupt handler, but my crt0.s doesn't support such a name. Also in the (very brief) documentation is not mentioned what kind of interrupt handling should be set in the crt0.s file (there are three modes).

Again, your help will be appreciated.

Thanks in advance

#9509 - DekuTree64 - Wed Aug 06, 2003 8:12 pm

I think you can replace that with anything that makes it get called on a timer1 interrupt.
If you're using Jeff's Crt0, and have interrupts enabled in it, you should have an array of function pointers called IntrTable, so set the timer1 slot of that to NMOD_Timer1iRQ. Not sure which it is, but they go in the order of the bits in REG_IE, so just count until you get to timer1.
If you're using your own or someone else's handler, then I'm not sure. If it's your own, you could just call NMOD_Timer1iRQ directly from the handler if you don't have a function pointer table.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#9527 - Vortex - Thu Aug 07, 2003 6:47 pm

DekuTree64 wrote:
I think you can replace that with anything that makes it get called on a timer1 interrupt.
If you're using Jeff's Crt0, and have interrupts enabled in it, you should have an array of function pointers called IntrTable, so set the timer1 slot of that to NMOD_Timer1iRQ. Not sure which it is, but they go in the order of the bits in REG_IE, so just count until you get to timer1.
If you're using your own or someone else's handler, then I'm not sure. If it's your own, you could just call NMOD_Timer1iRQ directly from the handler if you don't have a function pointer table.


That worked fine. Thanks for the help, much appreciated.