[Scummvm-cvs-logs] SF.net SVN: scummvm:[49539] scummvm/trunk/sound

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Jun 9 15:34:16 CEST 2010


Revision: 49539
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49539&view=rev
Author:   lordhoto
Date:     2010-06-09 13:34:15 +0000 (Wed, 09 Jun 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/sound/audiostream.cpp
    scummvm/trunk/sound/audiostream.h

Modified: scummvm/trunk/sound/audiostream.cpp
===================================================================
--- scummvm/trunk/sound/audiostream.cpp	2010-06-09 13:27:59 UTC (rev 49538)
+++ scummvm/trunk/sound/audiostream.cpp	2010-06-09 13:34:15 UTC (rev 49539)
@@ -95,6 +95,12 @@
 
 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() {

Modified: scummvm/trunk/sound/audiostream.h
===================================================================
--- scummvm/trunk/sound/audiostream.h	2010-06-09 13:27:59 UTC (rev 49538)
+++ scummvm/trunk/sound/audiostream.h	2010-06-09 13:34:15 UTC (rev 49539)
@@ -109,6 +109,9 @@
 	/**
 	 * 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 @@
 	/**
 	 * 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)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list