/* Registers a sample for loading when SL_LoadSamples() is called. */
SAMPLOAD* SL_RegisterSample(SAMPLE* s,int type,MREADER* reader )
{
SAMPLOAD *news,**samplist,*cruise;
if(type==MD_MUSIC) {
samplist = &musiclist;
cruise = musiclist;
} else
if (type==MD_SNDFX) {
samplist = &sndfxlist;
cruise = sndfxlist;
} else
return NULL;
/* Allocate and add structure to the END of the list */
if(!(news=(SAMPLOAD*)_mm_malloc(sizeof(SAMPLOAD)))) return NULL;
if(cruise) {
while(cruise->next) cruise=cruise->next;
cruise->next = news;
} else
*samplist = news;
news->infmt = s->flags & SF_FORMATMASK;
news->outfmt = news->infmt;
news->reader = reader;
news->sample = s;
news->length = s->length;
news->loopstart = s->loopstart;
news->loopend = s->loopend;
return news;
}
while(cruise->next) cruise=cruise->next;
MikMod_RegisterDriver(&drv_gp32);
md_device = 1; // Force use of only this one driver
MikMod_RegisterLoader(&load_xm);
md_mode |= DMODE_SOFT_MUSIC;
if (MikMod_Init("")) {
gp_debug( "ERROR: During init" );
}
// Starts making noise - clicks like a cicada while the song loads. I presume that
// this means that the ringbuffer has random noise in it and hasn't been cleared
gp_debug( "LOAD MODULE" );
module = Player_Load("dev0:\\GPMM\\skidmark.xm", 8, 0 );
gp_debug( "FINISHED LOADING" );
// Gets to here ok. This means it doesn't crash at least. Exits cleanly, but with errors.
if (module) {
// This bit never happens :(
gp_debug( "START MODULE" );
Player_Start(module);
gp_debug( "PLAY MODULE" );
while (Player_Active()) {
for(i=0; i<10000; i++ ){ j=i; }
MikMod_Update();
}
gp_debug( "FINISHED PLAYING" );
Player_Stop();
Player_Free(module);
}else{
// This is where we end up. Error loading XM. Further debugging within
// the code has (slowly) led me to the 16bit IT unpacking code, but
// I have little knowledge of IT packed samples and can't tell if the
// Data is being read incorrectly
gp_debug( "ERROR LOADING XM" );
}
MikMod_Exit();
