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; }
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);
This file contains the base class for an audio sink.
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.
std::string errorMsg(void) const
Return the current error message.
bool initialize(void)
Initialize the recorder.
~AudioRecorder(void)
Destructor.
sigc::signal< void > maxRecordingTimeReached
A signal that's emitted when the max recording time is reached.
sigc::signal< void > errorOccurred
This signal is emitted when an error occurrs in the recorder.
unsigned samplesWritten(void) const
Find out how many samples that have been written so far.
const struct timeval & beginTimestamp(void) const
The timestamp of the first stored sample.
AudioRecorder(const std::string &filename, AudioRecorder::Format fmt=FMT_AUTO, int sample_rate=INTERNAL_SAMPLE_RATE)
Default constuctor.
virtual void flushSamples(void)
Tell the sink to flush the previously written samples.
virtual int writeSamples(const float *samples, int count)
Write samples into this audio sink.
const struct timeval & endTimestamp(void) const
The timestamp of the last stored sample.
bool closeFile(void)
Close the file.
The base class for an audio sink.
Namespace for the asynchronous programming classes.