Async
0.18.0
Main Page
Namespaces
Classes
Files
Examples
File List
File Members
include
AsyncAudioFifo.h
Go to the documentation of this file.
1
30
#ifndef ASYNC_AUDIO_FIFO_INCLUDED
31
#define ASYNC_AUDIO_FIFO_INCLUDED
32
33
34
/****************************************************************************
35
*
36
* System Includes
37
*
38
****************************************************************************/
39
40
41
42
/****************************************************************************
43
*
44
* Project Includes
45
*
46
****************************************************************************/
47
48
#include <
AsyncAudioSink.h
>
49
#include <
AsyncAudioSource.h
>
50
51
52
/****************************************************************************
53
*
54
* Local Includes
55
*
56
****************************************************************************/
57
58
59
60
/****************************************************************************
61
*
62
* Forward declarations
63
*
64
****************************************************************************/
65
66
67
68
/****************************************************************************
69
*
70
* Namespace
71
*
72
****************************************************************************/
73
74
namespace
Async
75
{
76
77
78
/****************************************************************************
79
*
80
* Forward declarations of classes inside of the declared namespace
81
*
82
****************************************************************************/
83
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
119
class
AudioFifo
:
public
AudioSink
,
public
AudioSource
120
{
121
public
:
127
explicit
AudioFifo
(
unsigned
fifo_size);
128
132
virtual
~AudioFifo
(
void
);
133
142
void
setSize
(
unsigned
new_size);
143
148
bool
empty
(
void
)
const
{
return
!is_full && (tail == head); }
149
158
bool
full
(
void
)
const
{
return
is_full; }
159
166
unsigned
samplesInFifo
(
bool
ignore_prebuf=
false
)
const
;
167
179
void
setOverwrite
(
bool
overwrite
) { do_overwrite =
overwrite
; }
180
193
bool
overwrite
(
void
)
const
{
return
do_overwrite; }
194
201
void
clear
(
void
);
202
208
void
setPrebufSamples
(
unsigned
prebuf_samples);
209
221
void
enableBuffering
(
bool
enable);
222
227
bool
bufferingEnabled
(
void
)
const
{
return
buffering_enabled; }
228
240
virtual
int
writeSamples
(
const
float
*samples,
int
count);
241
249
virtual
void
flushSamples
(
void
);
250
258
virtual
void
resumeOutput
(
void
);
259
260
261
protected
:
269
virtual
void
allSamplesFlushed
(
void
);
270
271
272
private
:
273
float
*fifo;
274
unsigned
fifo_size;
275
unsigned
head, tail;
276
bool
do_overwrite;
277
bool
output_stopped;
278
unsigned
prebuf_samples;
279
bool
prebuf;
280
bool
is_flushing;
281
bool
is_full;
282
bool
buffering_enabled;
283
bool
disable_buffering_when_flushed;
284
bool
is_idle;
285
bool
input_stopped;
286
287
void
writeSamplesFromFifo(
void
);
288
289
};
/* class AudioFifo */
290
291
292
}
/* namespace */
293
294
#endif
/* ASYNC_AUDIO_FIFO_INCLUDED */
295
296
297
/*
298
* This file has not been truncated
299
*/
300
Generated by
1.8.3.1