From: Arvid Norlander Date: Mon, 25 Dec 2006 19:45:21 +0000 (+0000) Subject: Merged r4480 from 0_3_x to fix soundproblem in info boxes. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=561d285b2ea0fc084f54ef62b1f9c9d65a4877c8;p=supertux.git Merged r4480 from 0_3_x to fix soundproblem in info boxes. SVN-Revision: 4506 --- diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index 732ebf62e..b3eb73137 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "sound_file.hpp" #include "sound_source.hpp" @@ -302,7 +303,7 @@ SoundManager::play_music(const std::string& filename, bool fade) void SoundManager::set_listener_position(const Vector& pos) { - static Uint32 lastticks = 0; + static Uint32 lastticks = SDL_GetTicks(); Uint32 current_ticks = SDL_GetTicks(); if(current_ticks - lastticks < 300) @@ -321,11 +322,12 @@ SoundManager::set_listener_velocity(const Vector& vel) void SoundManager::update() { - static float lasttime = real_time; + static Uint32 lasttime = SDL_GetTicks(); + Uint32 now = SDL_GetTicks(); - if(real_time - lasttime < 0.3) + if(now - lasttime < 300) return; - lasttime = real_time; + lasttime = now; // update and check for finished sound sources for(SoundSources::iterator i = sources.begin(); i != sources.end(); ) {