AsyncAudioSplitter.h

Go to the documentation of this file.
00001 
00028 #ifndef ASYNC_AUDIO_SPLITTER_INCLUDED
00029 #define ASYNC_AUDIO_SPLITTER_INCLUDED
00030 
00031 
00032 /****************************************************************************
00033  *
00034  * System Includes
00035  *
00036  ****************************************************************************/
00037 
00038 #include <list>
00039 #include <sigc++/sigc++.h>
00040 
00041 
00042 /****************************************************************************
00043  *
00044  * Project Includes
00045  *
00046  ****************************************************************************/
00047 
00048 #include <AsyncTimer.h>
00049 
00050 
00051 /****************************************************************************
00052  *
00053  * Local Includes
00054  *
00055  ****************************************************************************/
00056 
00057 #include <AsyncAudioSink.h>
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 
00118 class AudioSplitter : public Async::AudioSink, public SigC::Object
00119 {
00120   public:
00124     AudioSplitter(void);
00125   
00129     ~AudioSplitter(void);
00130   
00136     void addSink(AudioSink *sink, bool managed=false);
00137     void removeSink(AudioSink *sink);
00138     void removeAllSinks(void);
00139     void enableSink(AudioSink *sink, bool enable);
00140 
00141     int writeSamples(const float *samples, int len);
00142     
00143     void flushSamples(void);
00144     
00145     
00146   protected:
00147     
00148   private:
00149     class Branch;
00150     
00151     std::list<Branch *> branches;
00152     float               *buf;
00153     int                 buf_size;
00154     int                 buf_len;
00155     bool                do_flush;
00156     bool                input_stopped;
00157     int                 flushed_branches;
00158     Async::Timer        *cleanup_branches_timer;
00159     
00160     void writeFromBuffer(void);
00161     void flushAllBranches(void);
00162 
00163     friend class Branch;
00164     void branchResumeOutput(void);
00165     void branchAllSamplesFlushed(void);
00166     void cleanupBranches(Async::Timer *t);
00167 
00168 };  /* class AudioSplitter */
00169 
00170 
00171 } /* namespace */
00172 
00173 #endif /* ASYNC_AUDIO_SPLITTER_INCLUDED */
00174 
00175 
00176 
00177 /*
00178  * This file has not been truncated
00179  */
00180 

Generated on Thu Feb 26 15:20:46 2009 for Async by  doxygen 1.5.8