[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11562] branches/soc-2007-hcube/intern/ tinySND/sndfile: Now provides the bitrate info too.

Csaba Hruska csaba.hruska at gmail.com
Sun Aug 12 16:22:59 CEST 2007


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

Log Message:
-----------
Now provides the bitrate info too.

Modified Paths:
--------------
    branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileProvider.cpp
    branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileProvider.h

Modified: branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileProvider.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileProvider.cpp	2007-08-12 14:21:42 UTC (rev 11561)
+++ branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileProvider.cpp	2007-08-12 14:22:59 UTC (rev 11562)
@@ -8,7 +8,27 @@
     mNumFrames = mSF_Info.frames;
     mSampleRate = mSF_Info.samplerate;
     
-    mBitRate = 16;// FIX IT, FILL DATA
+	switch( mSF_Info.format & 0x0000ffff )
+	{
+	case SF_FORMAT_PCM_U8:
+	case SF_FORMAT_PCM_S8:
+	    mBitRate = 8;
+		break;
+	case SF_FORMAT_PCM_16:
+	case SF_FORMAT_FLOAT:
+	    mBitRate = 16;
+		break;
+	case SF_FORMAT_PCM_24:
+	    mBitRate = 24;
+		break;
+	case SF_FORMAT_PCM_32:
+	case SF_FORMAT_DOUBLE:
+	    mBitRate = 32;
+		break;
+	default:
+	    mBitRate = 8;
+		break;
+	}
     
     mNumChannels = mSF_Info.channels;
     mIsSeekable = mSF_Info.seekable;
@@ -38,13 +58,12 @@
     }
 }
 
-int sndfileProvider::fillBuffer( float *buffer, int channelIndex, int framesNum )   
+int sndfileProvider::fillBuffer( float *buffer, int framesNum )   
 {
     assert( mSndFile != 0 );
     assert( buffer != 0 );
 
-    // WARNING NO CHANNEL HANDLING YET !!!!!
-    return sf_read_float( mSndFile, buffer, framesNum/mNumChannels );
+    return sf_read_float( mSndFile, buffer, framesNum );
 }
 
     

Modified: branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileProvider.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileProvider.h	2007-08-12 14:21:42 UTC (rev 11561)
+++ branches/soc-2007-hcube/intern/tinySND/sndfile/sndfileProvider.h	2007-08-12 14:22:59 UTC (rev 11562)
@@ -13,7 +13,7 @@
     bool isFormatSupported();
     
     void seek( int frameNum );
-    int fillBuffer( float *buffer, int channelIndex, int framesNum );    
+    int fillBuffer( float *buffer, int framesNum );    
     
 private:
     SNDFILE	*mSndFile;





More information about the Bf-blender-cvs mailing list