diff options
-rw-r--r-- | intern/audaspace/intern/AUD_C-API.cpp | 10 | ||||
-rw-r--r-- | intern/audaspace/intern/AUD_C-API.h | 2 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_SoundActuator.cpp | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp index 48a3c7b2ded..2d9a8e0ebc8 100644 --- a/intern/audaspace/intern/AUD_C-API.cpp +++ b/intern/audaspace/intern/AUD_C-API.cpp @@ -814,10 +814,9 @@ int AUD_Device_read(AUD_Device *device, data_t *buffer, int length) void AUD_Device_free(AUD_Device *device) { - assert(device); - try { - delete device; + if(device != &AUD_device) + delete device; } catch(AUD_Exception&) { @@ -1347,6 +1346,11 @@ AUD_Device *AUD_openMixdownDevice(AUD_DeviceSpecs specs, AUD_Sound *sequencer, f } } +AUD_Device *AUD_Device_getCurrent(void) +{ + return &AUD_device; +} + int AUD_isJackSupported(void) { #ifdef WITH_JACK diff --git a/intern/audaspace/intern/AUD_C-API.h b/intern/audaspace/intern/AUD_C-API.h index f53dfcefedd..bdbe751b140 100644 --- a/intern/audaspace/intern/AUD_C-API.h +++ b/intern/audaspace/intern/AUD_C-API.h @@ -811,6 +811,8 @@ extern void *AUD_getPythonSound(AUD_Sound *sound); extern AUD_Sound *AUD_getSoundFromPython(void *sound); #endif +extern AUD_Device *AUD_Device_getCurrent(void); + extern int AUD_isJackSupported(void); #ifdef __cplusplus diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 14f0598d088..02b1071e267 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -122,7 +122,9 @@ void KX_SoundActuator::play() break; } - //m_handle = AUD_Device_play(BKE_sound_get_device(), sound, false); + AUD_Device* device = AUD_Device_getCurrent(); + m_handle = AUD_Device_play(device, sound, false); + AUD_Device_free(device); // in case of pingpong, we have to free the sound if(sound != m_sound) |