diff options
author | kdx <kikoodx@paranoici.org> | 2023-04-30 16:37:46 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-04-30 16:37:46 +0200 |
commit | a4112e4311eb226c4f43cb697aa7f6c34bd7b9a5 (patch) | |
tree | fca5829693c41fac4bf2e70cd4c63f1d1742d51a /sources/TZR_PlayMusic.c | |
parent | 6044a3bac4433e9ce8d114bdbc180ca7b48b2344 (diff) | |
download | tzr-a4112e4311eb226c4f43cb697aa7f6c34bd7b9a5.tar.gz |
music playing
Diffstat (limited to 'sources/TZR_PlayMusic.c')
-rw-r--r-- | sources/TZR_PlayMusic.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sources/TZR_PlayMusic.c b/sources/TZR_PlayMusic.c new file mode 100644 index 0000000..10725b6 --- /dev/null +++ b/sources/TZR_PlayMusic.c @@ -0,0 +1,19 @@ +#include "TZR_sound.h" +#include "TZR_globals.h" +#include "sdl_error.h" + +int +TZR_PlayMusic(const char *path, int loop) +{ + if (!___tzr_config.mixer) { + fprintf(stderr, "mixer is disabled\n"); + return -1; + } + TZR_StopMusic(); + ___tzr_music = Mix_LoadMUS(path); + if (___tzr_music == NULL) + return sdl_error(-1); + if (Mix_PlayMusic(___tzr_music, loop) < 0) + return sdl_error(-1); + return 0; +} |