mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +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();
|
||||
VolumeControl::getInstance()->init();
|
||||
AudioManager::getInstance()->init();
|
||||
window->normalizeNextUpdate();
|
||||
|
||||
//update number of times the game has been launched
|
||||
|
@ -274,4 +273,4 @@ FileData::SortType getSortTypeFromString(std::string desc) {
|
|||
}
|
||||
// if not found default to name, ascending
|
||||
return FileSorts::SortTypes.at(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ void AudioManager::deinit()
|
|||
//completely tear down SDL audio. else SDL hogs audio resources and emulators might fail to start...
|
||||
SDL_CloseAudio();
|
||||
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
sInstance = NULL;
|
||||
}
|
||||
|
||||
void AudioManager::registerSound(std::shared_ptr<Sound> & sound)
|
||||
|
|
|
@ -114,6 +114,8 @@ void Sound::play()
|
|||
if(!Settings::getInstance()->getBool("EnableSounds"))
|
||||
return;
|
||||
|
||||
AudioManager::getInstance();
|
||||
|
||||
SDL_LockAudio();
|
||||
if (playing)
|
||||
{
|
||||
|
|
|
@ -191,11 +191,6 @@ void VideoPlayerComponent::stopVideo()
|
|||
int status;
|
||||
kill(mPlayerPid, SIGKILL);
|
||||
waitpid(mPlayerPid, &status, WNOHANG);
|
||||
// Restart AudioManager
|
||||
if (boost::starts_with(Settings::getInstance()->getString("OMXAudioDev").c_str(), "alsa"))
|
||||
{
|
||||
AudioManager::getInstance()->init();
|
||||
}
|
||||
mPlayerPid = -1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue