• Welcome to Dark Bit Factory & Gravity.
 

SDL_mixer and static Mix_Music structure

Started by fog76, April 13, 2012

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

fog76

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:


//into .h file

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



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


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!

Raizor

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.
raizor

Challenge Trophies Won:

fog76

Thanks Raizor, i will do some tests! K++!

ferris

HxD is what I use for this sorta thing; just open the .mod and use export->C . Will do exactly what you want :) .
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

Raizor

Quote from: Ferris on April 13, 2012
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 :)
raizor

Challenge Trophies Won:

jace_stknights

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
Challenge Trophies Won: