diff --git a/sound/decoders/raw.cpp b/sound/decoders/raw.cpp index 2d4da5c63d6..61884e2951f 100644 --- a/sound/decoders/raw.cpp +++ b/sound/decoders/raw.cpp @@ -185,6 +185,14 @@ int RawStream::readBuffer(int16 *buffer, cons template bool RawStream::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::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;