[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11776] branches/soc-2007-hcube/intern/ tinySND/intern/SND_FXSample.cpp: bugfix: now calculates correctly the processable frame batch size.

Csaba Hruska csaba.hruska at gmail.com
Tue Aug 21 20:43:45 CEST 2007


Revision: 11776
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11776
Author:   hcube
Date:     2007-08-21 20:43:45 +0200 (Tue, 21 Aug 2007)

Log Message:
-----------
bugfix: now calculates correctly the processable frame batch size.

Modified Paths:
--------------
    branches/soc-2007-hcube/intern/tinySND/intern/SND_FXSample.cpp

Modified: branches/soc-2007-hcube/intern/tinySND/intern/SND_FXSample.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/intern/SND_FXSample.cpp	2007-08-21 18:39:40 UTC (rev 11775)
+++ branches/soc-2007-hcube/intern/tinySND/intern/SND_FXSample.cpp	2007-08-21 18:43:45 UTC (rev 11776)
@@ -186,7 +186,14 @@
 
 void SND_FXSample::seek( int frameNum )
 {
-    mFrameCounter = frameNum;
+	if( frameNum >= getNumFrames() )
+	{
+		stop();
+	}
+	else
+	{
+		mFrameCounter = frameNum;
+	}
 }
 
 bool SND_FXSample::isDataAvailable(void)
@@ -219,7 +226,7 @@
 		mBuffer = new float[ mBufferSize ];
 	}
 	
-	while( framesDone < framesNum )
+	while( framesDone < framesNum && mPlayState == SND_FXSample::STARTED )
 	{
 		// calculate requested frames position, fill temporary buffer configuration
 		// loop, direction changes
@@ -235,9 +242,9 @@
 		
 			dataFramesNum = endFrame - mFrameCounter;
 		
-			if( dataFramesNum > framesNum )
+			if( dataFramesNum > framesNum - framesDone )
 			{
-				dataFramesNum = framesNum;
+				dataFramesNum = framesNum - framesDone;
 			}
 			
 			// get buffer data
@@ -290,9 +297,9 @@
 		
 			dataFramesNum = mFrameCounter - startFrame;
 		
-			if( dataFramesNum > framesNum )
+			if( dataFramesNum > framesNum - framesDone )
 			{
-				dataFramesNum = framesNum;
+				dataFramesNum = framesNum - framesDone;
 			}
 
 			// get buffer data





More information about the Bf-blender-cvs mailing list