Async 1.8.0
AsyncAudioProcessor.h
Go to the documentation of this file.
1
28#ifndef ASYNC_AUDIO_PROCESSOR_INCLUDED
29#define ASYNC_AUDIO_PROCESSOR_INCLUDED
30
31
32/****************************************************************************
33 *
34 * System Includes
35 *
36 ****************************************************************************/
37
38#include <sigc++/sigc++.h>
39#include <string>
40
41
42/****************************************************************************
43 *
44 * Project Includes
45 *
46 ****************************************************************************/
47
48
49
50/****************************************************************************
51 *
52 * Local Includes
53 *
54 ****************************************************************************/
55
56#include <AsyncAudioSource.h>
57#include <AsyncAudioSink.h>
58
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
118class AudioProcessor : public AudioSink, public AudioSource, public sigc::trackable
119{
120 public:
125
129 virtual ~AudioProcessor(void);
130
137 int writeSamples(const float *samples, int len);
138
142 void flushSamples(void);
143
147 void resumeOutput(void);
148
153
154
155 protected:
161 void setInputOutputSampleRate(int input_rate, int output_rate);
162
174 virtual void processSamples(float *dest, const float *src, int count) = 0;
175
176
177 private:
178 static const int BUFSIZE = 256;
179
180 float buf[BUFSIZE];
181 int buf_cnt;
182 bool do_flush;
183 bool input_stopped;
184 bool output_stopped;
185 int input_rate;
186 int output_rate;
187 float *input_buf;
188 int input_buf_cnt;
189 int input_buf_size;
190
192 AudioProcessor& operator=(const AudioProcessor&);
193 void writeFromBuf(void);
194
195}; /* class AudioProcessor */
196
197
198} /* namespace */
199
200#endif /* ASYNC_AUDIO_PROCESSOR_INCLUDED */
201
202
203
204/*
205 * This file has not been truncated
206 */
207
This file contains the base class for an audio sink.
This file contains the base class for an audio source.
The base class for an audio processor.
void resumeOutput(void)
Resume output to the sink if previously stopped.
virtual void processSamples(float *dest, const float *src, int count)=0
Process incoming samples and put them into the output buffer.
virtual ~AudioProcessor(void)
Destructor.
void setInputOutputSampleRate(int input_rate, int output_rate)
Set the input and output sample rates.
void allSamplesFlushed(void)
All samples have been flushed by the sink.
int writeSamples(const float *samples, int len)
Write audio to the filter.
void flushSamples(void)
Order a flush of all samples.
AudioProcessor(void)
Default constuctor.
The base class for an audio sink.
The base class for an audio source.
Namespace for the asynchronous programming classes.