diff options
Diffstat (limited to 'source/gameengine/Ketsji/KX_SoundActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_SoundActuator.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 5c4cb7216dd..91f6224e197 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -74,16 +74,16 @@ KX_SoundActuator::KX_SoundActuator(SCA_IObject* gameobj, KX_SoundActuator::~KX_SoundActuator() { - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->stop(); } void KX_SoundActuator::play() { - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->stop(); - if(m_sound.isNull()) + if (m_sound.isNull()) return; // this is the sound that will be played and not deleted afterwards @@ -119,7 +119,7 @@ void KX_SoundActuator::play() AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(m_handle); - if(m_is3d && !handle3d.isNull()) + if (m_is3d && !handle3d.isNull()) { handle3d->setRelative(true); handle3d->setVolumeMaximum(m_3d.max_gain); @@ -132,7 +132,7 @@ void KX_SoundActuator::play() handle3d->setConeVolumeOuter(m_3d.cone_outer_gain); } - if(loop) + if (loop) m_handle->setLoopCount(-1); m_handle->setPitch(m_pitch); m_handle->setVolume(m_volume); @@ -164,7 +164,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) RemoveAllEvents(); - if(m_sound.isNull()) + if (m_sound.isNull()) return false; // actual audio device playing state @@ -182,7 +182,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: { // stop immediately - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->stop(); m_handle = AUD_Reference<AUD_IHandle>(); break; @@ -196,7 +196,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) case KX_SOUNDACT_LOOPBIDIRECTIONAL: { // stop the looping so that the sound stops when it finished - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->setLoopCount(0); break; } @@ -214,7 +214,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) // m_posevent==false && m_posevent==false, in this case IsNegativeEvent() returns false // and assumes this is a positive event. // check that we actually have a positive event so as not to play sounds when being disabled. - else if(bPositiveEvent) { // <- added since 2.49 + else if (bPositiveEvent) { // <- added since 2.49 #else else { // <- works in most cases except a loop-end sound will never stop unless // the negative pulse is done continuesly @@ -229,7 +229,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) { AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(m_handle); - if(m_is3d && !handle3d.isNull()) + if (m_is3d && !handle3d.isNull()) { KX_Camera* cam = KX_GetActiveScene()->GetActiveCamera(); if (cam) @@ -342,7 +342,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, pauseSound, "pauseSound()\n" "\tPauses the sound.\n") { - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->pause(); Py_RETURN_NONE; } @@ -351,7 +351,7 @@ KX_PYMETHODDEF_DOC_NOARGS(KX_SoundActuator, stopSound, "stopSound()\n" "\tStops the sound.\n") { - if(!m_handle.isNull()) + if (!m_handle.isNull()) m_handle->stop(); m_handle = AUD_Reference<AUD_IHandle>(); Py_RETURN_NONE; @@ -364,7 +364,7 @@ PyObject* KX_SoundActuator::pyattr_get_3d_property(void *self, const struct KX_P const char* prop = attrdef->m_name; float result_value = 0.0; - if(!strcmp(prop, "volume_maximum")) { + if (!strcmp(prop, "volume_maximum")) { result_value = actuator->m_3d.max_gain; } else if (!strcmp(prop, "volume_minimum")) { @@ -401,7 +401,7 @@ PyObject* KX_SoundActuator::pyattr_get_audposition(void *self, const struct KX_P KX_SoundActuator * actuator = static_cast<KX_SoundActuator *> (self); float position = 0.0; - if(!actuator->m_handle.isNull()) + if (!actuator->m_handle.isNull()) position = actuator->m_handle->getPosition(); PyObject* result = PyFloat_FromDouble(position); @@ -432,7 +432,7 @@ 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); - if(!actuator->m_sound.isNull()) + if (!actuator->m_sound.isNull()) return AUD_getPythonFactory(&actuator->m_sound); else Py_RETURN_NONE; @@ -449,47 +449,47 @@ int KX_SoundActuator::pyattr_set_3d_property(void *self, const struct KX_PYATTRI AUD_Reference<AUD_I3DHandle> handle3d = AUD_Reference<AUD_I3DHandle>(actuator->m_handle); // if sound is working and 3D, set the new setting - if(!actuator->m_is3d) + if (!actuator->m_is3d) return PY_SET_ATTR_FAIL; - if(!strcmp(prop, "volume_maximum")) { + if (!strcmp(prop, "volume_maximum")) { actuator->m_3d.max_gain = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setVolumeMaximum(prop_value); } else if (!strcmp(prop, "volume_minimum")) { actuator->m_3d.min_gain = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setVolumeMinimum(prop_value); } else if (!strcmp(prop, "distance_reference")) { actuator->m_3d.reference_distance = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setDistanceReference(prop_value); } else if (!strcmp(prop, "distance_maximum")) { actuator->m_3d.max_distance = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setDistanceMaximum(prop_value); } else if (!strcmp(prop, "attenuation")) { actuator->m_3d.rolloff_factor = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setAttenuation(prop_value); } else if (!!strcmp(prop, "cone_angle_inner")) { actuator->m_3d.cone_inner_angle = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setConeAngleInner(prop_value); } else if (!strcmp(prop, "cone_angle_outer")) { actuator->m_3d.cone_outer_angle = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setConeAngleOuter(prop_value); } else if (!strcmp(prop, "cone_volume_outer")) { actuator->m_3d.cone_outer_gain = prop_value; - if(!handle3d.isNull()) + if (!handle3d.isNull()) handle3d->setConeVolumeOuter(prop_value); } else { @@ -507,7 +507,7 @@ int KX_SoundActuator::pyattr_set_audposition(void *self, const struct KX_PYATTRI if (!PyArg_Parse(value, "f", &position)) return PY_SET_ATTR_FAIL; - if(!actuator->m_handle.isNull()) + if (!actuator->m_handle.isNull()) actuator->m_handle->seek(position); return PY_SET_ATTR_SUCCESS; } @@ -520,7 +520,7 @@ int KX_SoundActuator::pyattr_set_gain(void *self, const struct KX_PYATTRIBUTE_DE return PY_SET_ATTR_FAIL; actuator->m_volume = gain; - if(!actuator->m_handle.isNull()) + if (!actuator->m_handle.isNull()) actuator->m_handle->setVolume(gain); return PY_SET_ATTR_SUCCESS; @@ -534,7 +534,7 @@ int KX_SoundActuator::pyattr_set_pitch(void *self, const struct KX_PYATTRIBUTE_D return PY_SET_ATTR_FAIL; actuator->m_pitch = pitch; - if(!actuator->m_handle.isNull()) + if (!actuator->m_handle.isNull()) actuator->m_handle->setPitch(pitch); return PY_SET_ATTR_SUCCESS; @@ -548,7 +548,7 @@ int KX_SoundActuator::pyattr_set_sound(void *self, const struct KX_PYATTRIBUTE_D return PY_SET_ATTR_FAIL; AUD_Reference<AUD_IFactory>* snd = reinterpret_cast<AUD_Reference<AUD_IFactory>*>(AUD_getPythonSound(sound)); - if(snd) + if (snd) { actuator->m_sound = *snd; delete snd; |