[Bf-blender-cvs] [4cf92c4] master: Aduaspace: fixing playback in the game engine.

Jörg Müller noreply at git.blender.org
Sun Aug 2 11:27:15 CEST 2015


Commit: 4cf92c48311086df2b68583cc50f4980d39ab448
Author: Jörg Müller
Date:   Sun Aug 2 11:26:20 2015 +0200
Branches: master
https://developer.blender.org/rB4cf92c48311086df2b68583cc50f4980d39ab448

Aduaspace: fixing playback in the game engine.

===================================================================

M	intern/audaspace/intern/AUD_C-API.cpp
M	intern/audaspace/intern/AUD_C-API.h
M	source/gameengine/Ketsji/KX_SoundActuator.cpp

===================================================================

diff --git a/intern/audaspace/intern/AUD_C-API.cpp b/intern/audaspace/intern/AUD_C-API.cpp
index 48a3c7b..2d9a8e0 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 f53dfce..bdbe751 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 14f0598..02b1071 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)




More information about the Bf-blender-cvs mailing list