SoDaRadio-5.0.3-master:8901fb5
|
the PortAudio interface class More...
#include <AudioPA.hxx>
Public Member Functions | |
AudioPA (unsigned int _sample_rate, AudioIfc::DataFormat _fmt, unsigned int _sample_count_hint=1024) | |
constructor More... | |
~AudioPA () | |
int | send (void *buf, unsigned int len) |
sendBuf – send a buffer to the audio output More... | |
bool | sendBufferReady (unsigned int len) |
sendBufferReady – is there enough space in the audio device send buffer for a call from send? More... | |
int | recv (void *buf, unsigned int len, bool block=true) |
recvBuf – get a buffer of data from the audio input More... | |
bool | recvBufferReady (unsigned int len) |
recvBufferReady – is there enough space in the audio device recv buffer for a call from recv? More... | |
void | sleepOut () |
stop the output stream so that we don't encounter a buffer underflow while the reciever is muted. More... | |
void | wakeOut () |
start the output stream More... | |
void | sleepIn () |
stop the input stream so that we don't encounter a buffer overflow while the transmitter is inactive. More... | |
void | wakeIn () |
start the input stream More... | |
Public Member Functions inherited from SoDa::AudioIfc | |
AudioIfc (unsigned int _sample_rate, DataFormat _fmt, unsigned int _sample_count_hint, const std::string &name="AudioIfc") | |
virtual bool | setOutGain (float gain) |
set the gain for the output device. More... | |
virtual bool | setInGain (float gain) |
set the gain for the input device. More... | |
virtual float | getOutGain () |
get the gain for the output device. More... | |
virtual float | getInGain () |
get the gain for the input device. More... | |
virtual std::string | currentPlaybackState () |
virtual std::string | currentCaptureState () |
Public Member Functions inherited from SoDa::SoDaBase | |
SoDaBase (const std::string &oname) | |
The constructor – pass a name for the object. More... | |
std::string & | getObjName () |
get the name of this object More... | |
SoDaBase * | findSoDaObject (const std::string &oname) |
find a SoDa Object by name. More... | |
double | getTime () |
Get a time stamp in nS resolution that monotonically increases and that is very inexpensive (typically < 100nS). More... | |
Additional Inherited Members | |
Public Types inherited from SoDa::AudioIfc | |
enum | DataFormat { FLOAT, DFLOAT, INT32, INT16, INT8 } |
Protected Attributes inherited from SoDa::AudioIfc | |
unsigned int | sample_rate |
DataFormat | format |
unsigned int | sample_count_hint |
float | in_gain |
float | out_gain |
int | datatype_size |
the PortAudio interface class
AudioPA implements the interface specified by AudioIfc. It should be interchangable with other audio interface handlers.
The PortAudio stuff is nice, but the library is very noisy – it spews out lots of "informational" messages on the console. While the PA implementation of the Audio class might look simpler, it is not clear that it performs as well or is as clean as the ALSA PCM implementation, despite the fact that the latter is quite likely implemented on top of the former... sigh.
Definition at line 60 of file AudioPA.hxx.
SoDa::AudioPA::AudioPA | ( | unsigned int | _sample_rate, |
AudioIfc::DataFormat | _fmt, | ||
unsigned int | _sample_count_hint = 1024 |
||
) |
constructor
_sample_rate | in Hz – 48000 is a good choice |
_fmt | – the format of the data (FLOAT, DFLOAT, INT32, INT16, INT8) |
_sample_count_hint | – the size of the buffers passed to and from the audio device (in samples) |
Definition at line 107 of file AudioPA.cxx.
|
inline |
Definition at line 70 of file AudioPA.hxx.
|
inlinevirtual |
recvBuf – get a buffer of data from the audio input
buf | buffer of type described by the DataFormat selected at init |
len | number of elements in the buffer to get |
block | block on this call if data is not ready (assumed true). |
Implements SoDa::AudioIfc.
Definition at line 93 of file AudioPA.hxx.
References PORTAUDIO_DEF.
|
inlinevirtual |
recvBufferReady – is there enough space in the audio device recv buffer for a call from recv?
len | the number of samples that we wish to get |
Implements SoDa::AudioIfc.
Definition at line 100 of file AudioPA.hxx.
References PORTAUDIO_DEF.
|
inlinevirtual |
sendBuf – send a buffer to the audio output
buf | buffer of type described by the DataFormat selected at init |
len | number of elements in the buffer to send |
Implements SoDa::AudioIfc.
Definition at line 77 of file AudioPA.hxx.
References PORTAUDIO_DEF.
|
inlinevirtual |
sendBufferReady – is there enough space in the audio device send buffer for a call from send?
len | the number of samples that we wish to send |
Implements SoDa::AudioIfc.
Definition at line 84 of file AudioPA.hxx.
References PORTAUDIO_DEF.
|
inlinevirtual |
stop the input stream so that we don't encounter a buffer overflow while the transmitter is inactive.
Implements SoDa::AudioIfc.
Definition at line 126 of file AudioPA.hxx.
|
inlinevirtual |
stop the output stream so that we don't encounter a buffer underflow while the reciever is muted.
Implements SoDa::AudioIfc.
Definition at line 106 of file AudioPA.hxx.
|
inlinevirtual |
start the input stream
Implements SoDa::AudioIfc.
Definition at line 135 of file AudioPA.hxx.
References SoDa::SoDaBase::getObjName(), and PORTAUDIO_DEF.
|
inlinevirtual |