From c1da32160b5229cf22afb69b1b23eb98566c2289 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 1 Dec 2006 11:08:28 +0000 Subject: [PATCH] fix RageSoundReader_MP3::GetNextSourceFrame fix lurking mad->Timer bug after seek --- stepmania/src/RageSoundReader_MP3.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/stepmania/src/RageSoundReader_MP3.cpp b/stepmania/src/RageSoundReader_MP3.cpp index ee9e03cac4..435e96effe 100644 --- a/stepmania/src/RageSoundReader_MP3.cpp +++ b/stepmania/src/RageSoundReader_MP3.cpp @@ -855,7 +855,7 @@ int RageSoundReader_MP3::SetPosition_toc( int ms, bool Xing ) } while( get_this_frame_byte(mad) < bytepos ); synth_output(); - mad_timer_set( &mad->Timer, 0, percent * mad->length, 100 ); + mad_timer_set( &mad->Timer, 0, percent * mad->length, 100000 ); } } @@ -998,15 +998,11 @@ int RageSoundReader_MP3::SetPosition_Fast( int ms ) return SetPosition_estimate( ms ); } -// XXX: untested int RageSoundReader_MP3::GetNextSourceFrame() const { - mad_timer_t now( mad->Timer ); - mad_timer_multiply( &now, mad->Frame.header.samplerate ); - - int iFrame = mad->outpos / (sizeof(int16_t) * this->Channels); - now.seconds += iFrame; - return now.seconds; + int iFrame = mad_timer_count( mad->Timer, mad_units(mad->Frame.header.samplerate) ); + iFrame += mad->outpos / (sizeof(int16_t) * this->Channels); + return iFrame; } int RageSoundReader_MP3::GetLengthInternal( bool fast )