Go to the documentation of this file.
28 #ifndef ASYNC_AUDIO_DEVICE_INCLUDED
29 #define ASYNC_AUDIO_DEVICE_INCLUDED
38 #include <sigc++/sigc++.h>
122 class AudioDevice :
public sigc::trackable
254 Mode mode(
void)
const {
return current_mode; }
323 void putBlocks(int16_t *buf,
int frame_cnt);
324 int getBlocks(int16_t *buf,
int block_cnt);
328 static const int DEFAULT_SAMPLE_RATE = INTERNAL_SAMPLE_RATE;
329 static const int DEFAULT_CHANNELS = 2;
330 static const int DEFAULT_BLOCK_COUNT_HINT = 4;
331 static const int DEFAULT_BLOCK_SIZE_HINT = 256;
333 static std::map<std::string, AudioDevice*> devices;
337 std::list<AudioIO*> aios;
static int block_size_hint
virtual void audioToWriteAvailable(void)=0
Tell the audio device handler that there are audio to be written in the buffer.
int getBlocks(int16_t *buf, int block_cnt)
virtual ~AudioDevice(void)
Destructor.
Mode
The different modes to open a device in.
virtual int writeBlocksize(void)=0
Find out what the write (playback) blocksize is set to.
virtual bool openDevice(Mode mode)=0
Open the audio device.
virtual bool isFullDuplexCapable(void)=0
Check if the audio device has full duplex capability.
void putBlocks(int16_t *buf, int frame_cnt)
@ MODE_RDWR
Both read and write.
static int block_count_hint
@ MODE_NONE
No mode. The same as close.
virtual void flushSamples(void)=0
virtual int readBlocksize(void)=0
Find out what the read (recording) blocksize is set to.
const std::string & devName(void) const
Return the device name.
AudioDevice(const std::string &dev_name)
Constuctor.
bool open(Mode mode)
Open the audio device.
static void setChannels(int channels)
Set the number of channels used when doing future opens.
virtual int samplesToWrite(void) const =0
Find out how many samples there are in the output buffer.
Namespace for the asynchronous programming classes.
void close(void)
Close the audio device.
static void setBlocksize(int size)
Set the blocksize used when opening audio devices.
static void setSampleRate(int rate)
Set the sample rate used when doing future opens.
Mode mode(void) const
Get the current operating mode of this audio device.
static AudioDevice * registerAudioIO(const std::string &dev_designator, AudioIO *audio_io)
Register an AudioIO object with the given device name.
static void unregisterAudioIO(AudioIO *audio_io)
Unregister a previously registered AudioIO object.
int sampleRate(void) const
Return the sample rate.
virtual void closeDevice(void)=0
Close the audio device.
static void setBlockCount(int count)
Set the buffer count used when opening audio devices.