diff options
author | Joerg Mueller <nexyon@gmail.com> | 2010-07-31 14:03:08 +0400 |
---|---|---|
committer | Joerg Mueller <nexyon@gmail.com> | 2010-07-31 14:03:08 +0400 |
commit | 5c9cf81cf98c99e52064b0cd45be3b2eaba9e40c (patch) | |
tree | 463240a84d34a3debf5bba9c326827fb436db703 /source/gameengine/Ketsji | |
parent | 61c9e46aad2cf679331341c7d38f10bec19203a9 (diff) |
Audaspace:
* Fixed some compiler warnings
* Implemented device looping
* Note: Scrubbing in the sequencer is broken atm
Diffstat (limited to 'source/gameengine/Ketsji')
-rw-r--r-- | source/gameengine/Ketsji/KX_SoundActuator.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index c3ef36dfe11..09ad567117f 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -76,23 +76,20 @@ void KX_SoundActuator::play() // this is the sound that will be played and not deleted afterwards AUD_Sound* sound = m_sound; - // this sounds are for temporary stacked sounds, will be deleted if not NULL + // this sound is for temporary stacked sounds, will be deleted if not NULL AUD_Sound* sound2 = NULL; - AUD_Sound* sound3 = NULL; + + bool loop = false; switch (m_type) { case KX_SOUNDACT_LOOPBIDIRECTIONAL: case KX_SOUNDACT_LOOPBIDIRECTIONAL_STOP: - // create a ping pong sound on sound2 stacked on the orignal sound - sound2 = AUD_pingpongSound(sound); - // create a loop sound on sound3 stacked on the pingpong sound and let that one play (save it to sound) - sound = sound3 = AUD_loopSound(sound2); - break; + sound = sound2 = AUD_pingpongSound(sound); + // fall through case KX_SOUNDACT_LOOPEND: case KX_SOUNDACT_LOOPSTOP: - // create a loop sound on sound2 stacked on the pingpong sound and let that one play (save it to sound) - sound = sound2 = AUD_loopSound(sound); + loop = true; break; case KX_SOUNDACT_PLAYSTOP: case KX_SOUNDACT_PLAYEND: @@ -118,14 +115,12 @@ void KX_SoundActuator::play() else m_handle = AUD_play(sound, 0); + if(loop) + AUD_setLoop(m_handle, -1); AUD_setSoundPitch(m_handle, m_pitch); AUD_setSoundVolume(m_handle, m_volume); m_isplaying = true; - // now we unload the pingpong and loop sounds, as we don't need them anymore - // the started sound will continue playing like it was created, don't worry! - if(sound3) - AUD_unload(sound3); if(sound2) AUD_unload(sound2); } @@ -185,7 +180,7 @@ bool KX_SoundActuator::Update(double curtime, bool frame) case KX_SOUNDACT_LOOPBIDIRECTIONAL: { // stop the looping so that the sound stops when it finished - AUD_setLoop(m_handle, 0, -1); + AUD_setLoop(m_handle, 0); break; } default: |