diff options
author | Johannes Schickel | 2010-02-08 21:24:47 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-02-08 21:24:47 +0000 |
commit | 18f6ac477602d8fb7160f12284135b67532584ea (patch) | |
tree | 2511673bf85988ef7a8ed0eb299b8fceeb2ccf4a /sound/decoders | |
parent | 17fef2950718cc38fb7f7bfc1f634ed1b7491eaf (diff) | |
download | scummvm-rg350-18f6ac477602d8fb7160f12284135b67532584ea.tar.gz scummvm-rg350-18f6ac477602d8fb7160f12284135b67532584ea.tar.bz2 scummvm-rg350-18f6ac477602d8fb7160f12284135b67532584ea.zip |
Fix RawStream::seek implementation.
svn-id: r48007
Diffstat (limited to 'sound/decoders')
-rw-r--r-- | sound/decoders/raw.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sound/decoders/raw.cpp b/sound/decoders/raw.cpp index 2d4da5c63d..61884e2951 100644 --- a/sound/decoders/raw.cpp +++ b/sound/decoders/raw.cpp @@ -185,6 +185,14 @@ int RawStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffer, cons template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> bool RawStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) { + _filePos = 0; + _diskLeft = 0; + _bufferLeft = 0; + _curBlock = _blocks.end(); + + if (where > _playtime) + return false; + const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames(); uint32 curSample = 0; @@ -198,12 +206,8 @@ bool RawStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) curSample = nextBlockSample; } - _filePos = 0; - _diskLeft = 0; - _bufferLeft = 0; - if (_curBlock == _blocks.end()) { - return ((seekSample - curSample) == (uint32)_curBlock->len); + return ((seekSample - curSample) == 0); } else { const uint32 offset = seekSample - curSample; |