mirror of
https://github.com/hax4dazy/TinWoo.git
synced 2025-02-09 19:25:05 +01:00
don't play non wav sound effects if music is playing
This commit is contained in:
parent
695d477578
commit
adbf44ee5c
@ -150,7 +150,7 @@ namespace inst::ui {
|
|||||||
const char* x = loadsound.c_str();
|
const char* x = loadsound.c_str();
|
||||||
audio = Mix_LoadMUS(x);
|
audio = Mix_LoadMUS(x);
|
||||||
if (audio != NULL) {
|
if (audio != NULL) {
|
||||||
Mix_PlayMusic(audio, -1); //loop "infinitely"
|
Mix_PlayMusic(audio, -1); //-1 loop "infinitely"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,6 +306,9 @@ namespace inst::util {
|
|||||||
playWav(audioPath);
|
playWav(audioPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check if music is already playing, if not play something.
|
||||||
|
if (Mix_PlayingMusic() == 0) {
|
||||||
//if not wav try to play
|
//if not wav try to play
|
||||||
SDL_Init(SDL_INIT_AUDIO);
|
SDL_Init(SDL_INIT_AUDIO);
|
||||||
Mix_Init(MIX_INIT_MP3); //enable mp3 support
|
Mix_Init(MIX_INIT_MP3); //enable mp3 support
|
||||||
@ -318,8 +321,9 @@ namespace inst::util {
|
|||||||
music = Mix_LoadMUS(x);
|
music = Mix_LoadMUS(x);
|
||||||
if (music != NULL) {
|
if (music != NULL) {
|
||||||
Mix_PlayMusic(music, 1);
|
Mix_PlayMusic(music, 1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Mix_HaltChannel(-1);
|
Mix_HaltChannel(-1);
|
||||||
Mix_FreeMusic(music);
|
Mix_FreeMusic(music);
|
||||||
Mix_CloseAudio();
|
Mix_CloseAudio();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user