Async 1.8.0
AsyncAudioPacer.h
Go to the documentation of this file.
1
28#ifndef AUDIO_PACER_INCLUDED
29#define AUDIO_PACER_INCLUDED
30
31
32/****************************************************************************
33 *
34 * System Includes
35 *
36 ****************************************************************************/
37
38#include <sigc++/sigc++.h>
39
40
41/****************************************************************************
42 *
43 * Project Includes
44 *
45 ****************************************************************************/
46
47#include <AsyncAudioSink.h>
48#include <AsyncAudioSource.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
83class Timer;
84
85
86/****************************************************************************
87 *
88 * Defines & typedefs
89 *
90 ****************************************************************************/
91
92
93
94/****************************************************************************
95 *
96 * Exported Global Variables
97 *
98 ****************************************************************************/
99
100
101
102/****************************************************************************
103 *
104 * Class definitions
105 *
106 ****************************************************************************/
107
115class AudioPacer : public AudioSink, public AudioSource, public sigc::trackable
116{
117 public:
124 AudioPacer(int sample_rate, int block_size, int prebuf_time);
125
130
142 virtual int writeSamples(const float *samples, int count);
143
152 virtual void flushSamples(void);
153
161 virtual void resumeOutput(void);
162
163
164 protected:
173 virtual void allSamplesFlushed(void);
174
175
176 private:
177 int sample_rate;
178 int buf_size;
179 int prebuf_time;
180 float *buf;
181 int buf_pos;
182 int prebuf_samples;
183 Async::Timer *pace_timer;
184 bool do_flush;
185 bool input_stopped;
186
187 void outputNextBlock(Async::Timer *t=0);
188
189}; /* class AudioPacer */
190
191
192} /* namespace */
193
194#endif /* AUDIO_PACER_INCLUDED */
195
196
197
198/*
199 * This file has not been truncated
200 */
201
This file contains the base class for an audio sink.
This file contains the base class for an audio source.
An audio pipe class that pace audio output.
AudioPacer(int sample_rate, int block_size, int prebuf_time)
Constuctor.
virtual void resumeOutput(void)
Resume audio output to the sink.
virtual void flushSamples(void)
Tell the sink to flush the previously written samples.
virtual void allSamplesFlushed(void)
The registered sink has flushed all samples.
virtual int writeSamples(const float *samples, int count)
Write samples into this audio sink.
~AudioPacer(void)
Destructor.
The base class for an audio sink.
The base class for an audio source.
A class that produces timer events.
Definition AsyncTimer.h:117
Namespace for the asynchronous programming classes.