diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-10-09 10:06:11 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-10-09 10:06:11 +0400 |
commit | 9ca5b78d1ad13a54f2649a7ed4287435c6727de6 (patch) | |
tree | 89cd0ffe81be16ca2fac557b15398573f0df7256 /intern | |
parent | 4bd7fa9e2e213c92793a9febb6a3f5ca35704a0f (diff) |
BGE bug fix: fix several bugs and inconsistencies in sound actuator:
- support stopping of loop sound
- support stopping by python
- keep state of actuator in sync with audio device.
The lack of state sync was causing several other problems:
- actuator stop playing the sound
- sound chopped before the end
- not possible to pause sound
Diffstat (limited to 'intern')
-rw-r--r-- | intern/SoundSystem/intern/SND_Scene.cpp | 13 | ||||
-rw-r--r-- | intern/SoundSystem/intern/SND_SoundObject.cpp | 9 |
2 files changed, 16 insertions, 6 deletions
diff --git a/intern/SoundSystem/intern/SND_Scene.cpp b/intern/SoundSystem/intern/SND_Scene.cpp index bbf971ddc87..9d050a81161 100644 --- a/intern/SoundSystem/intern/SND_Scene.cpp +++ b/intern/SoundSystem/intern/SND_Scene.cpp @@ -388,11 +388,18 @@ void SND_Scene::UpdateActiveObects() #endif #ifdef USE_OPENAL // ok, properties Set. now see if it must play - if (pObject->GetPlaystate() == SND_MUST_PLAY) - { + switch (pObject->GetPlaystate()){ + case SND_MUST_PLAY: m_audiodevice->PlayObject(id); pObject->SetPlaystate(SND_PLAYING); - //break; + break; + case SND_MUST_STOP: + RemoveActiveObject(pObject); + break; + case SND_MUST_PAUSE: + m_audiodevice->PauseObject(id); + pObject->SetPlaystate(SND_PAUSED); + break; } #endif diff --git a/intern/SoundSystem/intern/SND_SoundObject.cpp b/intern/SoundSystem/intern/SND_SoundObject.cpp index e514a186e5e..7a244b5090d 100644 --- a/intern/SoundSystem/intern/SND_SoundObject.cpp +++ b/intern/SoundSystem/intern/SND_SoundObject.cpp @@ -91,21 +91,24 @@ SND_SoundObject::~SND_SoundObject() void SND_SoundObject::StartSound() { - m_playstate = SND_MUST_PLAY; + if (m_id >= 0) + m_playstate = SND_MUST_PLAY; } void SND_SoundObject::StopSound() { - m_playstate = SND_MUST_STOP; + if (m_id >= 0) + m_playstate = SND_MUST_STOP; } void SND_SoundObject::PauseSound() { - m_playstate = SND_MUST_PAUSE; + if (m_id >= 0) + m_playstate = SND_MUST_PAUSE; } |