aboutsummaryrefslogtreecommitdiff
path: root/sources/TZR_PlayMusic.c
blob: 10725b657f977260e04b270b91f4af78a103cf1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}