AsyncAudioMixer.h

Go to the documentation of this file.
00001 
00028 #ifndef ASYNC_AUDIO_MIXER_INCLUDED
00029 #define ASYNC_AUDIO_MIXER_INCLUDED
00030 
00031 
00032 /****************************************************************************
00033  *
00034  * System Includes
00035  *
00036  ****************************************************************************/
00037 
00038 #include <list>
00039 
00040 
00041 /****************************************************************************
00042  *
00043  * Project Includes
00044  *
00045  ****************************************************************************/
00046 
00047 #include <AsyncAudioSource.h>
00048 
00049 
00050 /****************************************************************************
00051  *
00052  * Local Includes
00053  *
00054  ****************************************************************************/
00055 
00056 
00057 
00058 /****************************************************************************
00059  *
00060  * Forward declarations
00061  *
00062  ****************************************************************************/
00063 
00064 
00065 
00066 /****************************************************************************
00067  *
00068  * Namespace
00069  *
00070  ****************************************************************************/
00071 
00072 namespace Async
00073 {
00074 
00075 
00076 /****************************************************************************
00077  *
00078  * Forward declarations of classes inside of the declared namespace
00079  *
00080  ****************************************************************************/
00081 
00082 class Timer;
00083   
00084 
00085 /****************************************************************************
00086  *
00087  * Defines & typedefs
00088  *
00089  ****************************************************************************/
00090 
00091 
00092 
00093 /****************************************************************************
00094  *
00095  * Exported Global Variables
00096  *
00097  ****************************************************************************/
00098 
00099 
00100 
00101 /****************************************************************************
00102  *
00103  * Class definitions
00104  *
00105  ****************************************************************************/
00106 
00114 class AudioMixer : public SigC::Object, public Async::AudioSource
00115 {
00116   public:
00120     AudioMixer(void);
00121   
00125     ~AudioMixer(void);
00126   
00131     void addSource(AudioSource *source);
00132 
00140     void resumeOutput(void);
00141     
00142     
00143   protected:
00151     void allSamplesFlushed(void);
00152     
00153     
00154   private:
00155     class MixerSrc;
00156     
00157     static const int OUTBUF_SIZE = 256;
00158     
00159     std::list<MixerSrc *> sources;
00160     Timer                 *delayed_exec_timer;
00161     float                 outbuf[OUTBUF_SIZE];
00162     unsigned              outbuf_pos;
00163     unsigned              outbuf_cnt;
00164     bool                  is_flushed;
00165     bool                  output_stopped;
00166     
00167     AudioMixer(const AudioMixer&);
00168     AudioMixer& operator=(const AudioMixer&);
00169     
00170     void setAudioAvailable(void);
00171     void flushSamples(void);
00172     void outputHandler(Timer *t);
00173     void checkFlush(void);
00174 
00175     friend class MixerSrc;
00176     
00177 };  /* class AudioMixer */
00178 
00179 
00180 } /* namespace */
00181 
00182 #endif /* ASYNC_AUDIO_MIXER_INCLUDED */
00183 
00184 
00185 
00186 /*
00187  * This file has not been truncated
00188  */
00189 
Generated by  doxygen 1.6.2-20100208