Music Coding Tutorial I : Taj
Hi all,
Its been a while since I posted any example code. So for complete newcomers like me to large intros (:-) ) here is some *minimal* (no error checking) C code for using bassmod. In effect I've written two wrapper functions for playing xm files. I chose bassmod as bass has great sound quality but bassmod is still quite small : its a cut down version of the full bass library.
Of course start with:
#include "bassmod.h"
Now to start the music:
void startMusic () {
BASSMOD_Init (-1, 44100, 0);
BASSMOD_MusicLoad(FALSE,"music.xm",0,0,BASS_MUSIC_LOOP);
BASSMOD_MusicPlayEx(0,-1,TRUE);
}
This initialises the system at 44100 Hz, reads "music.xm" file and sets it to play in a loop.
and this code cleans up and closes down nicely.
void endMusic() {
BASSMOD_MusicStop();
BASSMOD_Free();
}
Thats it! Incredibly simple.
Bassmod is available here:
http://www.un4seen.com/