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:
authorCampbell Barton <ideasman42@gmail.com>2009-06-17 16:32:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-06-17 16:32:28 +0400
commit95335af1b908be6044a02ccfb0a0edf529a61eff (patch)
treee2b8e179a7ec45bd780bafbe20c594ab247b331a /source/gameengine/Ketsji/KX_SoundActuator.cpp
parent2519da917a736bfce3616e9f66e0a03e1a6c015f (diff)
fix for a bug reported by zapman on blenderartist.
De-activating a loop-end actuator didnt work (it kept looping). Looked into this further and it turns out that the actuators run with both positive and negative events false, the sound actuator assumes because its not negative that its a positive event and plays the sound anyway. Fix by checking that its a positive event before playing. The size limit on the message actuator was 100 which broke some scripts, set to 16384 instead.
Diffstat (limited to 'source/gameengine/Ketsji/KX_SoundActuator.cpp')
-rw-r--r--source/gameengine/Ketsji/KX_SoundActuator.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp
index c13271f66a5..9e005cd04bb 100644
--- a/source/gameengine/Ketsji/KX_SoundActuator.cpp
+++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp
@@ -105,7 +105,8 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
// do nothing on negative events, otherwise sounds are played twice!
bool bNegativeEvent = IsNegativeEvent();
-
+ bool bPositiveEvent = m_posevent;
+
RemoveAllEvents();
if (!m_soundObject)
@@ -154,8 +155,17 @@ bool KX_SoundActuator::Update(double curtime, bool frame)
// remember that we tried to stop the actuator
m_isplaying = false;
}
- else
- {
+
+#if 1
+ // Warning: when de-activating the actuator, after a single negative event this runs again with...
+ // 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
+ else { // <- works in most cases except a loop-end sound will never stop unless
+ // the negative pulse is done continuesly
+#endif
if (!m_isplaying)
{
switch (m_type)