diff options
-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) |