Dark Bit Factory & Gravity

PROGRAMMING => C / C++ /C# => Topic started by: fog76 on April 13, 2012

Title: SDL_mixer and static Mix_Music structure
Post by: fog76 on April 13, 2012
Hi all,
i wanted to know if it was possible to convert a .mod file into a .h file to have a small music stored directly into the executable file.

I mean something like this:

Code: [Select]
//into .h file

static Mix_Music *MyMusic = {0XFF, 0XBA, 0XCC.... and so on


to be simply called into main.cc in a similar manner:

Code: [Select]
Mix_PlayMusic(MyMusic, -1);

My idea is to create an executable file that contains within it the piece of music that should sound. In your opinion what is possible using SDL_mixer? And how can convert a .mod file into a .h file?

Thanks to all!
Title: Re: SDL_mixer and static Mix_Music structure
Post by: Raizor on April 13, 2012
fog76, that is indeed possible. You need a program to convert the binary file into a header (.h) file. There are many variations of this program called "bin2inc". Here's one I just found. (http://www.harmlesslion.com/cgi-bin/onesoft.cgi?113)
Title: Re: SDL_mixer and static Mix_Music structure
Post by: fog76 on April 13, 2012
Thanks Raizor, i will do some tests! K++!
Title: Re: SDL_mixer and static Mix_Music structure
Post by: ferris on April 13, 2012
HxD (http://mh-nexus.de/en/hxd/) is what I use for this sorta thing; just open the .mod and use export->C . Will do exactly what you want :) .
Title: Re: SDL_mixer and static Mix_Music structure
Post by: Raizor on April 13, 2012
HxD (http://mh-nexus.de/en/hxd/) is what I use for this sorta thing; just open the .mod and use export->C . Will do exactly what you want :) .

That looks like a handy tool Ferris. Disk and RAM editing sounds especially cool :)
Title: Re: SDL_mixer and static Mix_Music structure
Post by: jace_stknights on April 14, 2012
Yep this prog looks like really more usefull than the simple php script I made for this sort of conversion :D By the way Bin2inc will be fine also  ;D