1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-22 16:20:58 +00:00

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

View File

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