diff --git a/src/audio/sfx_base.hpp b/src/audio/sfx_base.hpp index e0663ec0d..50fc0aee9 100644 --- a/src/audio/sfx_base.hpp +++ b/src/audio/sfx_base.hpp @@ -45,8 +45,7 @@ public: /** Status of a sound effect. */ enum SFXStatus { - SFX_UNKNOWN = -1, SFX_STOPPED = 0, SFX_PAUSED = 1, SFX_PLAYING = 2, - SFX_INITIAL = 3 + SFX_UNKNOWN = -1, SFX_STOPPED = 0, SFX_PAUSED = 1, SFX_PLAYING = 2 }; virtual ~SFXBase() {} diff --git a/src/audio/sfx_openal.cpp b/src/audio/sfx_openal.cpp index 53e5e5b8e..20d6a0d59 100644 --- a/src/audio/sfx_openal.cpp +++ b/src/audio/sfx_openal.cpp @@ -312,8 +312,10 @@ void SFXOpenAL::deleteSFX() void SFXOpenAL::play() { // Technically the sfx is only playing after the sfx thread starts it, - // but for STK this is correct since we don't want to start the same - // sfx twice. + // but this is important to set this here since stk might decide the + // delete a sfx if it has finished playing (i.e. is in stopped state) + // - which can happen if the sfx thread had no time to actually start + // it yet. m_status = SFX_PLAYING; SFXManager::get()->queue(SFXManager::SFX_PLAY, this); } // play diff --git a/src/graphics/hit_sfx.cpp b/src/graphics/hit_sfx.cpp index e9018a474..1a1f45c58 100644 --- a/src/graphics/hit_sfx.cpp +++ b/src/graphics/hit_sfx.cpp @@ -65,6 +65,5 @@ void HitSFX::setPlayerKartHit() bool HitSFX::updateAndDelete(float dt) { SFXBase::SFXStatus status = m_sfx->getStatus(); - if(status==SFXBase::SFX_INITIAL) return false; return status!= SFXBase::SFX_PLAYING; } // updateAndDelete