Set correct volume for last lap music

This commit is contained in:
Flakebi 2015-02-10 13:55:12 +01:00
parent 84a84b6776
commit 91d042da31
6 changed files with 4 additions and 14 deletions

View File

@ -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;

View File

@ -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; }

View File

@ -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
{

View File

@ -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)
{

View File

@ -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);

View File

@ -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