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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Mar 22 16:54:56 CET 2010


Revision: 48356
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48356&view=rev
Author:   lordhoto
Date:     2010-03-22 15:54:56 +0000 (Mon, 22 Mar 2010)

Log Message:
-----------
Fix for bug #2969211 "NIPPON: Crash in Intro".

It is not a good idea to supply an SubLoopingAudioStream with the start
and end time to be exactly the same time. Clarify that in the
SubLoopingAudioStream documentation, add an assert in the
SubLoopingAudioStream constructor for that case and also prevent
make8SVXStream from doing so.

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

Modified: scummvm/trunk/sound/audiostream.cpp
===================================================================
--- scummvm/trunk/sound/audiostream.cpp	2010-03-21 12:36:57 UTC (rev 48355)
+++ scummvm/trunk/sound/audiostream.cpp	2010-03-22 15:54:56 UTC (rev 48356)
@@ -169,6 +169,8 @@
       _loopStart(convertTimeToStreamPos(loopStart, getRate(), isStereo())),
       _loopEnd(convertTimeToStreamPos(loopEnd, getRate(), isStereo())),
       _done(false) {
+	assert(loopStart < loopEnd);
+
 	if (!_parent->rewind())
 		_done = true;
 }

Modified: scummvm/trunk/sound/audiostream.h
===================================================================
--- scummvm/trunk/sound/audiostream.h	2010-03-21 12:36:57 UTC (rev 48355)
+++ scummvm/trunk/sound/audiostream.h	2010-03-22 15:54:56 UTC (rev 48356)
@@ -229,6 +229,16 @@
  */
 class SubLoopingAudioStream : public AudioStream {
 public:
+	/**
+	 * Constructor for a SubLoopingAudioStream.
+	 *
+	 * @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)
+	 * @param loopEnd End of the loop (thus must be greater than loopStart)
+	 * @param disposeAfterUse Whether the stream should be disposed, when the
+	 *                        SubLoopingAudioStream is destroyed.
+	 */
 	SubLoopingAudioStream(SeekableAudioStream *stream, uint loops,
 	                      const Timestamp loopStart,
 	                      const Timestamp loopEnd,

Modified: scummvm/trunk/sound/decoders/iff_sound.cpp
===================================================================
--- scummvm/trunk/sound/decoders/iff_sound.cpp	2010-03-21 12:36:57 UTC (rev 48355)
+++ scummvm/trunk/sound/decoders/iff_sound.cpp	2010-03-22 15:54:56 UTC (rev 48356)
@@ -117,9 +117,11 @@
 		loopStart = loader._header.oneShotHiSamples;
 		loopEnd = loader._header.oneShotHiSamples + loader._header.repeatHiSamples;
 
-		return new SubLoopingAudioStream(stream, 0,
+		if (loopStart != loopEnd) {
+			return new SubLoopingAudioStream(stream, 0,
 					Timestamp(0, loopStart, loader._header.samplesPerSec),
 					Timestamp(0, loopEnd, loader._header.samplesPerSec));
+		}
 	}
 
 	return stream;


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