Async
0.18.0
Main Page
Namespaces
Classes
Files
Examples
File List
File Members
include
AsyncAudioSink.h
Go to the documentation of this file.
1
28
#ifndef ASYNC_AUDIO_SINK_INCLUDED
29
#define ASYNC_AUDIO_SINK_INCLUDED
30
31
32
/****************************************************************************
33
*
34
* System Includes
35
*
36
****************************************************************************/
37
38
39
#include <cassert>
40
41
42
/****************************************************************************
43
*
44
* Project Includes
45
*
46
****************************************************************************/
47
48
49
50
/****************************************************************************
51
*
52
* Local Includes
53
*
54
****************************************************************************/
55
56
57
58
/****************************************************************************
59
*
60
* Forward declarations
61
*
62
****************************************************************************/
63
64
65
66
/****************************************************************************
67
*
68
* Namespace
69
*
70
****************************************************************************/
71
72
namespace
Async
73
{
74
75
76
/****************************************************************************
77
*
78
* Forward declarations of classes inside of the declared namespace
79
*
80
****************************************************************************/
81
82
class
AudioSource;
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
115
class
AudioSink
116
{
117
public
:
121
AudioSink
(
void
) : m_source(0), m_handler(0) {}
122
126
virtual
~AudioSink
(
void
);
127
133
bool
registerSource
(
AudioSource
*
source
);
134
138
void
unregisterSource
(
void
);
139
144
bool
isRegistered
(
void
)
const
{
return
m_source != 0; }
145
151
AudioSource
*
source
(
void
)
const
{
return
m_source; }
152
164
virtual
int
writeSamples
(
const
float
*samples,
int
count)
165
{
166
assert(m_handler != 0);
167
return
m_handler->
writeSamples
(samples, count);
168
}
169
178
virtual
void
flushSamples
(
void
)
179
{
180
assert(m_handler != 0);
181
m_handler->
flushSamples
();
182
}
183
184
185
protected
:
189
void
sourceResumeOutput
(
void
);
190
199
void
sourceAllSamplesFlushed
(
void
);
200
210
bool
setHandler
(
AudioSink
*
handler
);
211
215
void
clearHandler
(
void
);
216
217
/*
218
* @brief Return the handler
219
* @return Returns the handler previously set with setHandler or 0
220
* if none have been set
221
*/
222
AudioSink
*
handler
(
void
)
const
{
return
m_handler; }
223
224
225
private
:
226
AudioSource
*m_source;
227
AudioSink
*m_handler;
228
bool
m_auto_unreg_sink;
229
230
bool
registerSourceInternal(
AudioSource
*
source
,
bool
reg_sink);
231
232
};
/* class AudioSink */
233
234
235
}
/* namespace */
236
237
#endif
/* ASYNC_AUDIO_SINK_INCLUDED */
238
239
240
241
/*
242
* This file has not been truncated
243
*/
244
Generated by
1.8.3