Aduaspace: fixing playback in the game engine.

This commit is contained in:
Joerg Mueller 2015-08-02 11:26:20 +02:00
parent 559e1434d8
commit 4cf92c4831
Notes: blender-bot 2023-02-14 08:48:41 +01:00
Referenced by issue #45652, No audio in game engine in most recent build of 64 bit blender - windows 8.1
3 changed files with 12 additions and 4 deletions

View 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

View 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

View 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)