From b5243763a2ccddaeb4e4ad31f14b347137e57f2c Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Mon, 16 Dec 2013 19:11:17 -0800 Subject: [PATCH] - added some device cleanup in case its needed --- .../sources/sound/openal/sound_player_openal.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp index cdc18c62..1934af37 100644 --- a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp +++ b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp @@ -377,6 +377,18 @@ bool SoundPlayerOpenAL::init(const SoundPlayerParams* params) { this->params = *params; try { + + if(context != 0) { + alcMakeContextCurrent( NULL ); + alcDestroyContext(context); + context = 0; + } + + if(device != 0) { + alcCloseDevice(device); + device = 0; + } + // Allows platforms to specify which sound device to use // using the environment variable: MEGAGLEST_SOUND_DEVICE char *deviceName = getenv("MEGAGLEST_SOUND_DEVICE");