mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-12-01 18:45:39 +00:00
Fix for audio not reinitializing on restart.
This commit is contained in:
parent
d89a1020a2
commit
f3229f111c
|
@ -50,6 +50,15 @@ void AudioManager::mixAudio(void *unused, Uint8 *stream, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioManager::AudioManager()
|
AudioManager::AudioManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioManager::~AudioManager()
|
||||||
|
{
|
||||||
|
deinit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AudioManager::init()
|
||||||
{
|
{
|
||||||
//Set up format and callback. Play 16-bit stereo audio at 44.1Khz
|
//Set up format and callback. Play 16-bit stereo audio at 44.1Khz
|
||||||
sAudioFormat.freq = 44100;
|
sAudioFormat.freq = 44100;
|
||||||
|
@ -65,7 +74,7 @@ AudioManager::AudioManager()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioManager::~AudioManager()
|
void AudioManager::deinit()
|
||||||
{
|
{
|
||||||
SDL_PauseAudio(1);
|
SDL_PauseAudio(1);
|
||||||
SDL_CloseAudio();
|
SDL_CloseAudio();
|
||||||
|
|
|
@ -26,6 +26,9 @@ public:
|
||||||
static void play();
|
static void play();
|
||||||
|
|
||||||
virtual ~AudioManager();
|
virtual ~AudioManager();
|
||||||
|
|
||||||
|
static void init();
|
||||||
|
static void deinit();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,6 +53,7 @@ void Window::init()
|
||||||
{
|
{
|
||||||
mInputManager->init();
|
mInputManager->init();
|
||||||
Renderer::init(0, 0);
|
Renderer::init(0, 0);
|
||||||
|
AudioManager::init();
|
||||||
|
|
||||||
for(unsigned int i = 0; i < mGuiStack.size(); i++)
|
for(unsigned int i = 0; i < mGuiStack.size(); i++)
|
||||||
{
|
{
|
||||||
|
@ -68,6 +69,7 @@ void Window::deinit()
|
||||||
}
|
}
|
||||||
|
|
||||||
mInputManager->deinit();
|
mInputManager->deinit();
|
||||||
|
AudioManager::deinit();
|
||||||
Renderer::deinit();
|
Renderer::deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include "SystemData.h"
|
#include "SystemData.h"
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include "components/GuiDetectDevice.h"
|
#include "components/GuiDetectDevice.h"
|
||||||
#include "AudioManager.h"
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
@ -121,6 +120,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
Window window; //don't call Window.init() because we manually pass the resolution to Renderer::init
|
Window window; //don't call Window.init() because we manually pass the resolution to Renderer::init
|
||||||
window.getInputManager()->init();
|
window.getInputManager()->init();
|
||||||
|
AudioManager::init();
|
||||||
|
|
||||||
//try loading the system config file
|
//try loading the system config file
|
||||||
if(!fs::exists(SystemData::getConfigPath())) //if it doesn't exist, create the example and quit
|
if(!fs::exists(SystemData::getConfigPath())) //if it doesn't exist, create the example and quit
|
||||||
|
|
Loading…
Reference in a new issue