GP32 .mod Files With Mrmirkos Sdk


tr8theshape

Still Fresh
Joined
Jul 27, 2004
Messages
2
Hiya,

Had my GP32 for about a year now and have downloaded MrMirkos SDK. Having a play with it and it all seems good but I am struggling with the .mod tracker files.

How do I convert them into the .C format required so that I can use them with MrMirkos SDK? :(

Thanks in Advance
:huh:
 
You don't have to convert them into arrays, you can just open the file with this little tidbit of code:

Code:
gp_startSoundmixer(0);
tmp = (char*) malloc(8192);
bytes_read=smc_read("dev0:\\gpmm\\mm\\mm.mod",tmp,0,8192);
if (bytes_read == 0) gp_startModfile(wasteland); // ERROR
if (bytes_read == 8192){  // OK
	gpfile = smc_fopen("dev0:\\gpmm\\mm\\mm.mod","r");
	size = smc_filesize(gpfile);
	smc_fclose(gpfile);
	mod = (char*) malloc(size);
	smc_read("dev0:\\gpmm\\mm\\mm.mod",mod,0,size);
	gp_startModfile(mod); // adds mod to mixer
}

This code will load the mm.mod file in \gpmm\mm and check to see if it's actually there, if it's not, it loads a builtin MOD file (One found in an example dir), else it starts the mod file it loaded.
 
Cheers!

I'll give that a go!

B)


Tristan posted on Oct 13 2004 at 08:11 PM said:
You don't have to convert them into arrays, you can just open the file with this little tidbit of code:

Code:
gp_startSoundmixer(0);
tmp = (char*) malloc(8192);
bytes_read=smc_read("dev0:\\gpmm\\mm\\mm.mod",tmp,0,8192);
if (bytes_read == 0) gp_startModfile(wasteland); // ERROR
if (bytes_read == 8192){  // OK
	gpfile = smc_fopen("dev0:\\gpmm\\mm\\mm.mod","r");
	size = smc_filesize(gpfile);
	smc_fclose(gpfile);
	mod = (char*) malloc(size);
	smc_read("dev0:\\gpmm\\mm\\mm.mod",mod,0,size);
	gp_startModfile(mod); // adds mod to mixer
}

Note that this is taken literally from my code, and I took it almost literally from Mirko's SDK.
 
Last edited by a moderator:
If you want to avoid using SMC functions (never tried them, but they're reported to be awfully slow), you might use the 'convert' tool mirko included in his SDK to convert the mod to a c array, or use objcopy (I just added that because people regularly slap me for using data arrays).
 
Back
Top