X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fsdl%2Fmusic.c;fp=src%2Fsdl%2Fmusic.c;h=0000000000000000000000000000000000000000;hp=8e8f7cfc1d76156fe6e4576f9c259b2ec5578a53;hb=a6290d5ab0d369d6807bad92d05a4f38560bf111;hpb=e61875cfadc6ac33302d69474209fd215b9f6842 diff --git a/src/sdl/music.c b/src/sdl/music.c deleted file mode 100644 index 8e8f7cf..0000000 --- a/src/sdl/music.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "music.h" -#include "mikmod.h" - -static MODULE *mod; -static int initialized; - - -static int init(void) -{ - MikMod_RegisterAllDrivers(); - MikMod_RegisterAllLoaders(); - - md_mode |= DMODE_SOFT_MUSIC | DMODE_16BITS | DMODE_STEREO | DMODE_INTERP; - if(MikMod_Init("") != 0) { - fprintf(stderr, "mikmod init failed: %s\n", - MikMod_strerror(MikMod_errno)); - return -1; - } - return 0; -} - -int music_open(const char *fname) -{ - if(!initialized) { - if(init() == -1) { - return -1; - } - initialized = 1; - } - - if(!(mod = Player_Load(fname, 64, 0))) { - fprintf(stderr, "failed to load music: %s: %s\n", fname, - MikMod_strerror(MikMod_errno)); - return -1; - } - return 0; -} - -void music_close(void) -{ - if(mod) { - music_stop(); - Player_Free(mod); - mod = 0; - } -} - -void music_play(void) -{ - Player_Start(mod); -} - -void music_stop(void) -{ - Player_Stop(); -} - -void music_update(void) -{ - if(Player_Active()) { - MikMod_Update(); - } -}