diff --git a/src/audio/sdlsoundsource.cpp b/src/audio/sdlsoundsource.cpp index afea5c15..77104add 100644 --- a/src/audio/sdlsoundsource.cpp +++ b/src/audio/sdlsoundsource.cpp @@ -153,9 +153,8 @@ struct SDLSoundSource : ALDataSource else { // Unfortunately there is no easy API in SDL_sound for seeking with better precision than 1ms. - // TODO: Work around this by manually consuming the remaining samples. - // TODO: Also we're flooring here when we probably should be rounding. - Sound_Seek(sample, static_cast(seconds * 1000)); + // TODO: Work around this by flooring instead of rounding, and then manually consuming the remaining samples. + Sound_Seek(sample, static_cast(lround(seconds * 1000))); } } diff --git a/src/audio/vorbissource.cpp b/src/audio/vorbissource.cpp index 9c49837a..05379765 100644 --- a/src/audio/vorbissource.cpp +++ b/src/audio/vorbissource.cpp @@ -164,8 +164,7 @@ struct VorbisSource : ALDataSource currentFrame = 0; } - // TODO: We're flooring here when we probably should be rounding. - currentFrame = seconds * info.rate; + currentFrame = lround(seconds * info.rate); if (loop.valid && currentFrame > loop.end) currentFrame = loop.start;