SoDaRadio-5.0.3-master:8901fb5
|
Generic Audio Interface Class. More...
#include <AudioIfc.hxx>
Public Types | |
enum | DataFormat { FLOAT, DFLOAT, INT32, INT16, INT8 } |
Public Member Functions | |
AudioIfc (unsigned int _sample_rate, DataFormat _fmt, unsigned int _sample_count_hint, const std::string &name="AudioIfc") | |
virtual int | send (void *buf, unsigned int len)=0 |
send – send a buffer to the audio output More... | |
virtual bool | sendBufferReady (unsigned int len)=0 |
sendBufferReady – is there enough space in the audio device send buffer for a call from send? More... | |
virtual int | recv (void *buf, unsigned int len, bool block=true)=0 |
recv – get a buffer of data from the audio input More... | |
virtual bool | recvBufferReady (unsigned int len)=0 |
recvBufferReady – is there enough space in the audio device recv buffer for a call from recv? More... | |
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 void | sleepOut ()=0 |
stop the output stream so that we don't encounter a buffer underflow while the reciever is muted. More... | |
virtual void | wakeOut ()=0 |
start the output stream More... | |
virtual void | sleepIn ()=0 |
stop the input stream so that we don't encounter a buffer overflow while the transmitter is inactive. More... | |
virtual void | wakeIn ()=0 |
start the input stream 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... | |
Protected Attributes | |
unsigned int | sample_rate |
DataFormat | format |
unsigned int | sample_count_hint |
float | in_gain |
float | out_gain |
int | datatype_size |
Generic Audio Interface Class.
This is a pure virtual class that is the interface spec for whatever actual audio interface is provided. The spec is suitable for implementations using ALSA (
Definition at line 44 of file AudioIfc.hxx.
Enumerator | |
---|---|
FLOAT | |
DFLOAT | |
INT32 | |
INT16 | |
INT8 |
Definition at line 46 of file AudioIfc.hxx.
|
inline |
Definition at line 55 of file AudioIfc.hxx.
References datatype_size, DFLOAT, FLOAT, format, INT16, INT32, INT8, recv(), recvBufferReady(), sample_count_hint, sample_rate, send(), and sendBufferReady().
|
inlinevirtual |
Definition at line 166 of file AudioIfc.hxx.
Referenced by SoDa::AudioALSA::wakeIn().
|
inlinevirtual |
Definition at line 165 of file AudioIfc.hxx.
Referenced by SoDa::BaseBandRX::run(), and SoDa::AudioALSA::wakeIn().
|
inlinevirtual |
get the gain for the input device.
Definition at line 141 of file AudioIfc.hxx.
References in_gain, sleepIn(), sleepOut(), wakeIn(), and wakeOut().
|
inlinevirtual |
get the gain for the output device.
Definition at line 135 of file AudioIfc.hxx.
References out_gain.
|
pure virtual |
recv – 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 send |
block | block on this call if no data is available (ignored) |
Implemented in SoDa::AudioALSA, and SoDa::AudioPA.
Referenced by AudioIfc(), main(), and SoDa::BaseBandTX::run().
|
pure virtual |
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 |
Implemented in SoDa::AudioALSA, and SoDa::AudioPA.
Referenced by AudioIfc(), main(), and SoDa::BaseBandTX::run().
|
pure virtual |
send – 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 |
Implemented in SoDa::AudioALSA, and SoDa::AudioPA.
Referenced by AudioIfc(), main(), and SoDa::BaseBandRX::run().
|
pure virtual |
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 |
Implemented in SoDa::AudioALSA, and SoDa::AudioPA.
Referenced by AudioIfc(), main(), and SoDa::BaseBandRX::run().
|
inlinevirtual |
set the gain for the input device.
gain | – range from 0 to 1.0 |
Definition at line 126 of file AudioIfc.hxx.
References in_gain.
|
inlinevirtual |
set the gain for the output device.
gain | – range from 0 to 1.0 |
Definition at line 116 of file AudioIfc.hxx.
References out_gain.
Referenced by main().
|
pure virtual |
stop the input stream so that we don't encounter a buffer overflow while the transmitter is inactive.
This should also flush all incoming buffers. (Virtual audio devices can get ahead of the processing by a good bit.)
Implemented in SoDa::AudioALSA, and SoDa::AudioPA.
Referenced by getInGain(), and main().
|
pure virtual |
stop the output stream so that we don't encounter a buffer underflow while the reciever is muted.
Implemented in SoDa::AudioALSA, and SoDa::AudioPA.
Referenced by SoDa::BaseBandRX::execSetCommand(), and getInGain().
|
pure virtual |
start the input stream
Implemented in SoDa::AudioALSA, and SoDa::AudioPA.
Referenced by getInGain(), main(), and SoDa::BaseBandTX::run().
|
pure virtual |
start the output stream
Implemented in SoDa::AudioALSA, and SoDa::AudioPA.
Referenced by SoDa::BaseBandRX::execSetCommand(), getInGain(), and SoDa::BaseBandRX::run().
|
protected |
Definition at line 176 of file AudioIfc.hxx.
Referenced by AudioIfc().
|
protected |
Definition at line 170 of file AudioIfc.hxx.
Referenced by AudioIfc().
|
protected |
Definition at line 173 of file AudioIfc.hxx.
Referenced by getInGain(), and setInGain().
|
protected |
Definition at line 174 of file AudioIfc.hxx.
Referenced by getOutGain(), and setOutGain().
|
protected |
Definition at line 171 of file AudioIfc.hxx.
Referenced by AudioIfc().
|
protected |
Definition at line 169 of file AudioIfc.hxx.
Referenced by AudioIfc().