diff options
author | Johannes Schickel | 2008-05-24 23:49:15 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-05-24 23:49:15 +0000 |
commit | cff8ccccc92e28e6ffe861dafd55b007cc164be8 (patch) | |
tree | cb549f181a4f0ffcb8c4d0fbc06c5777a8a1b826 /sound | |
parent | aba5082d192f04db6d23804a766dddbdcf98fa2d (diff) | |
download | scummvm-rg350-cff8ccccc92e28e6ffe861dafd55b007cc164be8.tar.gz scummvm-rg350-cff8ccccc92e28e6ffe861dafd55b007cc164be8.tar.bz2 scummvm-rg350-cff8ccccc92e28e6ffe861dafd55b007cc164be8.zip |
Take numLoops in account for getTotalPlayTime in FLAC and OGG/Vorbis streams.
svn-id: r32264
Diffstat (limited to 'sound')
-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); |