Async 1.8.0
AsyncAudioMixer.h
Go to the documentation of this file.
1
28#ifndef ASYNC_AUDIO_MIXER_INCLUDED
29#define ASYNC_AUDIO_MIXER_INCLUDED
30
31
32/****************************************************************************
33 *
34 * System Includes
35 *
36 ****************************************************************************/
37
38#include <list>
39
40
41/****************************************************************************
42 *
43 * Project Includes
44 *
45 ****************************************************************************/
46
47#include <AsyncAudioSource.h>
48#include <AsyncTimer.h>
49
50
51/****************************************************************************
52 *
53 * Local Includes
54 *
55 ****************************************************************************/
56
57
58
59/****************************************************************************
60 *
61 * Forward declarations
62 *
63 ****************************************************************************/
64
65
66
67/****************************************************************************
68 *
69 * Namespace
70 *
71 ****************************************************************************/
72
73namespace Async
74{
75
76
77/****************************************************************************
78 *
79 * Forward declarations of classes inside of the declared namespace
80 *
81 ****************************************************************************/
82
83
84
85/****************************************************************************
86 *
87 * Defines & typedefs
88 *
89 ****************************************************************************/
90
91
92
93/****************************************************************************
94 *
95 * Exported Global Variables
96 *
97 ****************************************************************************/
98
99
100
101/****************************************************************************
102 *
103 * Class definitions
104 *
105 ****************************************************************************/
106
114class AudioMixer : public sigc::trackable, public Async::AudioSource
115{
116 public:
121
126
131 void addSource(AudioSource *source);
132
140 void resumeOutput(void);
141
142
143 protected:
152
153
154 private:
155 class MixerSrc;
156
157 static const int OUTBUF_SIZE = 256;
158
159 std::list<MixerSrc *> sources;
160 Timer output_timer;
161 float outbuf[OUTBUF_SIZE];
162 unsigned outbuf_pos;
163 unsigned outbuf_cnt;
164 bool is_flushed;
165 bool output_stopped;
166
167 AudioMixer(const AudioMixer&);
168 AudioMixer& operator=(const AudioMixer&);
169
170 void setAudioAvailable(void);
171 void flushSamples(void);
172 void outputHandler(Timer *t);
173 void checkFlush(void);
174
175 friend class MixerSrc;
176
177}; /* class AudioMixer */
178
179
180} /* namespace */
181
182#endif /* ASYNC_AUDIO_MIXER_INCLUDED */
183
184
185
186/*
187 * This file has not been truncated
188 */
189
This file contains the base class for an audio source.
Contains a single shot or periodic timer that emits a signal on timeout.
A class for mixing audio streams.
void resumeOutput(void)
Resume audio output to the sink.
void allSamplesFlushed(void)
The registered sink has flushed all samples.
~AudioMixer(void)
Destructor.
void addSource(AudioSource *source)
Add an audio source to the mixer.
friend class MixerSrc
AudioMixer(void)
Default constuctor.
The base class for an audio source.
A class that produces timer events.
Definition AsyncTimer.h:117
Namespace for the asynchronous programming classes.