diff options
-rw-r--r-- | sound/flac.cpp | 4 | ||||
-rw-r--r-- | sound/vorbis.cpp | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/sound/flac.cpp b/sound/flac.cpp index a43deedcfb..7b424c1d76 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -90,6 +90,7 @@ protected: bool _disposeAfterUse; uint _numLoops; + const uint _totalNumLoops; ::FLAC__SeekableStreamDecoder *_decoder; @@ -158,7 +159,7 @@ public: int32 seconds = samples / rate; int32 milliseconds = (1000 * (samples % rate)) / rate; - return seconds * 1000 + milliseconds; + return (seconds * 1000 + milliseconds) * _totalNumLoops; } bool isStreamDecoderReady() const { return getStreamDecoderState() == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC ; } @@ -210,6 +211,7 @@ FlacInputStream::FlacInputStream(Common::SeekableReadStream *inStream, bool disp _inStream(inStream), _disposeAfterUse(dispose), _numLoops(numLoops), + _totalNumLoops(numLoops), _firstSample(0), _lastSample(0), _outBuffer(NULL), _requestedSamples(0), _lastSampleWritten(false), _methodConvertBuffers(&FlacInputStream::convertBuffersGeneric) diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index 971207b0be..8c12acc6e9 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -92,6 +92,7 @@ protected: bool _isStereo; int _rate; uint _numLoops; + const uint _totalNumLoops; #ifdef USE_TREMOR ogg_int64_t _startTime; @@ -120,9 +121,9 @@ public: int32 getTotalPlayTime() const { #ifdef USE_TREMOR - return _endTime - _startTime; + return (_endTime - _startTime) * _totalNumLoops; #else - return (int32)((_endTime - _startTime) * 1000.0); + return (int32)((_endTime - _startTime) * 1000.0) * _totalNumLoops; #endif } @@ -134,6 +135,7 @@ VorbisInputStream::VorbisInputStream(Common::SeekableReadStream *inStream, bool _inStream(inStream), _disposeAfterUse(dispose), _numLoops(numLoops), + _totalNumLoops(numLoops), _bufferEnd(_buffer + ARRAYSIZE(_buffer)) { bool err = (ov_open_callbacks(inStream, &_ovFile, NULL, 0, g_stream_wrap) < 0); |