diff options
author | Max Horn | 2010-01-11 10:17:55 +0000 |
---|---|---|
committer | Max Horn | 2010-01-11 10:17:55 +0000 |
commit | 590481b12daf2287b37fdae757f8cca349912754 (patch) | |
tree | 9349d173d37353c567f9f5f971e861e91dd59b17 /sound/audiostream.cpp | |
parent | 87cdc86580625abc12bbd4fde71764e4fd88a357 (diff) | |
download | scummvm-rg350-590481b12daf2287b37fdae757f8cca349912754.tar.gz scummvm-rg350-590481b12daf2287b37fdae757f8cca349912754.tar.bz2 scummvm-rg350-590481b12daf2287b37fdae757f8cca349912754.zip |
Improve support for negative Timestamps, and add + and - operators
svn-id: r47244
Diffstat (limited to 'sound/audiostream.cpp')
-rw-r--r-- | sound/audiostream.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 6d72b83dd1..3fcfbe14c0 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -222,9 +222,8 @@ SubSeekableAudioStream::SubSeekableAudioStream(SeekableAudioStream *parent, cons : _parent(parent), _disposeAfterUse(disposeAfterUse), _start(start.convertToFramerate(getRate())), _pos(0, getRate() * (isStereo() ? 2 : 1)), - _length(end.convertToFramerate(getRate())) { - // TODO: This really looks like Timestamp::operator- - _length = Timestamp(_length.secs() - _start.secs(), _length.numberOfFrames() - _start.numberOfFrames(), getRate()); + _length((start - end).convertToFramerate(getRate())) { + _parent->seek(_start); } @@ -247,8 +246,7 @@ bool SubSeekableAudioStream::seek(const Timestamp &where) { return false; } - // TODO: This really looks like Timestamp::operator+ - if (_parent->seek(Timestamp(_pos.secs() + _start.secs(), _pos.numberOfFrames() + _start.numberOfFrames(), getRate()))) { + if (_parent->seek(_pos + _start)) { return true; } else { _pos = _length; |