Merge branch 'master' into unstable

This commit is contained in:
Aloshi 2013-05-20 11:51:50 -05:00
commit eaf157a330
4 changed files with 17 additions and 3 deletions

View file

@ -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();

View file

@ -26,6 +26,9 @@ public:
static void play(); static void play();
virtual ~AudioManager(); virtual ~AudioManager();
static void init();
static void deinit();
}; };
#endif #endif

View file

@ -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();
} }

View file

@ -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