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
00116 class AudioSplitter : public Async::AudioSink, public SigC::Object
00117 {
00118 public:
00122 AudioSplitter(void);
00123
00127 ~AudioSplitter(void);
00128
00135 void addSink(AudioSink *sink, bool managed=false);
00136
00141 void removeSink(AudioSink *sink);
00142
00146 void removeAllSinks(void);
00147
00154 void enableSink(AudioSink *sink, bool enable);
00155
00167 int writeSamples(const float *samples, int len);
00168
00177 void flushSamples(void);
00178
00179
00180 protected:
00181
00182 private:
00183 class Branch;
00184
00185 std::list<Branch *> branches;
00186 float *buf;
00187 int buf_size;
00188 int buf_len;
00189 bool do_flush;
00190 bool input_stopped;
00191 int flushed_branches;
00192 Async::Timer *cleanup_branches_timer;
00193
00194 void writeFromBuffer(void);
00195 void flushAllBranches(void);
00196
00197 friend class Branch;
00198 void branchResumeOutput(void);
00199 void branchAllSamplesFlushed(void);
00200 void cleanupBranches(Async::Timer *t);
00201
00202 };
00203
00204
00205 }
00206
00207 #endif
00208
00209
00210
00211
00212
00213
00214