mikmod

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
JJPeerless
Posts: 82
Joined: Mon Jun 20, 2005 3:32 am

mikmod

Post by JJPeerless »

can someone explain or show sample of mikmod playing a wav file on the psp..

i cant figure out how to include all the right files..
Treat
Posts: 16
Joined: Sun Sep 26, 2004 10:17 pm

Post by Treat »

Ehm I think mikmod only play modules, but you could make a mod (use a tracker) with you wav as a sample.
develprx
Posts: 3
Joined: Thu Jun 30, 2005 12:05 pm

Post by develprx »

it can be done i believe. you load the appropriate drivers first for the WAV format.

Code: Select all

MikMod_RegisterLoader(load_wav);
MikMod_RegisterDriver(drv_psp);
you pass your wave file to

Code: Select all

MikMod_LoadSong("ms0:/mywav.wav",0xFF);
the rest of the init stuff can be taken from the samples, but these are the only things that deviate from that in terms of loading a wav. if you want to link the wav to the binary as an extern and have it play from memory, you will have to modify mmio.c (the function responsible for opening a music file) to support loading from memory. I normally don't use wavs as they are bulky, but if anything, it can be done like this.
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

From the docs for mikmod (untested code)

Code: Select all

    SAMPLE *sound01;
    int    voice;

    MikMod_RegisterLoader(load_wav);

    sound01 = WAV_LoadFN("sound01.wav");
    voice = MikMod_PlaySample(sound01, 0, 0);

    //enable the mixer
    playing=1;

    //delay while sound plays
    //use Voice_*() api to change how sfx is played

    WAV_Free(sound01);
Jim
Post Reply