AsyncAudioProcessor.h

Go to the documentation of this file.
00001 
00028 #ifndef ASYNC_AUDIO_PROCESSOR_INCLUDED
00029 #define ASYNC_AUDIO_PROCESSOR_INCLUDED
00030 
00031 
00032 /****************************************************************************
00033  *
00034  * System Includes
00035  *
00036  ****************************************************************************/
00037 
00038 #include <string>
00039 
00040 
00041 /****************************************************************************
00042  *
00043  * Project Includes
00044  *
00045  ****************************************************************************/
00046 
00047 
00048 
00049 /****************************************************************************
00050  *
00051  * Local Includes
00052  *
00053  ****************************************************************************/
00054 
00055 #include <AsyncAudioSource.h>
00056 #include <AsyncAudioSink.h>
00057 
00058 
00059 
00060 /****************************************************************************
00061  *
00062  * Forward declarations
00063  *
00064  ****************************************************************************/
00065 
00066 
00067 
00068 /****************************************************************************
00069  *
00070  * Namespace
00071  *
00072  ****************************************************************************/
00073 
00074 namespace Async
00075 {
00076 
00077 
00078 /****************************************************************************
00079  *
00080  * Forward declarations of classes inside of the declared namespace
00081  *
00082  ****************************************************************************/
00083 
00084   
00085 
00086 /****************************************************************************
00087  *
00088  * Defines & typedefs
00089  *
00090  ****************************************************************************/
00091 
00092 
00093 
00094 /****************************************************************************
00095  *
00096  * Exported Global Variables
00097  *
00098  ****************************************************************************/
00099 
00100 
00101 
00102 /****************************************************************************
00103  *
00104  * Class definitions
00105  *
00106  ****************************************************************************/
00107 
00117 class AudioProcessor : public AudioSink, public AudioSource
00118 {
00119   public:
00123     AudioProcessor(void);
00124   
00128     virtual ~AudioProcessor(void);
00129   
00136     int writeSamples(const float *samples, int len);
00137     
00141     void flushSamples(void);
00142 
00146     void resumeOutput(void);
00147     
00151     void allSamplesFlushed(void);
00152     
00153 
00154   protected:
00160     void setInputOutputSampleRate(int input_rate, int output_rate);
00161     
00173     virtual void processSamples(float *dest, const float *src, int count) = 0;
00174     
00175     
00176   private:
00177     static const int BUFSIZE = 256;
00178     
00179     float       buf[BUFSIZE];
00180     int         buf_cnt;
00181     bool        do_flush;
00182     bool        input_stopped;
00183     bool        output_stopped;
00184     int         input_rate;
00185     int         output_rate;
00186     float       *input_buf;
00187     int         input_buf_cnt;
00188     int         input_buf_size;
00189     
00190     AudioProcessor(const AudioProcessor&);
00191     AudioProcessor& operator=(const AudioProcessor&);
00192     void writeFromBuf(void);
00193 
00194 };  /* class AudioProcessor */
00195 
00196 
00197 } /* namespace */
00198 
00199 #endif /* ASYNC_AUDIO_PROCESSOR_INCLUDED */
00200 
00201 
00202 
00203 /*
00204  * This file has not been truncated
00205  */
00206 
Generated by  doxygen 1.6.2-20100208