Commit 050f1c94 authored by nanahira's avatar nanahira

fix se uninit

parent 5a21ce9a
...@@ -93,14 +93,15 @@ void SoundManager::PlaySound(char* sound) { ...@@ -93,14 +93,15 @@ void SoundManager::PlaySound(char* sound) {
#ifdef YGOPRO_USE_MINIAUDIO #ifdef YGOPRO_USE_MINIAUDIO
StopSound(); StopSound();
SetSoundVolume(mainGame->gameConf.sound_volume); SetSoundVolume(mainGame->gameConf.sound_volume);
playingSoundEffect = TRUE;
#ifdef _WIN32 #ifdef _WIN32
wchar_t sound_w[1024]; wchar_t sound_w[1024];
BufferIO::DecodeUTF8(song, sound_w); BufferIO::DecodeUTF8(song, sound_w);
ma_sound_init_from_file_w(&engineSound, sound_w, MA_SOUND_FLAG_ASYNC | MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEffect); ma_sound_init_from_file_w(&engineSound, sound_w, MA_SOUND_FLAG_ASYNC | MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEffect);
#else #else
ma_sound_init_from_file(&engineSound, sound, MA_SOUND_FLAG_ASYNC | MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEffect); ma_sound_init_from_file(&engineSound, sound, MA_SOUND_FLAG_ASYNC | MA_SOUND_FLAG_STREAM, nullptr, nullptr, &soundEffect);
#endif #endif
ma_sound_start(&soundEffect); ma_sound_start(&soundEffect);
#endif #endif
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_IRRKLANG
SetSoundVolume(mainGame->gameConf.sound_volume); SetSoundVolume(mainGame->gameConf.sound_volume);
...@@ -368,7 +369,7 @@ void SoundManager::StopBGM() { ...@@ -368,7 +369,7 @@ void SoundManager::StopBGM() {
} }
void SoundManager::StopSound() { void SoundManager::StopSound() {
#ifdef YGOPRO_USE_MINIAUDIO #ifdef YGOPRO_USE_MINIAUDIO
if(!playingSoundEffect || !ma_sound_is_playing(&soundEffect)) if(!playingSoundEffect)
return; return;
playingSoundEffect = FALSE; playingSoundEffect = FALSE;
ma_sound_uninit(&soundEffect); ma_sound_uninit(&soundEffect);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment