Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-07-23 19:59:10 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-07-23 19:59:10 +0400
commit1193be6eaadc47ef708a521ee883cb12a4650131 (patch)
treeb480289bf6584d0e6038da5750962a144ac2935a /source/gameengine/Ketsji/KX_SoundActuator.cpp
parentfd79de0bb3f8b98cdbf973beababec83a2bc399e (diff)
3D Audio GSoC:
* Reviewed and improved the linear resampler. Now it should work pretty good also for special cases that caused errors previously. * Fixed a crash in the GE when a sound actuator doesn't have a sound assigned. * Corrected the OpenAL device's threading code. This is a bugfix for #27913, thanks to Juha Mäki-Kanto for helping to resolve this.
Diffstat (limited to 'source/gameengine/Ketsji/KX_SoundActuator.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index 0e7b00aeb24..0f2597c336f 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -57,7 +57,10 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj,
KX_SOUNDACT_TYPE type)//,
: SCA_IActuator(gameobj, KX_ACT_SOUND)
{
- m_sound = AUD_copy(sound);
+ if(sound)
+ m_sound = AUD_copy(sound);
+ else
+ m_sound = NULL;
m_volume = volume;
m_pitch = pitch;
m_is3d = is3d;
@@ -73,7 +76,8 @@ KX_SoundActuator::~KX_SoundActuator()
{
if(m_handle)
AUD_stop(m_handle);
- AUD_unload(m_sound);
+ if(m_sound)
+ AUD_unload(m_sound);
}
void KX_SoundActuator::play()
@@ -421,7 +425,10 @@ PyObject* KX_SoundActuator::pyattr_get_pitch(void *self, const struct KX_PYATTRI
PyObject* KX_SoundActuator::pyattr_get_sound(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef)
{
KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self);
- return AUD_getPythonFactory(actuator->m_sound);
+ if(actuator->m_sound)
+ return AUD_getPythonFactory(actuator->m_sound);
+ else
+ Py_RETURN_NONE;
}
int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
@@ -535,7 +542,8 @@ int KX_SoundActuator::pyattr_set_sound(void *self, const struct KX_PYATTRIBUTE_D
AUD_Sound* snd = AUD_getPythonSound(sound);
if(snd)
{
- AUD_unload(actuator->m_sound);
+ if(actuator->m_sound)
+ AUD_unload(actuator->m_sound);
actuator->m_sound = snd;
return PY_SET_ATTR_SUCCESS;
}