#include <AudioInterface.h>
Public Types | |
enum | audioBitResolutionT { BIT8 = 1, BIT16 = 2, BIT24 = 3, BIT32 = 4 } |
Enum for Audio Resolution in bits. More... | |
enum | samplingRateT { SR22, SR32, SR44, SR48, SR88, SR96, SR192, UNDEF } |
Sampling Rates supported by JACK. More... | |
Public Member Functions | |
AudioInterface (JackTrip *jacktrip, int NumInChans, int NumOutChans, AudioInterface::audioBitResolutionT AudioBitResolution=AudioInterface::BIT16) | |
The class constructor. | |
virtual | ~AudioInterface () |
virtual void | setup ()=0 |
Setup the client. | |
virtual void | close ()=0 |
virtual int | startProcess () const =0 |
virtual int | stopProcess () const =0 |
virtual void | appendProcessPlugin (ProcessPlugin *plugin) |
virtual void | connectDefaultPorts ()=0 |
virtual void | callback (QVarLengthArray< sample_t * > &in_buffer, QVarLengthArray< sample_t * > &out_buffer, int8_t *input_packet, int8_t *output_packet, unsigned int n_frames, QVarLengthArray< sample_t * > &in_process_buffer, QVarLengthArray< sample_t * > &out_process_buffer) |
virtual void | setNumInputChannels (int nchannels) |
virtual void | setNumOutputChannels (int nchannels) |
virtual void | setSampleRate (uint32_t sample_rate) |
virtual void | setBufferSizeInSamples (uint32_t buf_size) |
virtual void | setClientName (const char *ClientName)=0 |
Set Client Name to something different that the default (JackTrip). | |
virtual int | getNumInputChannels () const |
Get Number of Input Channels. | |
virtual int | getNumOutputChannels () const |
Get Number of Output Channels. | |
virtual uint32_t | getBufferSizeInSamples () const |
virtual size_t | getSizeInBytesPerChannel () const |
virtual uint32_t | getSampleRate () const |
Get the Jack Server Sampling Rate, in samples/second. | |
virtual samplingRateT | getSampleRateType () const =0 |
Get the Jack Server Sampling Rate Enum Type samplingRateT. | |
virtual int | getAudioBitResolution () const |
Get the Audio Bit Resolution, in bits. | |
Static Public Member Functions | |
static void | fromSampleToBitConversion (const sample_t *const input, int8_t *output, const AudioInterface::audioBitResolutionT targetBitResolution) |
Convert a 32bit number (sample_t) into one of the bit resolution supported (audioBitResolutionT). | |
static void | fromBitToSampleConversion (const int8_t *const input, sample_t *output, const AudioInterface::audioBitResolutionT sourceBitResolution) |
Convert a audioBitResolutionT bit resolution number into a 32bit number (sample_t). | |
Private Member Functions | |
void | computeProcessFromNetwork (QVarLengthArray< sample_t * > &in_buffer, QVarLengthArray< sample_t * > &out_buffer, int8_t *input_packet, int8_t *output_packet, unsigned int n_frames) |
void | computeProcessToNetwork (QVarLengthArray< sample_t * > &in_buffer, QVarLengthArray< sample_t * > &out_buffer, int8_t *input_packet, int8_t *output_packet, unsigned int n_frames, QVarLengthArray< sample_t * > &in_process_buffer, QVarLengthArray< sample_t * > &out_process_buffer) |
Private Attributes | |
JackTrip * | mJackTrip |
int | mNumInChans |
Number of Input Channels. | |
int | mNumOutChans |
Number of Output Channels. | |
int | mAudioBitResolution |
Bit resolution in audio samples. | |
AudioInterface::audioBitResolutionT | mBitResolutionMode |
Bit resolution (audioBitResolutionT) mode. | |
uint32_t | mSampleRate |
Sampling Rate. | |
uint32_t | mBufferSizeInSamples |
Buffer size in samples. | |
unsigned int | mBufferSize |
size_t | mSizeInBytesPerChannel |
Size in bytes per audio channel. | |
QVector< ProcessPlugin * > | mProcessPlugins |
Vector of ProcesPlugins. |
AudioInterface::AudioInterface | ( | JackTrip * | jacktrip, | |
int | NumInChans, | |||
int | NumOutChans, | |||
AudioInterface::audioBitResolutionT | AudioBitResolution = AudioInterface::BIT16 | |||
) |
The class constructor.
jacktrip | Pointer to the JackTrip class that connects all classes (mediator) | |
NumInChans | Number of Input Channels | |
NumOutChans | Number of Output Channels | |
AudioBitResolution | Audio Sample Resolutions in bits |
AudioInterface::~AudioInterface | ( | ) | [virtual] |
void AudioInterface::setup | ( | ) | [pure virtual] |
Setup the client.
This will set the audio client with the specified Sampling Rate, Packet Size, Bit Resolution, etc...
Implemented in JackAudioInterface, and RtAudioInterface.
virtual void AudioInterface::close | ( | ) | [pure virtual] |
Implemented in JackAudioInterface, and RtAudioInterface.
virtual int AudioInterface::startProcess | ( | ) | const [pure virtual] |
Implemented in JackAudioInterface, and RtAudioInterface.
virtual int AudioInterface::stopProcess | ( | ) | const [pure virtual] |
Implemented in JackAudioInterface, and RtAudioInterface.
void AudioInterface::appendProcessPlugin | ( | ProcessPlugin * | plugin | ) | [virtual] |
Reimplemented in RtAudioInterface.
virtual void AudioInterface::connectDefaultPorts | ( | ) | [pure virtual] |
Implemented in JackAudioInterface, and RtAudioInterface.
void AudioInterface::callback | ( | QVarLengthArray< sample_t * > & | in_buffer, | |
QVarLengthArray< sample_t * > & | out_buffer, | |||
int8_t * | input_packet, | |||
int8_t * | output_packet, | |||
unsigned int | n_frames, | |||
QVarLengthArray< sample_t * > & | in_process_buffer, | |||
QVarLengthArray< sample_t * > & | out_process_buffer | |||
) | [virtual] |
void AudioInterface::fromSampleToBitConversion | ( | const sample_t *const | input, | |
int8_t * | output, | |||
const AudioInterface::audioBitResolutionT | targetBitResolution | |||
) | [static] |
Convert a 32bit number (sample_t) into one of the bit resolution supported (audioBitResolutionT).
The result is stored in an int_8 array of the appropriate size to hold the value. The caller is responsible to allocate enough space to store the result.
void AudioInterface::fromBitToSampleConversion | ( | const int8_t *const | input, | |
sample_t * | output, | |||
const AudioInterface::audioBitResolutionT | sourceBitResolution | |||
) | [static] |
Convert a audioBitResolutionT bit resolution number into a 32bit number (sample_t).
The result is stored in an sample_t array of the appropriate size to hold the value. The caller is responsible to allocate enough space to store the result.
virtual void AudioInterface::setNumInputChannels | ( | int | nchannels | ) | [inline, virtual] |
virtual void AudioInterface::setNumOutputChannels | ( | int | nchannels | ) | [inline, virtual] |
virtual void AudioInterface::setSampleRate | ( | uint32_t | sample_rate | ) | [inline, virtual] |
virtual void AudioInterface::setBufferSizeInSamples | ( | uint32_t | buf_size | ) | [inline, virtual] |
virtual void AudioInterface::setClientName | ( | const char * | ClientName | ) | [pure virtual] |
Set Client Name to something different that the default (JackTrip).
Implemented in JackAudioInterface, and RtAudioInterface.
virtual int AudioInterface::getNumInputChannels | ( | ) | const [inline, virtual] |
Get Number of Input Channels.
virtual int AudioInterface::getNumOutputChannels | ( | ) | const [inline, virtual] |
Get Number of Output Channels.
virtual uint32_t AudioInterface::getBufferSizeInSamples | ( | ) | const [inline, virtual] |
Reimplemented in JackAudioInterface, and RtAudioInterface.
size_t AudioInterface::getSizeInBytesPerChannel | ( | ) | const [virtual] |
Reimplemented in JackAudioInterface.
virtual uint32_t AudioInterface::getSampleRate | ( | ) | const [inline, virtual] |
Get the Jack Server Sampling Rate, in samples/second.
Reimplemented in JackAudioInterface, and RtAudioInterface.
virtual samplingRateT AudioInterface::getSampleRateType | ( | ) | const [pure virtual] |
Get the Jack Server Sampling Rate Enum Type samplingRateT.
Implemented in JackAudioInterface, and RtAudioInterface.
virtual int AudioInterface::getAudioBitResolution | ( | ) | const [inline, virtual] |
Get the Audio Bit Resolution, in bits.
This is one of the audioBitResolutionT set in construction
void AudioInterface::computeProcessToNetwork | ( | QVarLengthArray< sample_t * > & | in_buffer, | |
QVarLengthArray< sample_t * > & | out_buffer, | |||
int8_t * | input_packet, | |||
int8_t * | output_packet, | |||
unsigned int | n_frames, | |||
QVarLengthArray< sample_t * > & | in_process_buffer, | |||
QVarLengthArray< sample_t * > & | out_process_buffer | |||
) | [private] |
JackTrip* AudioInterface::mJackTrip [private] |
Reimplemented in JackAudioInterface, and RtAudioInterface.
int AudioInterface::mNumInChans [private] |
int AudioInterface::mNumOutChans [private] |
int AudioInterface::mAudioBitResolution [private] |
Bit resolution in audio samples.
uint32_t AudioInterface::mSampleRate [private] |
Sampling Rate.
uint32_t AudioInterface::mBufferSizeInSamples [private] |
Buffer size in samples.
unsigned int AudioInterface::mBufferSize [private] |
Reimplemented in RtAudioInterface.
size_t AudioInterface::mSizeInBytesPerChannel [private] |
QVector<ProcessPlugin*> AudioInterface::mProcessPlugins [private] |