[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11675] branches/soc-2007-hcube/intern/ tinySND/samplerate: Added callback feature (before processing PCM data).

Csaba Hruska csaba.hruska at gmail.com
Sun Aug 19 12:28:57 CEST 2007


Revision: 11675
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11675
Author:   hcube
Date:     2007-08-19 12:28:57 +0200 (Sun, 19 Aug 2007)

Log Message:
-----------
Added callback feature (before processing PCM data).

Modified Paths:
--------------
    branches/soc-2007-hcube/intern/tinySND/samplerate/SND_FXSRC.cpp
    branches/soc-2007-hcube/intern/tinySND/samplerate/SND_FXSRC.h

Modified: branches/soc-2007-hcube/intern/tinySND/samplerate/SND_FXSRC.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/samplerate/SND_FXSRC.cpp	2007-08-19 10:27:52 UTC (rev 11674)
+++ branches/soc-2007-hcube/intern/tinySND/samplerate/SND_FXSRC.cpp	2007-08-19 10:28:57 UTC (rev 11675)
@@ -5,6 +5,12 @@
 SND_FXSRC::SND_FXSRC(void)
 {
 	int result;
+
+	// clear callback
+	mCallback = 0;
+	mUserData1 = 0;
+	mUserData2 = 0;
+
 	mSRC_State = src_new( SRC_SINC_MEDIUM_QUALITY, 1, &result );
 	mConverterType = SRC_SINC_MEDIUM_QUALITY;
     
@@ -85,6 +91,12 @@
 	assert( mSRC_State != 0 );
 	assert( mInput != 0 );
 
+ 	// call callback
+	if( mCallback != 0 )
+	{
+		(*mCallback)( framesNum, mUserData1, mUserData2 );
+	}
+ 
 	mSRC_Data.src_ratio = mSampleRate / mInput->getSampleRate();
 	
 	if( mSRC_Data.src_ratio == 1.0 )

Modified: branches/soc-2007-hcube/intern/tinySND/samplerate/SND_FXSRC.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/samplerate/SND_FXSRC.h	2007-08-19 10:27:52 UTC (rev 11674)
+++ branches/soc-2007-hcube/intern/tinySND/samplerate/SND_FXSRC.h	2007-08-19 10:28:57 UTC (rev 11675)
@@ -9,17 +9,17 @@
 class SND_FXSRC: public SND_SoundInterface
 {
 public:
-    SND_FXSRC();
-    ~SND_FXSRC();
+			SND_FXSRC();
+			~SND_FXSRC();
 
-    bool isMuted();
-    void setMute( bool isMuted );
+    bool	isMuted();
+    void	setMute( bool isMuted );
 
-    void setInput( SND_SoundInterface *input );
+    void	setInput( SND_SoundInterface *input );
     SND_SoundInterface *getInput();
 
-    void setSampleRate( float sampleRate );
-    float getSampleRate();
+    void	setSampleRate( float sampleRate );
+    float	getSampleRate();
 
     /*
     Converter types (provided by libsamplerate):
@@ -29,11 +29,11 @@
 		SRC_ZERO_ORDER_HOLD	
 		SRC_LINEAR
     */
-    void setConverterType( int converterType );
-    int getConverterType();
+    void	setConverterType( int converterType );
+    int		getConverterType();
 	
-    bool isDataAvailable();
-    float* getPCMDataPtr( int framesNum );
+    bool	isDataAvailable();
+    float*	getPCMDataPtr( int framesNum );
 	
 private:
     float	*mBuffer;





More information about the Bf-blender-cvs mailing list