27 #ifndef ASYNC_AUDIO_RECORDER_INCLUDED
28 #define ASYNC_AUDIO_RECORDER_INCLUDED
39 #include <sigc++/sigc++.h>
132 int sample_rate=INTERNAL_SAMPLE_RATE);
188 const struct timeval &
endTimestamp(
void)
const {
return end_timestamp; }
201 virtual int writeSamples(
const float *samples,
int count);
224 std::string filename;
226 unsigned samples_written;
229 unsigned max_samples;
230 unsigned high_water_mark;
231 bool high_water_mark_reached;
232 struct timeval begin_timestamp;
233 struct timeval end_timestamp;
237 void writeWaveHeader(
void);
238 int store32bitValue(
char *ptr, uint32_t val);
239 int store16bitValue(
char *ptr, uint16_t val);
AudioRecorder(const std::string &filename, AudioRecorder::Format fmt=FMT_AUTO, int sample_rate=INTERNAL_SAMPLE_RATE)
Default constuctor.
~AudioRecorder(void)
Destructor.
const struct timeval & endTimestamp(void) const
The timestamp of the last stored sample.
const struct timeval & beginTimestamp(void) const
The timestamp of the first stored sample.
bool initialize(void)
Initialize the recorder.
unsigned samplesWritten(void) const
Find out how many samples that have been written so far.
virtual void flushSamples(void)
Tell the sink to flush the previously written samples.
void closeFile(void)
Close the file.
This file contains the base class for an audio sink.
virtual int writeSamples(const float *samples, int count)
Write samples into this audio sink.
The base class for an audio sink.
Namespace for the asynchronous programming classes.
A class for recording raw audio to a file.
void setMaxRecordingTime(unsigned time_ms, unsigned hw_time_ms=0)
Set the maximum length of this recording.
sigc::signal< void > maxRecordingTimeReached
A signal that's emitted when the max recording time is reached.