Logo Search packages:      
Sourcecode: jacktrip version File versions  Download package

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

JackAudioInterface Class Reference

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

#include <JackAudioInterface.h>

Collaboration diagram for JackAudioInterface:
Collaboration graph

List of all members.

Public Types

enum  audioBitResolutionT { BIT8 = 1, BIT16 = 2, BIT24 = 3, BIT32 = 4 }

Enum for Audio Resolution in bits.

enum  samplingRateT {
  SR22, SR32, SR44, SR48,
  SR88, SR96, SR192, UNDEF

Sampling Rates supported by JACK.


Public Member Functions

void appendProcessPlugin (ProcessPlugin *plugin)
 Set the pointer to the Input and Output RingBuffer that'll be use to read and write audio.
void connectDefaultPorts ()
 Connect the default ports, capture to sends, and receives to playback.
int getAudioBitResolution () const
 Get the Audio Bit Resolution, in bits.
uint32_t getBufferSizeInBytes () const
 Get the Jack Server Buffer Size, in bytes.
uint32_t getBufferSizeInSamples () const
 Get the Jack Server Buffer Size, in samples.
int getNumInputChannels () const
 Get Number of Input Channels.
int getNumOutputChannels () const
 Get Number of Output Channels.
uint32_t getSampleRate () const
 Get the Jack Server Sampling Rate, in samples/second.
samplingRateT getSampleRateType () const
 Get the Jack Server Sampling Rate Enum Type samplingRateT.
size_t getSizeInBytesPerChannel () const
 Get size of each audio per channel, in bytes.
 JackAudioInterface (JackTrip *jacktrip, int NumInChans, int NumOutChans, audioBitResolutionT AudioBitResolution=BIT16, const char *ClientName="JackTrip")
 The class constructor.
void setClientName (const char *ClientName)
 Set Client Name to something different that the default (JackTrip)
void setup ()
 Setup the client.
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.
int stopProcess () const
 Stops the process-callback thread.
virtual ~JackAudioInterface ()
 The class destructor.

Static Public Member Functions

static void fromBitToSampleConversion (const int8_t *const input, sample_t *output, const audioBitResolutionT sourceBitResolution)
 Convert a audioBitResolutionT bit resolution number into a 32bit number (sample_t)
static void fromSampleToBitConversion (const sample_t *const input, int8_t *output, const audioBitResolutionT targetBitResolution)
 Convert a 32bit number (sample_t) into one of the bit resolution supported (audioBitResolutionT).
static int getSampleRateFromType (samplingRateT rate_type)
 Helper function to get the sample rate (in Hz) for a JackAudioInterface::samplingRateT.

Private Member Functions

void computeNetworkProcessFromNetwork ()
 Sets the part of the process callback that sends and receive packets.
void computeNetworkProcessToNetwork ()
 Compute the process from JACK to send packets.
void createChannels ()
 Creates input and output channels in the Jack client.
int processCallback (jack_nframes_t nframes)
 JACK process callback.
void setProcessCallback ()
 Set the process callback of the member function processCallback. This process will be called by the JACK server whenever there is work to be done.
void setupClient ()
 Private method to setup a client of the Jack server.

std::runtime_errorCan't start Jack.

Static Private Member Functions

static void jackShutdown (void *)
 JACK calls this shutdown_callback if the server ever shuts down or decides to disconnect the client.
static int wrapperProcessCallback (jack_nframes_t nframes, void *arg)
 Wrapper to cast the member processCallback to a static function pointer that can be used with jack_set_process_callback

Private Attributes

int mAudioBitResolution
 Bit resolution in audio samples.
audioBitResolutionT mBitResolutionMode
 Bit resolution (audioBitResolutionT) mode.
jack_client_t * mClient
 Jack Client.
const char * mClientName
 Jack Client Name.
QVarLengthArray< sample_t * > mInBuffer
 Vector of Input buffers/channel read from JACK.
QVarLengthArray< jack_port_t * > mInPorts
 Vector of Input Ports (Channels)
QVarLengthArray< sample_t * > mInProcessBuffer
 Vector of Input buffers/channel for ProcessPlugin.
int8_t * mInputPacket
 Packet containing all the channels to read from the RingBuffer.
 JackTrip mediator class.
int mNumFrames
 Buffer block size, in samples.
int mNumInChans
 Number of Input Channels.
int mNumOutChans
 Number of Output Channels.
QVarLengthArray< sample_t * > mOutBuffer
 Vector of Output buffer/channel to write to JACK.
QVarLengthArray< jack_port_t * > mOutPorts
 Vector of Output Ports (Channels)
QVarLengthArray< sample_t * > mOutProcessBuffer
 Vector of Output buffers/channel for ProcessPlugin.
int8_t * mOutputPacket
 Packet containing all the channels to send to the RingBuffer.
QVector< ProcessPlugin * > mProcessPlugins
 Vector of ProcesPlugins
size_t mSizeInBytesPerChannel
 Size in bytes per audio channel.

Static Private Attributes

static QMutex sJackMutex
 Mutex to make thread safe jack functions that are not.

Detailed Description

Class that provides an interface with the Jack Audio Server.


implement srate_callback

automatically starts jack with buffer and sample rate settings specified by the user

Definition at line 63 of file JackAudioInterface.h.

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

Generated by  Doxygen 1.6.0   Back to index