From 91d042da31d1f43a9991cd5d3674317135296f9a Mon Sep 17 00:00:00 2001 From: Flakebi Date: Tue, 10 Feb 2015 13:55:12 +0100 Subject: [PATCH] Set correct volume for last lap music --- src/audio/music.hpp | 1 - src/audio/music_dummy.hpp | 1 - src/audio/music_information.cpp | 5 +++-- src/audio/music_ogg.cpp | 7 ------- src/audio/music_ogg.hpp | 1 - src/audio/sfx_manager.cpp | 3 +-- 6 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/audio/music.hpp b/src/audio/music.hpp index 1389bc853..8908d9e1e 100644 --- a/src/audio/music.hpp +++ b/src/audio/music.hpp @@ -35,7 +35,6 @@ public: virtual bool pauseMusic () = 0; virtual bool resumeMusic () = 0; virtual void setVolume (float volume) = 0; - virtual void updateFading(float percent) = 0; virtual void updateFaster(float percent, float pitch) = 0; virtual void update () = 0; virtual bool isPlaying () = 0; diff --git a/src/audio/music_dummy.hpp b/src/audio/music_dummy.hpp index ef9e4a700..b88202847 100644 --- a/src/audio/music_dummy.hpp +++ b/src/audio/music_dummy.hpp @@ -35,7 +35,6 @@ public: virtual bool pauseMusic () { return true; } virtual bool resumeMusic () { return true; } virtual void setVolume (float volume) {} - virtual void updateFading(float percent) {} virtual void updateFaster(float percent, float pitch) {} virtual void update () {} virtual bool isPlaying () { return false; } diff --git a/src/audio/music_information.cpp b/src/audio/music_information.cpp index fde25fc8f..f35702495 100644 --- a/src/audio/music_information.cpp +++ b/src/audio/music_information.cpp @@ -223,8 +223,8 @@ void MusicInformation::update(float dt) return; } float fraction=m_time_since_faster/m_faster_time; - m_normal_music->updateFading(1-fraction); - m_fast_music->updateFading(fraction); + m_normal_music->setVolume(1-fraction); + m_fast_music->setVolume(fraction); break; } case SOUND_FASTER: { @@ -322,6 +322,7 @@ void MusicInformation::switchToFastMusic() { m_mode = SOUND_FADING; m_fast_music->playMusic(); + m_fast_music->setVolume(0); } else { diff --git a/src/audio/music_ogg.cpp b/src/audio/music_ogg.cpp index e49a293b9..d4458980c 100644 --- a/src/audio/music_ogg.cpp +++ b/src/audio/music_ogg.cpp @@ -257,13 +257,6 @@ void MusicOggStream::setVolume(float volume) check("volume music"); // clear errors } // setVolume -//----------------------------------------------------------------------------- -void MusicOggStream::updateFading(float percent) -{ - alSourcef(m_soundSource,AL_GAIN,percent); - update(); -} // updateFading - //----------------------------------------------------------------------------- void MusicOggStream::updateFaster(float percent, float max_pitch) { diff --git a/src/audio/music_ogg.hpp b/src/audio/music_ogg.hpp index c8f2ec63e..55127790c 100644 --- a/src/audio/music_ogg.hpp +++ b/src/audio/music_ogg.hpp @@ -51,7 +51,6 @@ public: virtual ~MusicOggStream(); virtual void update(); - virtual void updateFading(float percent); virtual void updateFaster(float percent, float max_pitch); virtual bool load(const std::string& filename); diff --git a/src/audio/sfx_manager.cpp b/src/audio/sfx_manager.cpp index b8bf46585..500bfed31 100644 --- a/src/audio/sfx_manager.cpp +++ b/src/audio/sfx_manager.cpp @@ -873,7 +873,7 @@ void SFXManager::positionListener(const Vec3 &position, const Vec3 &front, void SFXManager::reallyPositionListenerNow() { #if HAVE_OGGVORBIS - if (!UserConfigParams::m_sfx || !m_initialized) return; + if (!sfxAllowed()) return; m_listener_position.lock(); { @@ -926,4 +926,3 @@ SFXBase* SFXManager::quickSound(const std::string &sound_type) } } // quickSound -