JackTrip
Public Member Functions | List of all members
JackAudioInterface Class Reference

Class that provides an interface with the Jack Audio Server. More...

#include <JackAudioInterface.h>

Inheritance diagram for JackAudioInterface:
Inheritance graph
[legend]
Collaboration diagram for JackAudioInterface:
Collaboration graph
[legend]

Public Member Functions

 JackAudioInterface (JackTrip *jacktrip, int NumInChans, int NumOutChans, AudioInterface::audioBitResolutionT AudioBitResolution=AudioInterface::BIT16, QString ClientName="JackTrip")
 The class constructor. More...
 
virtual ~JackAudioInterface ()
 The class destructor. More...
 
virtual void setup ()
 Setup the client. More...
 
virtual int startProcess () const
 Tell the JACK server that we are ready to roll. The process-callback will start running. This runs on its own thread. More...
 
virtual int stopProcess () const
 Stops the process-callback thread. More...
 
void connectDefaultPorts ()
 Connect the default ports, capture to sends, and receives to playback. More...
 
virtual void setClientName (QString ClientName)
 Set Client Name to something different that the default (JackTrip) More...
 
virtual void setSampleRate (uint32_t)
 
virtual void setBufferSizeInSamples (uint32_t)
 
virtual void enableBroadcastOutput ()
 
virtual uint32_t getSampleRate () const
 Get the Jack Server Sampling Rate, in samples/second. More...
 
virtual uint32_t getBufferSizeInSamples () const
 Get the Jack Server Buffer Size, in samples. More...
 
virtual uint32_t getBufferSizeInBytes () const
 Get the Jack Server Buffer Size, in bytes. More...
 
virtual size_t getSizeInBytesPerChannel () const
 Get size of each audio per channel, in bytes. More...
 
- Public Member Functions inherited from AudioInterface
 AudioInterface (JackTrip *jacktrip, int NumInChans, int NumOutChans, AudioInterface::audioBitResolutionT AudioBitResolution=AudioInterface::BIT16)
 The class constructor. More...
 
virtual ~AudioInterface ()
 The class destructor. More...
 
virtual void broadcastCallback (QVarLengthArray< sample_t * > &mon_buffer, unsigned int n_frames)
 Process callback. Subclass should call this callback after obtaining the in_buffer and out_buffer pointers. More...
 
virtual void callback (QVarLengthArray< sample_t * > &in_buffer, QVarLengthArray< sample_t * > &out_buffer, unsigned int n_frames)
 
virtual void appendProcessPluginToNetwork (ProcessPlugin *plugin)
 appendProcessPluginToNetwork(): Append a ProcessPlugin for outgoing audio. The processing order equals order they were appended. This processing is in the JackTrip client before sending to the network. More...
 
virtual void appendProcessPluginFromNetwork (ProcessPlugin *plugin)
 appendProcessPluginFromNetwork(): Same as appendProcessPluginToNetwork() except that these plugins operate on the audio received from the network (typically from a JackTrip server). The complete processing chain then looks like this: audio -> JACK -> JackTrip client -> processPlugin to network -> remote JackTrip server -> JackTrip client -> processPlugin from network -> JACK -> audio More...
 
void initPlugins ()
 initPlugins(): Initialize all ProcessPlugin modules. The audio sampling rate (mSampleRate) must be set at this time. More...
 
virtual void setNumInputChannels (int nchannels)
 
virtual void setNumOutputChannels (int nchannels)
 
virtual void setDeviceID (uint32_t device_id)
 
virtual void setLoopBack (bool b)
 
virtual void setAudioTesterP (AudioTester *atp)
 
virtual int getNumInputChannels () const
 Get Number of Input Channels. More...
 
virtual int getNumOutputChannels () const
 Get Number of Output Channels. More...
 
virtual uint32_t getDeviceID () const
 
virtual samplingRateT getSampleRateType () const
 Get the Jack Server Sampling Rate Enum Type samplingRateT. More...
 
virtual int getAudioBitResolution () const
 Get the Audio Bit Resolution, in bits. More...
 

Additional Inherited Members

- Public Types inherited from AudioInterface
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...
 
- Static Public Member Functions inherited from AudioInterface
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). More...
 
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) More...
 
static int getSampleRateFromType (samplingRateT rate_type)
 Helper function to get the sample rate (in Hz) for a JackAudioInterface::samplingRateT. More...
 
- Protected Attributes inherited from AudioInterface
bool mProcessingAudio
 Set when processing an audio callback buffer pair. More...
 
const uint32_t MAX_AUDIO_BUFFER_SIZE = 8192
 

Detailed Description

Class that provides an interface with the Jack Audio Server.

Todo:
implement srate_callback
Todo:
automatically starts jack with buffer and sample rate settings specified by the user

Constructor & Destructor Documentation

◆ JackAudioInterface()

JackAudioInterface::JackAudioInterface ( JackTrip jacktrip,
int  NumInChans,
int  NumOutChans,
AudioInterface::audioBitResolutionT  AudioBitResolution = AudioInterface::BIT16,
QString  ClientName = "JackTrip" 
)

The class constructor.

Parameters
jacktripPointer to the JackTrip class that connects all classes (mediator)
NumInChansNumber of Input Channels
NumOutChansNumber of Output Channels
AudioBitResolutionAudio Sample Resolutions in bits
ClientNameClient name in Jack

◆ ~JackAudioInterface()

JackAudioInterface::~JackAudioInterface ( )
virtual

The class destructor.

Member Function Documentation

◆ connectDefaultPorts()

void JackAudioInterface::connectDefaultPorts ( )
virtual

Connect the default ports, capture to sends, and receives to playback.

Implements AudioInterface.

◆ enableBroadcastOutput()

virtual void JackAudioInterface::enableBroadcastOutput ( )
inlinevirtual

Reimplemented from AudioInterface.

◆ getBufferSizeInBytes()

virtual uint32_t JackAudioInterface::getBufferSizeInBytes ( ) const
inlinevirtual

Get the Jack Server Buffer Size, in bytes.

◆ getBufferSizeInSamples()

uint32_t JackAudioInterface::getBufferSizeInSamples ( ) const
virtual

Get the Jack Server Buffer Size, in samples.

Reimplemented from AudioInterface.

◆ getSampleRate()

uint32_t JackAudioInterface::getSampleRate ( ) const
virtual

Get the Jack Server Sampling Rate, in samples/second.

Reimplemented from AudioInterface.

◆ getSizeInBytesPerChannel()

size_t JackAudioInterface::getSizeInBytesPerChannel ( ) const
virtual

Get size of each audio per channel, in bytes.

Reimplemented from AudioInterface.

◆ setBufferSizeInSamples()

virtual void JackAudioInterface::setBufferSizeInSamples ( uint32_t  )
inlinevirtual

Reimplemented from AudioInterface.

◆ setClientName()

virtual void JackAudioInterface::setClientName ( QString  ClientName)
inlinevirtual

Set Client Name to something different that the default (JackTrip)

Implements AudioInterface.

◆ setSampleRate()

virtual void JackAudioInterface::setSampleRate ( uint32_t  )
inlinevirtual

Reimplemented from AudioInterface.

◆ setup()

void JackAudioInterface::setup ( )
virtual

Setup the client.

Reimplemented from AudioInterface.

◆ startProcess()

int JackAudioInterface::startProcess ( ) const
virtual

Tell the JACK server that we are ready to roll. The process-callback will start running. This runs on its own thread.

Returns
0 on success, otherwise a non-zero error code

Implements AudioInterface.

◆ stopProcess()

int JackAudioInterface::stopProcess ( ) const
virtual

Stops the process-callback thread.

Returns
0 on success, otherwise a non-zero error code

Implements AudioInterface.


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