clamp "lesser position" output

This commit is contained in:
Glenn Maynard
2004-08-24 23:51:43 +00:00
parent d6751ceae0
commit 8fb41ed93c
+11 -2
View File
@@ -743,8 +743,17 @@ int64_t RageSound::GetPositionSecondsInternal( bool *approximate ) const
* error, so let's clamp the result here instead. Be sure to reset this on stop,
* since the position may reset. */
if( cur_frame < max_driver_frame )
LOG->Trace( "Sound %s: driver returned a lesser position (%i < %i)",
this->GetLoadedFilePath().c_str(), (int) cur_frame, (int) max_driver_frame );
{
/* Clamp the output to one per second, so one underruns don't cascade due to
* output spam. */
static RageTimer last(RageZeroTimer);
if( last.IsZero() || last.Ago() > 1.0f )
{
LOG->Trace( "Sound %s: driver returned a lesser position (%i < %i)",
this->GetLoadedFilePath().c_str(), (int) cur_frame, (int) max_driver_frame );
last.Touch();
}
}
max_driver_frame = cur_frame = max( cur_frame, max_driver_frame );
return pos_map.Search( cur_frame, approximate );