[Scummvm-cvs-logs] SF.net SVN: scummvm: [26388] scummvm/trunk/sound/flac.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Apr 6 15:16:55 CEST 2007


Revision: 26388
          http://scummvm.svn.sourceforge.net/scummvm/?rev=26388&view=rev
Author:   fingolfin
Date:     2007-04-06 06:16:53 -0700 (Fri, 06 Apr 2007)

Log Message:
-----------
Fix looping for FLAC tracs (looping parts of a file already worked, but looping until the end of data didn't)

Modified Paths:
--------------
    scummvm/trunk/sound/flac.cpp

Modified: scummvm/trunk/sound/flac.cpp
===================================================================
--- scummvm/trunk/sound/flac.cpp	2007-04-05 19:20:12 UTC (rev 26387)
+++ scummvm/trunk/sound/flac.cpp	2007-04-06 13:16:53 UTC (rev 26388)
@@ -332,16 +332,22 @@
 		FLAC__StreamDecoderState state = getStreamDecoderState();
 
 		// Keep poking FLAC to process more samples until we completely satisfied the request
-		for (; _requestedSamples > 0 && state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; state = getStreamDecoderState()) {
+		while (_requestedSamples > 0 && state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) {
 			assert(_sampleCache.bufFill == 0);
 			assert(_requestedSamples % numChannels == 0);
 			processSingleBlock();
+			state = getStreamDecoderState();
+			
+			if (state == FLAC__STREAM_DECODER_END_OF_STREAM) {
+				_lastSampleWritten = true;
+			}
 
 			// If we reached the end of the stream, and looping is enabled: Try to rewind
 			if (_lastSampleWritten && _numLoops != 1) {
 				if (_numLoops != 0)
 					_numLoops--;
 				seekAbsolute(_firstSample);
+				state = getStreamDecoderState();
 			}
 		}
 


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