Async
0.18.0
Main Page
Namespaces
Classes
Files
Examples
File List
File Members
include
AsyncAudioRecorder.h
Go to the documentation of this file.
1
27
#ifndef ASYNC_AUDIO_RECORDER_INCLUDED
28
#define ASYNC_AUDIO_RECORDER_INCLUDED
29
30
31
/****************************************************************************
32
*
33
* System Includes
34
*
35
****************************************************************************/
36
37
#include <stdio.h>
38
#include <stdint.h>
39
#include <sigc++/sigc++.h>
40
41
#include <string>
42
43
#include <
AsyncAudioSink.h
>
44
45
46
/****************************************************************************
47
*
48
* Project Includes
49
*
50
****************************************************************************/
51
52
53
54
/****************************************************************************
55
*
56
* Local Includes
57
*
58
****************************************************************************/
59
60
61
62
/****************************************************************************
63
*
64
* Forward declarations
65
*
66
****************************************************************************/
67
68
69
70
/****************************************************************************
71
*
72
* Namespace
73
*
74
****************************************************************************/
75
76
namespace
Async
77
{
78
79
80
/****************************************************************************
81
*
82
* Forward declarations of classes inside of the declared namespace
83
*
84
****************************************************************************/
85
86
87
88
/****************************************************************************
89
*
90
* Defines & typedefs
91
*
92
****************************************************************************/
93
94
95
96
/****************************************************************************
97
*
98
* Exported Global Variables
99
*
100
****************************************************************************/
101
102
103
104
/****************************************************************************
105
*
106
* Class definitions
107
*
108
****************************************************************************/
109
118
class
AudioRecorder
:
public
Async::AudioSink
119
{
120
public
:
121
typedef
enum
{
FMT_AUTO
,
FMT_RAW
,
FMT_WAV
}
Format
;
122
129
explicit
AudioRecorder
(
const
std::string& filename,
130
AudioRecorder::Format
fmt=
FMT_AUTO
,
131
int
sample_rate=INTERNAL_SAMPLE_RATE);
132
136
~AudioRecorder
(
void
);
137
142
bool
initialize
(
void
);
143
153
void
setMaxRecordingTime
(
unsigned
time_ms);
154
166
virtual
int
writeSamples
(
const
float
*samples,
int
count);
167
176
virtual
void
flushSamples
(
void
);
177
178
179
private
:
180
std::string filename;
181
FILE *file;
182
unsigned
samples_written;
183
Format
format;
184
int
sample_rate;
185
unsigned
max_samples;
186
187
AudioRecorder
(
const
AudioRecorder
&);
188
AudioRecorder
& operator=(
const
AudioRecorder
&);
189
void
writeWaveHeader(
void
);
190
int
store32bitValue(
char
*ptr, uint32_t val);
191
int
store16bitValue(
char
*ptr, uint16_t val);
192
193
};
/* class AudioRecorder */
194
195
196
}
/* namespace */
197
198
#endif
/* ASYNC_AUDIO_RECORDER_INCLUDED */
199
200
201
202
/*
203
* This file has not been truncated
204
*/
205
Generated by
1.8.3