AudioInterface Class Reference

#include <AudioInterface.h>

Inheritance diagram for AudioInterface:

Inheritance graph
[legend]
Collaboration diagram for AudioInterface:

Collaboration graph
[legend]

List of all members.

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

JackTripmJackTrip
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.


Member Enumeration Documentation

Enum for Audio Resolution in bits.

Enumerator:
BIT8  8 bits
BIT16  16 bits (default)
BIT24  24 bits
BIT32  32 bits

Sampling Rates supported by JACK.

Enumerator:
SR22  22050 Hz
SR32  32000 Hz
SR44  44100 Hz
SR48  48000 Hz
SR88  88200 Hz
SR96  96000 Hz
SR192  192000 Hz
UNDEF  Undefined.


Constructor & Destructor Documentation

AudioInterface::AudioInterface ( JackTrip jacktrip,
int  NumInChans,
int  NumOutChans,
AudioInterface::audioBitResolutionT  AudioBitResolution = AudioInterface::BIT16 
)

The class constructor.

Parameters:
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]


Member Function Documentation

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]

Todo:
check that channels in ProcessPlugins are less or same that jack channels

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]

Todo:
Implement for more than one process plugin, now it just works propertely with one. do it chaining outputs to inputs in the buffers. May need a tempo buffer

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.

Returns:
JackAudioInterface::samplingRateT enum type

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::computeProcessFromNetwork ( QVarLengthArray< sample_t * > &  in_buffer,
QVarLengthArray< sample_t * > &  out_buffer,
int8_t input_packet,
int8_t output_packet,
unsigned int  n_frames 
) [private]

Todo:
cast *mInBuffer[i] to the bit resolution

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]


Member Data Documentation

Reimplemented in JackAudioInterface, and RtAudioInterface.

Number of Input Channels.

Reimplemented in JackAudioInterface.

Number of Output Channels.

Reimplemented in JackAudioInterface.

Bit resolution in audio samples.

Bit resolution (audioBitResolutionT) mode.

Reimplemented in JackAudioInterface.

Sampling Rate.

Buffer size in samples.

unsigned int AudioInterface::mBufferSize [private]

Reimplemented in RtAudioInterface.

Size in bytes per audio channel.

Reimplemented in JackAudioInterface.

Vector of ProcesPlugins.

Reimplemented in JackAudioInterface.


The documentation for this class was generated from the following files: