Author Topic: SDL_mixer and static Mix_Music structure  (Read 3944 times)

0 Members and 1 Guest are viewing this topic.

Offline fog76

  • ZX 81
  • *
  • Posts: 8
  • Karma: 6
    • View Profile
SDL_mixer and static Mix_Music structure
« 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!

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: SDL_mixer and static Mix_Music structure
« Reply #1 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.
raizor

Challenge Trophies Won:

Offline fog76

  • ZX 81
  • *
  • Posts: 8
  • Karma: 6
    • View Profile
Re: SDL_mixer and static Mix_Music structure
« Reply #2 on: April 13, 2012 »
Thanks Raizor, i will do some tests! K++!

Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
Re: SDL_mixer and static Mix_Music structure
« Reply #3 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 :) .
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1154
  • Karma: 175
    • View Profile
Re: SDL_mixer and static Mix_Music structure
« Reply #4 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:

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: SDL_mixer and static Mix_Music structure
« Reply #5 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
Challenge Trophies Won: