aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJohannes Schickel2010-02-08 21:24:47 +0000
committerJohannes Schickel2010-02-08 21:24:47 +0000
commit18f6ac477602d8fb7160f12284135b67532584ea (patch)
tree2511673bf85988ef7a8ed0eb299b8fceeb2ccf4a /sound
parent17fef2950718cc38fb7f7bfc1f634ed1b7491eaf (diff)
downloadscummvm-rg350-18f6ac477602d8fb7160f12284135b67532584ea.tar.gz
scummvm-rg350-18f6ac477602d8fb7160f12284135b67532584ea.tar.bz2
scummvm-rg350-18f6ac477602d8fb7160f12284135b67532584ea.zip
Fix RawStream::seek implementation.
svn-id: r48007
Diffstat (limited to 'sound')
-rw-r--r--sound/decoders/raw.cpp14
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;