27 #ifndef ASYNC_AUDIO_RECORDER_INCLUDED 28 #define ASYNC_AUDIO_RECORDER_INCLUDED 39 #include <sigc++/sigc++.h> 132 int sample_rate=INTERNAL_SAMPLE_RATE);
193 const struct timeval &
endTimestamp(
void)
const {
return end_timestamp; }
206 virtual int writeSamples(
const float *samples,
int count);
226 std::string
errorMsg(
void)
const {
return errmsg; }
249 std::string filename;
251 unsigned samples_written;
254 unsigned max_samples;
255 unsigned high_water_mark;
256 bool high_water_mark_reached;
257 struct timeval begin_timestamp;
258 struct timeval end_timestamp;
263 bool writeWaveHeader(
void);
264 int store32bitValue(
char *ptr, uint32_t val);
265 int store16bitValue(
char *ptr, uint16_t val);
266 void setErrMsgFromErrno(
const std::string &fname);
AudioRecorder(const std::string &filename, AudioRecorder::Format fmt=FMT_AUTO, int sample_rate=INTERNAL_SAMPLE_RATE)
Default constuctor.
~AudioRecorder(void)
Destructor.
bool initialize(void)
Initialize the recorder.
virtual void flushSamples(void)
Tell the sink to flush the previously written samples.
std::string errorMsg(void) const
Return the current error message.
const struct timeval & beginTimestamp(void) const
The timestamp of the first stored sample.
unsigned samplesWritten(void) const
Find out how many samples that have been written so far.
This file contains the base class for an audio sink.
virtual int writeSamples(const float *samples, int count)
Write samples into this audio sink.
sigc::signal< void > errorOccurred
This signal is emitted when an error occurrs in the recorder.
The base class for an audio sink.
Namespace for the asynchronous programming classes.
const struct timeval & endTimestamp(void) const
The timestamp of the last stored sample.
A class for recording raw audio to a file.
bool closeFile(void)
Close the 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.