Use a separate method to check for finished sounds and update the listener

This commit is contained in:
Chris Robinson 2012-03-21 19:21:36 -07:00
parent e6fe1c0261
commit 366c97c492
2 changed files with 48 additions and 43 deletions

View file

@ -370,13 +370,13 @@ namespace MWSound
}
}
void SoundManager::update(float duration)
void SoundManager::updateSounds(float duration)
{
static float timePassed = 0.0;
timePassed += duration;
if(timePassed > (1.0f/30.0f))
{
if(timePassed < (1.0f/30.0f))
return;
timePassed = 0.0f;
// Make sure music is still playing
@ -425,9 +425,13 @@ namespace MWSound
}
}
void SoundManager::update(float duration)
{
updateSounds(duration);
updateRegionSound(duration);
}
// Default readAll implementation, for decoders that can't do anything
// better
void Sound_Decoder::readAll(std::vector<char> &output)

View file

@ -56,6 +56,7 @@ namespace MWSound
float &volume, float &min, float &max);
void streamMusicFull(const std::string& filename);
bool isPlaying(MWWorld::Ptr ptr, const std::string &id) const;
void updateSounds(float duration);
void updateRegionSound(float duration);
protected: