AsyncAudioPacer.h

Go to the documentation of this file.
00001 
00028 #ifndef AUDIO_PACER_INCLUDED
00029 #define AUDIO_PACER_INCLUDED
00030 
00031 
00032 /****************************************************************************
00033  *
00034  * System Includes
00035  *
00036  ****************************************************************************/
00037 
00038 #include <sigc++/sigc++.h>
00039 
00040 
00041 /****************************************************************************
00042  *
00043  * Project Includes
00044  *
00045  ****************************************************************************/
00046 
00047 #include <AsyncAudioSink.h>
00048 #include <AsyncAudioSource.h>
00049 
00050 
00051 /****************************************************************************
00052  *
00053  * Local Includes
00054  *
00055  ****************************************************************************/
00056 
00057 
00058 
00059 /****************************************************************************
00060  *
00061  * Forward declarations
00062  *
00063  ****************************************************************************/
00064 
00065 
00066 
00067 /****************************************************************************
00068  *
00069  * Namespace
00070  *
00071  ****************************************************************************/
00072 
00073 namespace Async
00074 {
00075 
00076 
00077 /****************************************************************************
00078  *
00079  * Forward declarations of classes inside of the declared namespace
00080  *
00081  ****************************************************************************/
00082 
00083 class Timer;
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 
00115 class AudioPacer : public AudioSink, public AudioSource, public SigC::Object
00116 {
00117   public:
00124     AudioPacer(int sample_rate, int block_size, int prebuf_time);
00125   
00129     ~AudioPacer(void);
00130   
00142     virtual int writeSamples(const float *samples, int count);
00143     
00152     virtual void flushSamples(void);    
00153     
00161     virtual void resumeOutput(void);
00162     
00163 
00164   protected:
00173     virtual void allSamplesFlushed(void);
00174     
00175     
00176   private:
00177     int           sample_rate;
00178     int           buf_size;
00179     int           prebuf_time;
00180     float         *buf;
00181     int           buf_pos;
00182     int           prebuf_samples;
00183     Async::Timer  *pace_timer;
00184     bool          do_flush;
00185     bool          input_stopped;
00186     
00187     void outputNextBlock(Async::Timer *t=0);
00188 
00189 };  /* class AudioPacer */
00190 
00191 
00192 } /* namespace */
00193 
00194 #endif /* AUDIO_PACER_INCLUDED */
00195 
00196 
00197 
00198 /*
00199  * This file has not been truncated
00200  */
00201 
Generated by  doxygen 1.6.2-20100208