diff options
author | Johannes Schickel | 2010-06-09 13:34:15 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-06-09 13:34:15 +0000 |
commit | 5b2a60d0495c76c32e358e8a2dff6c82f7ddd710 (patch) | |
tree | d6301e74d2902390b31adaccbba8fe037d66a4f8 /sound | |
parent | 0f2e6b0f856afdfb540b681a194d001d051029f5 (diff) | |
download | scummvm-rg350-5b2a60d0495c76c32e358e8a2dff6c82f7ddd710.tar.gz scummvm-rg350-5b2a60d0495c76c32e358e8a2dff6c82f7ddd710.tar.bz2 scummvm-rg350-5b2a60d0495c76c32e358e8a2dff6c82f7ddd710.zip |
Rewind the underlying audio stream on LoopingAudioStream creation.
Also mention in the documentation that both LoopingAudioStream and
SubLoopingAudioStream do rewind the underlying in their constructor.
svn-id: r49539
Diffstat (limited to 'sound')
-rw-r--r-- | sound/audiostream.cpp | 6 | ||||
-rw-r--r-- | sound/audiostream.h | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index ce2c521e5e..a092e6c29d 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -95,6 +95,12 @@ SeekableAudioStream *SeekableAudioStream::openStreamFile(const Common::String &b LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops, DisposeAfterUse::Flag disposeAfterUse) : _parent(stream), _disposeAfterUse(disposeAfterUse), _loops(loops), _completeIterations(0) { + assert(stream); + + if (!stream->rewind()) { + // TODO: Properly indicate error + _loops = _completeIterations = 1; + } } LoopingAudioStream::~LoopingAudioStream() { diff --git a/sound/audiostream.h b/sound/audiostream.h index 37a1953bb9..edf517b003 100644 --- a/sound/audiostream.h +++ b/sound/audiostream.h @@ -109,6 +109,9 @@ public: /** * Creates a looping audio stream object. * + * Note that on creation of the LoopingAudioStream object + * the underlying stream will be rewound. + * * @see makeLoopingAudioStream * * @param stream Stream to loop @@ -232,6 +235,9 @@ public: /** * Constructor for a SubLoopingAudioStream. * + * Note that on creation of the LoopingAudioStream object + * the underlying stream will be rewound. + * * @param stream Stream to loop * @param loops How often the stream should be looped (0 means infinite) * @param loopStart Start of the loop (this must be smaller than loopEnd) |