Async 1.8.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) override;
170
179 void flushSamples(void) override;
180
181 protected:
182
183 private:
184 class Branch;
185
186 std::list<Branch *> branches;
187 float *buf;
188 int buf_size;
189 int buf_len;
190 bool do_flush;
191 bool input_stopped;
192 int flushed_branches;
193 Branch *main_branch;
194
195 void writeFromBuffer(void);
196 void flushAllBranches(void);
197
198 friend class Branch;
199 void branchResumeOutput(void);
200 void branchAllSamplesFlushed(void);
201 void cleanupBranches(void);
202
203}; /* class AudioSplitter */
204
205
206} /* namespace */
207
208#endif /* ASYNC_AUDIO_SPLITTER_INCLUDED */
209
210
211
212/*
213 * This file has not been truncated
214 */
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.
void flushSamples(void) override
Tell the sink to flush the previously written samples.
~AudioSplitter(void)
Destructor.
void removeSink(AudioSink *sink)
Remove an audio sink from the splitter.
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.
int writeSamples(const float *samples, int len) override
Write samples into this 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.