fix RageSoundReader_MP3::GetNextSourceFrame

fix lurking mad->Timer bug after seek
This commit is contained in:
Glenn Maynard
2006-12-01 11:08:28 +00:00
parent 1c980ddf4a
commit c1da32160b
+4 -8
View File
@@ -855,7 +855,7 @@ int RageSoundReader_MP3::SetPosition_toc( int ms, bool Xing )
} while( get_this_frame_byte(mad) < bytepos ); } while( get_this_frame_byte(mad) < bytepos );
synth_output(); 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 ); return SetPosition_estimate( ms );
} }
// XXX: untested
int RageSoundReader_MP3::GetNextSourceFrame() const int RageSoundReader_MP3::GetNextSourceFrame() const
{ {
mad_timer_t now( mad->Timer ); int iFrame = mad_timer_count( mad->Timer, mad_units(mad->Frame.header.samplerate) );
mad_timer_multiply( &now, mad->Frame.header.samplerate ); iFrame += mad->outpos / (sizeof(int16_t) * this->Channels);
return iFrame;
int iFrame = mad->outpos / (sizeof(int16_t) * this->Channels);
now.seconds += iFrame;
return now.seconds;
} }
int RageSoundReader_MP3::GetLengthInternal( bool fast ) int RageSoundReader_MP3::GetLengthInternal( bool fast )