Async 1.5.0
AsyncAudioSplitter.h
Go to the documentation of this file.
1
28#ifndef ASYNC_AUDIO_SPLITTER_INCLUDED
29#define ASYNC_AUDIO_SPLITTER_INCLUDED
30
31
32/****************************************************************************
33 *
34 * System Includes
35 *
36 ****************************************************************************/
37
38#include <list>
39#include <sigc++/sigc++.h>
40
41
42/****************************************************************************
43 *
44 * Project Includes
45 *
46 ****************************************************************************/
47
48#include <AsyncTimer.h>
49
50
51/****************************************************************************
52 *
53 * Local Includes
54 *
55 ****************************************************************************/
56
57#include <AsyncAudioSink.h>
58#include <AsyncAudioSource.h>
59
60
61/****************************************************************************
62 *
63 * Forward declarations
64 *
65 ****************************************************************************/
66
67
68
69/****************************************************************************
70 *
71 * Namespace
72 *
73 ****************************************************************************/
74
75namespace Async
76{
77
78
79/****************************************************************************
80 *
81 * Forward declarations of classes inside of the declared namespace
82 *
83 ****************************************************************************/
84
85
86
87/****************************************************************************
88 *
89 * Defines & typedefs
90 *
91 ****************************************************************************/
92
93
94
95/****************************************************************************
96 *
97 * Exported Global Variables
98 *
99 ****************************************************************************/
100
101
102
103/****************************************************************************
104 *
105 * Class definitions
106 *
107 ****************************************************************************/
108
118 public sigc::trackable
119{
120 public:
125
130
137 void addSink(AudioSink *sink, bool managed=false);
138
144
148 void removeAllSinks(void);
149
156 void enableSink(AudioSink *sink, bool enable);
157
169 int writeSamples(const float *samples, int len);
170
179 void flushSamples(void);
180
181
182 protected:
183
184 private:
185 class Branch;
186
187 std::list<Branch *> branches;
188 float *buf;
189 int buf_size;
190 int buf_len;
191 bool do_flush;
192 bool input_stopped;
193 int flushed_branches;
194 Branch *main_branch;
195
196 void writeFromBuffer(void);
197 void flushAllBranches(void);
198
199 friend class Branch;
200 void branchResumeOutput(void);
201 void branchAllSamplesFlushed(void);
202 void cleanupBranches(void);
203
204}; /* class AudioSplitter */
205
206
207} /* namespace */
208
209#endif /* ASYNC_AUDIO_SPLITTER_INCLUDED */
210
211
212
213/*
214 * This file has not been truncated
215 */
This file contains the base class for an audio sink.
This file contains the base class for an audio source.
Contains a single shot or periodic timer that emits a signal on timeout.
The base class for an audio sink.
The base class for an audio source.
AudioSink * sink(void) const
Get the registered audio sink.
A class that splits an audio stream into multiple streams.
int writeSamples(const float *samples, int len)
Write samples into this audio sink.
~AudioSplitter(void)
Destructor.
void removeSink(AudioSink *sink)
Remove an audio sink from the splitter.
void flushSamples(void)
Tell the sink to flush the previously written samples.
void removeAllSinks(void)
Remove all audio sinks from this splitter.
void enableSink(AudioSink *sink, bool enable)
Enable or disable audio output to the given audio sink.
AudioSplitter(void)
Default constuctor.
void addSink(AudioSink *sink, bool managed=false)
Add an audio sink to the splitter.
Namespace for the asynchronous programming classes.