mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Remove explicit calls to AudioManager::init() and fix deinit() behaviour
Ensure that deinit() removes the current sInstance so that the next call to AudioManager::getInstance() will re-initialize audio correctly. Remove explicit calls to AudioManager::init() and instead rely on Sound::play() to initialize audio when needed.
This commit is contained in:
parent
dca648c160
commit
c08c24e615
|
@ -199,7 +199,6 @@ void FileData::launchGame(Window* window)
|
||||||
|
|
||||||
window->init();
|
window->init();
|
||||||
VolumeControl::getInstance()->init();
|
VolumeControl::getInstance()->init();
|
||||||
AudioManager::getInstance()->init();
|
|
||||||
window->normalizeNextUpdate();
|
window->normalizeNextUpdate();
|
||||||
|
|
||||||
//update number of times the game has been launched
|
//update number of times the game has been launched
|
||||||
|
|
|
@ -106,6 +106,7 @@ void AudioManager::deinit()
|
||||||
//completely tear down SDL audio. else SDL hogs audio resources and emulators might fail to start...
|
//completely tear down SDL audio. else SDL hogs audio resources and emulators might fail to start...
|
||||||
SDL_CloseAudio();
|
SDL_CloseAudio();
|
||||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||||
|
sInstance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioManager::registerSound(std::shared_ptr<Sound> & sound)
|
void AudioManager::registerSound(std::shared_ptr<Sound> & sound)
|
||||||
|
|
|
@ -114,6 +114,8 @@ void Sound::play()
|
||||||
if(!Settings::getInstance()->getBool("EnableSounds"))
|
if(!Settings::getInstance()->getBool("EnableSounds"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
AudioManager::getInstance();
|
||||||
|
|
||||||
SDL_LockAudio();
|
SDL_LockAudio();
|
||||||
if (playing)
|
if (playing)
|
||||||
{
|
{
|
||||||
|
|
|
@ -191,11 +191,6 @@ void VideoPlayerComponent::stopVideo()
|
||||||
int status;
|
int status;
|
||||||
kill(mPlayerPid, SIGKILL);
|
kill(mPlayerPid, SIGKILL);
|
||||||
waitpid(mPlayerPid, &status, WNOHANG);
|
waitpid(mPlayerPid, &status, WNOHANG);
|
||||||
// Restart AudioManager
|
|
||||||
if (boost::starts_with(Settings::getInstance()->getString("OMXAudioDev").c_str(), "alsa"))
|
|
||||||
{
|
|
||||||
AudioManager::getInstance()->init();
|
|
||||||
}
|
|
||||||
mPlayerPid = -1;
|
mPlayerPid = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue