diff options
Diffstat (limited to 'sound/mp3.cpp')
-rw-r--r-- | sound/mp3.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/mp3.cpp b/sound/mp3.cpp index 02c6634999..6614dc944c 100644 --- a/sound/mp3.cpp +++ b/sound/mp3.cpp @@ -92,7 +92,11 @@ public: bool endOfData() const { return _state == MP3_STATE_EOS; } bool isStereo() const { return MAD_NCHANNELS(&_frame.header) == 2; } int getRate() const { return _frame.header.samplerate; } - int32 getTotalPlayTime() const { return _totalPlayTime; } + int32 getTotalPlayTime() const { + if (!_numLoops) + return kUnknownPlayTime; + return _totalPlayTime * _numLoops; + } void setNumLoops(uint numLoops = 1) { _numLoops = numLoops; } uint getNumPlayedLoops() { return _numPlayedLoops; } @@ -182,9 +186,7 @@ MP3InputStream::MP3InputStream(Common::SeekableReadStream *inStream, bool dispos _totalPlayTime = mad_timer_count(length, MAD_UNITS_MILLISECONDS); - if (numLoops && mad_timer_sign(length) >= 0) - _totalPlayTime *= numLoops; - else + if (mad_timer_sign(length) < 0) _totalPlayTime = kUnknownPlayTime; // Decode the first chunk of data. This is necessary so that _frame |