AudibleT 0.0.1
A real-time A/B/X audio testing tool for subjective assessment of various audio parameters, compatible for general purpose computer as well as embedded systems.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
JackCpp::AudioIO Class Referenceabstract
Inheritance diagram for JackCpp::AudioIO:
Inheritance graph
[legend]

Public Types

enum  jack_state_t { notActive , active , closed }
 An enum indicating the state of our jack client.
 
typedef std::vector< jack_default_audio_sample_t * > audioBufVector
 A typedef so so that we don't always have to write std::vector<jack_default_audio_sample_t *>
 

Public Member Functions

jack_client_t * client ()
 Gives users a pointer to the client created and used by this class.
 
 AudioIO (std::string name, unsigned int inPorts=0, unsigned int outPorts=2, bool startServer=true) noexcept(false)
 The Constructor.
 
void createClient (std::string name, unsigned int inPorts=0, unsigned int outPorts=2, bool startServer=true) noexcept(false)
 
virtual ~AudioIO ()
 The Destructor.
 
bool portExists (std::string name)
 See if a port with the name "name" exists for our client.
 
virtual void reserveOutPorts (unsigned int num) noexcept(false)
 Reserve output ports.
 
virtual void reserveInPorts (unsigned int num) noexcept(false)
 Reserve input ports.
 
void start () noexcept(false)
 Start the jack client.
 
void stop () noexcept(false)
 Stop the jack client.
 
void close () noexcept(false)
 Close the jack client.
 
unsigned int inPorts ()
 Get the number of jack input ports.
 
unsigned int outPorts ()
 Get the number of jack output ports.
 
virtual unsigned int addInPort (std::string name) noexcept(false)
 Add a jack input port to our client.
 
virtual unsigned int addOutPort (std::string name) noexcept(false)
 Add a jack output port to our client.
 
void connectTo (unsigned int index, std::string sourcePortName) noexcept(false)
 Connect our output to a jack client's source port.
 
void connectFrom (unsigned int index, std::string destPortName) noexcept(false)
 Connect our input to a jack client's destination port.
 
void connectToPhysical (unsigned int index, unsigned physical_index) noexcept(false)
 Connect our output port to a physical output port.
 
void connectFromPhysical (unsigned int index, unsigned physical_index) noexcept(false)
 Connect our input port to a physical input port.
 
void disconnectInPort (unsigned int index) noexcept(false)
 Disconnect input port from all connections.
 
void disconnectOutPort (unsigned int index) noexcept(false)
 Disconnect output port from all connections.
 
unsigned int numConnectionsInPort (unsigned int index) noexcept(false)
 Get the number of connections to our input port.
 
unsigned int numConnectionsOutPort (unsigned int index) noexcept(false)
 Get the number of connections to our output port.
 
unsigned int numPhysicalSourcePorts ()
 Get the number of physical audio input ports These are ports that can send audio to your client.
 
unsigned int numPhysicalDestinationPorts ()
 Get the number of physical audio output ports These are ports that your client can send audio to.
 
std::string getInputPortName (unsigned int index) noexcept(false)
 Get the name of our client's input port.
 
std::string getOutputPortName (unsigned int index) noexcept(false)
 Get the name of our client's output port.
 
virtual void jackShutdownCallback ()
 This method is called when Jack shuts down. Override if you want to do something when jack shuts down.
 
float getCpuLoad ()
 The current CPU load estimated by JACK.
 
jack_nframes_t getSampleRate ()
 Get the sample rate.
 
jack_nframes_t getBufferSize ()
 Get the jack buffer size.
 
bool isRealTime ()
 Check to see if the client is running in real time mode.
 
bool isBufferMemoryLocked ()
 Check to see if the buffer is locked into the memory.
 
std::string getName ()
 Get the name of our client.
 
jack_state_t getState ()
 Get the state of our Jack client.
 
jack_nframes_t getFrameTime ()
 Get an estimate of the current time in frames.
 
jack_nframes_t getFramesSinceCycleStart ()
 Get the time in frames since the JACK server began the current process cycle.
 

Static Public Member Functions

static int jackProcessCallback (jack_nframes_t nframes, void *arg)
 The callback that jack actually gets [static].
 

Protected Member Functions

virtual int audioCallback (jack_nframes_t nframes, audioBufVector inBufs, audioBufVector outBufs)=0
 The method that the user must overload in order to actually process jack data.
 

Constructor & Destructor Documentation

◆ AudioIO()

JackCpp::AudioIO::AudioIO ( std::string  name,
unsigned int  inPorts = 0,
unsigned int  outPorts = 2,
bool  startServer = true 
)

The Constructor.

Parameters
namestring indicating the name of the jack client to create
inPortsan unsigned integer indicating the number of default input ports to create
outPortsan unsigned integer indicating the number of default output ports to create
startServera boolean indicating whether to start a jack server if one isn't already running
See also
audioCallback

Member Function Documentation

◆ addInPort()

unsigned int JackCpp::AudioIO::addInPort ( std::string  name)
virtual

Add a jack input port to our client.

Parameters
namestring the name of the port to add
Returns
the number of total input ports

◆ addOutPort()

unsigned int JackCpp::AudioIO::addOutPort ( std::string  name)
virtual

Add a jack output port to our client.

Parameters
namestring the name of the port to add
Returns
the number of total output ports

◆ audioCallback()

virtual int JackCpp::AudioIO::audioCallback ( jack_nframes_t  nframes,
audioBufVector  inBufs,
audioBufVector  outBufs 
)
protectedpure virtual

The method that the user must overload in order to actually process jack data.

Parameters
nframesthe number frames to process
inBufsa vector of audio buffers
outBufsa vector of audio buffers
Returns
0 on success, non zero on error, which will cause jack to remove the client from the process graph

Implemented in JackClientAudioEngine.

◆ client()

jack_client_t * JackCpp::AudioIO::client ( )

Gives users a pointer to the client created and used by this class.

Returns
a pointer to the jack client used by this class.

◆ connectFrom()

void JackCpp::AudioIO::connectFrom ( unsigned int  index,
std::string  destPortName 
)

Connect our input to a jack client's destination port.

Parameters
indexthe index of our input port to connect to
destPortNamethe client:port name to connect from

◆ connectFromPhysical()

void JackCpp::AudioIO::connectFromPhysical ( unsigned int  index,
unsigned  physical_index 
)

Connect our input port to a physical input port.

Parameters
indexthe index of our input port to connect to
physical_indexthe physical input port index to connect from

◆ connectTo()

void JackCpp::AudioIO::connectTo ( unsigned int  index,
std::string  sourcePortName 
)

Connect our output to a jack client's source port.

Parameters
indexthe index of our output port to connect from.
sourcePortNamethe client:port name to connect to

◆ connectToPhysical()

void JackCpp::AudioIO::connectToPhysical ( unsigned int  index,
unsigned  physical_index 
)

Connect our output port to a physical output port.

Parameters
indexthe index of our output port to connect from
physical_indexthe physical output port index to connect to

◆ getCpuLoad()

float JackCpp::AudioIO::getCpuLoad ( )

The current CPU load estimated by JACK.

This is a running average of the time it takes to execute a full process cycle for all clients as a percentage of the real time available per cycle determined by the buffer size and sample rate.

◆ getFramesSinceCycleStart()

jack_nframes_t JackCpp::AudioIO::getFramesSinceCycleStart ( )
inline

Get the time in frames since the JACK server began the current process cycle.

Returns
the time in frames that has passed since the JACK server began the current process cycle

◆ getFrameTime()

jack_nframes_t JackCpp::AudioIO::getFrameTime ( )
inline

Get an estimate of the current time in frames.

This is a running counter, no significance should be attached to its value, but it can be compared to a previously returned value.

Returns
an estimate of the current time in frames.

◆ getName()

std::string JackCpp::AudioIO::getName ( )
inline

Get the name of our client.

This might not be exactly the same as the name we provided to the constructor

Returns
a string indicating the name of our client.

◆ jackProcessCallback()

int JackCpp::AudioIO::jackProcessCallback ( jack_nframes_t  nframes,
void *  arg 
)
static

The callback that jack actually gets [static].

This is a static method that the C jack callback calls, users should not need to override this method.

Parameters
nframesthe number frames to process
arga pointer to our AudioIO object
Returns
the actual number of frames processed
See also
audioCallback

◆ reserveInPorts()

void JackCpp::AudioIO::reserveInPorts ( unsigned int  num)
virtual

Reserve input ports.

This method must be called before the client is started. This reserves a number of ports so that they can be safely created while the client is running. The number indicates the maximum number of ports that can be created while the client is running. This number includes those ports that a have already been created, so if you've already created x ports and you reserve y ports total, you can only create y - x ports while the client is running.

Parameters
numan integer indicating the number of input ports to reserve

◆ reserveOutPorts()

void JackCpp::AudioIO::reserveOutPorts ( unsigned int  num)
virtual

Reserve output ports.

This method must be called before the client is started. This reserves a number of ports so that they can be safely created while the client is running. The number indicates the maximum number of ports that can be created while the client is running. This number includes those ports that a have already been created, so if you've already created x ports and you reserve y ports total, you can only create y - x ports while the client is running.

Parameters
numan integer indicating the number of output ports to reserve

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