[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10999] branches/soc-2007-hcube/intern/ tinySND: Added new features.

Csaba Hruska csaba.hruska at gmail.com
Thu Jun 21 14:16:04 CEST 2007


Revision: 10999
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10999
Author:   hcube
Date:     2007-06-21 14:16:04 +0200 (Thu, 21 Jun 2007)

Log Message:
-----------
Added new features.

Modified Paths:
--------------
    branches/soc-2007-hcube/intern/tinySND/SND_Device.h
    branches/soc-2007-hcube/intern/tinySND/SND_FXSample.h
    branches/soc-2007-hcube/intern/tinySND/SND_SoundInterface.h
    branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.cpp
    branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.h

Modified: branches/soc-2007-hcube/intern/tinySND/SND_Device.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_Device.h	2007-06-21 12:15:40 UTC (rev 10998)
+++ branches/soc-2007-hcube/intern/tinySND/SND_Device.h	2007-06-21 12:16:04 UTC (rev 10999)
@@ -22,6 +22,8 @@
     // only same sample rate is acceptable that device has
     virtual void assignSoundToChannel( int hwChannelIdx, SND_SoundInterface *sound ) = 0;
 
+    virtual float getSampleRate() = 0;
+    virtual int getBitRate() = 0;
 };
 
 #endif //__SND_DEVICE_H__

Modified: branches/soc-2007-hcube/intern/tinySND/SND_FXSample.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_FXSample.h	2007-06-21 12:15:40 UTC (rev 10998)
+++ branches/soc-2007-hcube/intern/tinySND/SND_FXSample.h	2007-06-21 12:16:04 UTC (rev 10999)
@@ -9,7 +9,6 @@
     dont do any format conversion
     provides pcm data at same format that it comes from dataProvider
 	
-	todo: Add Play Direction
 */
 class SND_FXSample: public SND_SoundInterface
 {
@@ -21,12 +20,21 @@
 		STOPPED  = 2
     };
     
+    enum PlayDirection
+    {
+		FORWARD		= 0,
+		BACKWARD	= 1
+    };
+    
     SND_FXSample( SND_DataProvider *dataProvider, int channelIdx );
 
     PlayState getPlayState();
     void play();
     void stop();
     void pause();
+	
+	PlayDirection getPlayDirection();
+	void setPlayDirection( PlayDirection playDirection );
     
     void setLoopMode( int loopMode );
     void setLoopStart( int frameNum );
@@ -67,6 +75,7 @@
     PlayState           mPlayState;
     float               mGain;
     int                 mChannelNum;
+	PlayDirection		mPlayDirection;
     
 };
 

Modified: branches/soc-2007-hcube/intern/tinySND/SND_SoundInterface.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/SND_SoundInterface.h	2007-06-21 12:15:40 UTC (rev 10998)
+++ branches/soc-2007-hcube/intern/tinySND/SND_SoundInterface.h	2007-06-21 12:16:04 UTC (rev 10999)
@@ -14,8 +14,14 @@
     // we can request sound data. do not request big part, only few kilobytes are recommended
     virtual float* getPCMDataPtr( int framesNum ) = 0; // incremets frame counter according play state
 	
-	// add callback feature
-
+	// callback is called before real work/mixing is done in getPCMDataPtr
+	void setCallback(); //todo: finish this feature, required for actuating sound ipos
+	
+	void setUserData( void *userData );
+	void *getUserData();
+	
+private:
+	void	*mUserData;
 };
 
 #endif //__SND_SOUNDINTERFACE_H__

Modified: branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.cpp
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.cpp	2007-06-21 12:15:40 UTC (rev 10998)
+++ branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.cpp	2007-06-21 12:16:04 UTC (rev 10999)
@@ -177,3 +177,13 @@
 {
 }
 
+float portaudioDevice::getSampleRate(void)
+{
+	return (float)SAMPLE_RATE;
+}
+
+int portaudioDevice::getBitRate(void)
+{
+	return 16;
+}
+

Modified: branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.h
===================================================================
--- branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.h	2007-06-21 12:15:40 UTC (rev 10998)
+++ branches/soc-2007-hcube/intern/tinySND/portaudio/portaudioDevice.h	2007-06-21 12:16:04 UTC (rev 10999)
@@ -17,6 +17,9 @@
     int     getNumChannels();
     char*   getChannelName( int hwChannelIdx );
     void    assignSoundToChannel( int hwChannelIdx, SND_SoundInterface *sound );
+
+    float	getSampleRate();
+    int		getBitRate();
     
     int generate(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, 
 	const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags);





More information about the Bf-blender-cvs mailing list