Aduaspace: fixing playback in the game engine.
authorJörg Müller <nexyon@gmail.com>
Sun, 2 Aug 2015 09:26:20 +0000 (11:26 +0200)
committerJörg Müller <nexyon@gmail.com>
Sun, 2 Aug 2015 09:27:02 +0000 (11:27 +0200)
intern/audaspace/intern/AUD_C-API.cpp
intern/audaspace/intern/AUD_C-API.h
source/gameengine/Ketsji/KX_SoundActuator.cpp

index 48a3c7b2ded312cdcc46bb485b55d68a029fffe2..2d9a8e0ebc8bbb8589322430d3e374fde6fa67a6 100644 (file)
@@ -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
index f53dfcefeddfd55d8dd0fcc545d2523495d9d1be..bdbe751b140c176743c93b9ed0eea31d5d7ee45d 100644 (file)
@@ -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
index 14f0598d08880720b9b6c59dabb9e6b63a22ba7e..02b1071e267b46b5a00721dd0b7c829ac5999379 100644 (file)
@@ -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)