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
00035
00036
00037
00038 #include <list>
00039 #include <sigc++/sigc++.h>
00040
00041
00042
00043
00044
00045
00046
00047
00048 #include <AsyncTimer.h>
00049
00050
00051
00052
00053
00054
00055
00056
00057 #include <AsyncAudioSink.h>
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 namespace Async
00075 {
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
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 };
00169
00170
00171 }
00172
00173 #endif
00174
00175
00176
00177
00178
00179
00180