gtkIOStream  1.7.0
GTK+ << C++ IOStream operators for GTK+. Now with ORBing, numerical computation, audio client and more ...
JackBase Class Reference

#include <JackBase.H>

Inheritance diagram for JackBase:
[legend]
Collaboration diagram for JackBase:
[legend]

Public Member Functions

 JackBase ()
 
 JackBase (string clientName_)
 
 JackBase (string clientName_, string serverName)
 
virtual ~JackBase ()
 Destructor. More...
 
virtual int stopClient (void)
 
virtual int disconnect (void)
 
int getSampleRate (void) const
 
virtual int createPorts (string inName, int inCnt, string outName, int outCnt)
 
virtual int destroyPorts ()
 
void getPhysicalPorts (vector< jack_port_t *> &inPorts, vector< jack_port_t *> &outPorts)
 
void getPhysicalPortCount (int &in, int &out)
 
bool connected ()
 
virtual int connect (string clientName_)
 
virtual int connect (const string &clientName_, const string &serverName)
 
virtual void print (ostream &os)
 
string getClientName ()
 
virtual void setClientName (string cn)
 
string portNameFromPort (jack_port_id_t p)
 
string portNameFromPort (jack_port_t *p)
 
string clientNameFromPort (jack_port_id_t p)
 
string clientNameFromPort (jack_port_t *p)
 
string clientNameFromPortName (string fullPortName)
 
string clientNameFromPortNames (string fullPortName, string shortPortName)
 
string shortPortNameFromPortName (const string fullPortName)
 
bool operator== (const string &cn)
 
int getInputPortSize ()
 
jack_port_t * getInputPort (int i)
 
jack_port_t * getOutputPort (int i)
 
void addInputPort (jack_port_t *inP)
 
void addOutputPort (jack_port_t *outP)
 
int populatInOutPorts (const string &inName, vector< string > &inPorts, const string &outName, vector< string > &outPorts)
 
int connectPorts (const string inName, const string outName)
 
virtual int disconnectPorts (const string &inName, const string &outName)
 
void setClient (jack_client_t *c)
 

Public Attributes

bool connect1To1
 When true, then connections are made in a 1 to 1 manner. When False, then connections are made in an all to all manner. More...
 

Protected Member Functions

virtual void determineLatencies ()
 
int getPortListAndCount (JackPortFlags flags, vector< jack_port_t *> *ports, const char *portNamePattern, const char *typeNamePattern)
 
int getPortListAndCount (JackPortFlags flags, vector< string > *ports, const char *portNamePattern, const char *typeNamePattern)
 
virtual void reSyncPorts (void)
 
virtual void reSyncConnections (void)
 

Protected Attributes

jack_client_t * client
 The jack client. More...
 
string clientName
 The name of this client. More...
 
jack_options_t jackOptions
 Options for jack. More...
 
jack_status_t status
 The status of jack. More...
 
int physicalInputPortCnt
 The number of physical input ports. More...
 
int physicalOutputPortCnt
 The number of physical input ports. More...
 
vector< jack_port_t * > inputPorts
 The input ports. More...
 
vector< jack_port_t * > outputPorts
 The output ports. More...
 
vector< jack_nframes_t > inputLatencies
 The input latencies, one for each port. More...
 
vector< jack_nframes_t > outputLatencies
 The output latencies, one for each port. More...
 

Private Member Functions

void init ()
 
void clearPorts ()
 

Detailed Description

Base for Jack classes. Minimal knowledge of port handling.

Definition at line 89 of file JackBase.H.

Constructor & Destructor Documentation

◆ JackBase() [1/3]

JackBase::JackBase ( )
inline

Constructor.

Definition at line 212 of file JackBase.H.

◆ JackBase() [2/3]

JackBase::JackBase ( string  clientName_)
inline

Constructor. Connecting the client to the default server.

Parameters
clientName_The client name, which will initiate a server connection.

Definition at line 219 of file JackBase.H.

Here is the call graph for this function:

◆ JackBase() [3/3]

JackBase::JackBase ( string  clientName_,
string  serverName 
)
inline

Constructor. Connecting the client to a particular server.

Parameters
clientName_The client name, which will initiate a server connection.
serverNameThe server to connect to.

Definition at line 233 of file JackBase.H.

◆ ~JackBase()

virtual JackBase::~JackBase ( )
inlinevirtual

Destructor.

Definition at line 239 of file JackBase.H.

Member Function Documentation

◆ addInputPort()

void JackBase::addInputPort ( jack_port_t *  inP)
inline

Add an input port to the list of known input ports.

Parameters
inPThe port to add.

Definition at line 545 of file JackBase.H.

Here is the caller graph for this function:

◆ addOutputPort()

void JackBase::addOutputPort ( jack_port_t *  outP)
inline

Add an output port to the list of known output ports.

Parameters
inPThe port to add.

Definition at line 552 of file JackBase.H.

Here is the caller graph for this function:

◆ clearPorts()

void JackBase::clearPorts ( )
inlineprivate

Clear all port knowledge and latency knowledge.

Definition at line 100 of file JackBase.H.

◆ clientNameFromPort() [1/2]

string JackBase::clientNameFromPort ( jack_port_id_t  p)
inline

Given a port id, extract the client name.

Parameters
pThe port id to find the client name from.
Returns
the client name (initial portion) of the port name.

Definition at line 470 of file JackBase.H.

Here is the caller graph for this function:

◆ clientNameFromPort() [2/2]

string JackBase::clientNameFromPort ( jack_port_t *  p)
inline

Given a port, extract the client name.

Parameters
pThe port to find the client name from.
Returns
the client name (initial portion) of the port name.

Definition at line 481 of file JackBase.H.

◆ clientNameFromPortName()

string JackBase::clientNameFromPortName ( string  fullPortName)
inline

Given a full port name, extract the client name.

Parameters
fullPortNameThe client:port name convention.
Returns
the client name (initial portion) of the port name.

Definition at line 489 of file JackBase.H.

Here is the caller graph for this function:

◆ clientNameFromPortNames()

string JackBase::clientNameFromPortNames ( string  fullPortName,
string  shortPortName 
)
inline

Given a full port name and the short port name (the port name without the client portion), extract the client name.

Parameters
fullPortNameThe client:port name convention.
shortPortNameThe port name.
Returns
the client name (initial portion) of the port name.

Definition at line 498 of file JackBase.H.

◆ connect() [1/2]

virtual int JackBase::connect ( string  clientName_)
inlinevirtual

Connect to the server This starts the server and sets up the process callback/arg to use.

Parameters
clientName_The name of the client to use
Returns
NO_ERROR on success

Reimplemented in JackClient, and JackPortMonitor.

Definition at line 369 of file JackBase.H.

Here is the caller graph for this function:

◆ connect() [2/2]

virtual int JackBase::connect ( const string &  clientName_,
const string &  serverName 
)
inlinevirtual

Connect to the server This starts the server and sets up the process callback/arg to use.

Parameters
clientName_The name of the client to use
serverNameThe name of the server to use
Returns
NO_ERROR on success

Reimplemented in JackClient, and JackPortMonitor.

Definition at line 379 of file JackBase.H.

◆ connected()

bool JackBase::connected ( )
inline

Find out if we are connected to a server.

Returns
true if connected to a server, false if not connected.

Definition at line 358 of file JackBase.H.

◆ connectPorts()

int JackBase::connectPorts ( const string  inName,
const string  outName 
)
inline

Connect ports together which are given by name. If the names have ':' in them, then they are of the client:port form and can be directly connected together. If one name has no ':' in it, then connect to all of it's ports. If both names have no ':' in them, then map ports one to one until one client runs out of ports.

Parameters
inNameThe input port name
outNameThe output port name
Returns
0 on success, <0 on error.

Definition at line 591 of file JackBase.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPorts()

virtual int JackBase::createPorts ( string  inName,
int  inCnt,
string  outName,
int  outCnt 
)
inlinevirtual

Create the client's ports

Parameters
inNameThe input port base name to use
inCntThe number of ports to create
outNameThe output port base name to use
outCntThe number of output ports to create
Examples:
JackClientTest.C.

Definition at line 277 of file JackBase.H.

Here is the caller graph for this function:

◆ destroyPorts()

virtual int JackBase::destroyPorts ( )
inlinevirtual

Destroy all ports.

Returns
NO_ERROR on success

Definition at line 306 of file JackBase.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ determineLatencies()

virtual void JackBase::determineLatencies ( )
inlineprotectedvirtual

Determine the capture and playback latencies. These latencies are defined by Jack as :

Capture latency : how long since the data read from the buffer of a port arrived at at a port marked with JackPortIsTerminal. The data will have come from the "outside world" if the terminal port is also marked with JackPortIsPhysical, or will have been synthesized by the client that owns the terminal port.

Playback latency : how long until the data written to the buffer of port will reach a port marked with JackPortIsTerminal.

Definition at line 130 of file JackBase.H.

◆ disconnect()

virtual int JackBase::disconnect ( void  )
inlinevirtual

Stop the client running

Returns
0 on no error, or JACK_CLOSE_CLIENT_ERROR on failure

Reimplemented in JackPortMonitor.

Definition at line 254 of file JackBase.H.

Here is the caller graph for this function:

◆ disconnectPorts()

virtual int JackBase::disconnectPorts ( const string &  inName,
const string &  outName 
)
inlinevirtual

Disconnect ports which are given by name. If the names have ':' in them, then they are of the client:port form and can be directly disconnected. If one name has no ':' in it, then disconnect all of it's ports. If both names have no ':' in them, then disconnect ports one to one.

Parameters
inNameThe input port name
outNameThe output port name
Returns
0 on success, <0 on error.

Definition at line 629 of file JackBase.H.

Here is the call graph for this function:

◆ getClientName()

string JackBase::getClientName ( )
inline

Get the client name.

Returns
the client name.

Definition at line 436 of file JackBase.H.

Here is the caller graph for this function:

◆ getInputPort()

jack_port_t* JackBase::getInputPort ( int  i)
inline

Get an input port.

Parameters
iThe input port to retrieve.
Returns
NULL on failure, otherwise the port.

Definition at line 526 of file JackBase.H.

◆ getInputPortSize()

int JackBase::getInputPortSize ( )
inline

Get the number of input ports.

Returns
the number of input ports.

Definition at line 518 of file JackBase.H.

◆ getOutputPort()

jack_port_t* JackBase::getOutputPort ( int  i)
inline

Get an output port.

Parameters
iThe input port to retrieve.
Returns
NULL on failure, otherwise the port.

Definition at line 536 of file JackBase.H.

◆ getPhysicalPortCount()

void JackBase::getPhysicalPortCount ( int &  in,
int &  out 
)
inline

Find out how many physical input and outputs ports are present.

Parameters
[out]inThe number of input ports.
[out]outThe number of output ports.

Definition at line 344 of file JackBase.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPhysicalPorts()

void JackBase::getPhysicalPorts ( vector< jack_port_t *> &  inPorts,
vector< jack_port_t *> &  outPorts 
)
inline

Find out how many physical input and outputs ports are present.

Parameters
[out]inThe number of input ports.
[out]outThe number of output ports.

Definition at line 330 of file JackBase.H.

Here is the call graph for this function:

◆ getPortListAndCount() [1/2]

int JackBase::getPortListAndCount ( JackPortFlags  flags,
vector< jack_port_t *> *  ports,
const char *  portNamePattern,
const char *  typeNamePattern 
)
inlineprotected

Get the port list and the number of ports.

Parameters
flags,theJackPortFlags {JackPortIsOutput, JackPortIsPhysical, JackPortCanMonitor, JackPortIsTerminal}.
portsThe port vector to be returned, null if not to be populated.
portNamePatternname pattern to match when searching for ports.
typeNamePatterntype name pattern to match when searching for ports.
Returns
>=0 representing the number of ports or <0 on error.

Definition at line 159 of file JackBase.H.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPortListAndCount() [2/2]

int JackBase::getPortListAndCount ( JackPortFlags  flags,
vector< string > *  ports,
const char *  portNamePattern,
const char *  typeNamePattern 
)
inlineprotected

Get the port name list and the number of ports.

Parameters
flags,theJackPortFlags {JackPortIsOutput, JackPortIsPhysical, JackPortCanMonitor, JackPortIsTerminal}.
portsThe port vector to be returned, null if not to be populated.
portNamePatternname pattern to match when searching for ports.
typeNamePatterntype name pattern to match when searching for ports.
Returns
>=0 representing the number of ports or <0 on error.

Definition at line 179 of file JackBase.H.

Here is the call graph for this function:

◆ getSampleRate()

int JackBase::getSampleRate ( void  ) const
inline

Get the server samplerate

Returns
the current sample rate
Examples:
JackClientTest.C.

Definition at line 266 of file JackBase.H.

Here is the caller graph for this function:

◆ init()

void JackBase::init ( void  )
inlineprivate

Common intialiser.

Definition at line 92 of file JackBase.H.

Here is the caller graph for this function:

◆ operator==()

bool JackBase::operator== ( const string &  cn)
inline

Test if the JackBase::clientName equals a string.

Parameters
cnThe string to compare to.

Definition at line 511 of file JackBase.H.

◆ populatInOutPorts()

int JackBase::populatInOutPorts ( const string &  inName,
vector< string > &  inPorts,
const string &  outName,
vector< string > &  outPorts 
)
inline

Given an input name and an output name, of either form, "ClientName" or "ClientName:PortName", populate a vector of strings matching all of the possible ports.

Parameters
inNameThe input port name
inPortsA vector of strings naming all of the ports found matching the inName.
outNameThe output port name
outPortsA vector of strings naming all of the ports found matching the outName.
Returns
NO_ERROR on success, otherwise the appropriate error number.
See also
connectPorts, disConnectPorts

Definition at line 564 of file JackBase.H.

Here is the call graph for this function:

◆ portNameFromPort() [1/2]

string JackBase::portNameFromPort ( jack_port_id_t  p)
inline

Given a port id, extract the port name.

Parameters
pThe port id to find the client name from.
Returns
the port name (final portion) of the full port name.

Definition at line 451 of file JackBase.H.

◆ portNameFromPort() [2/2]

string JackBase::portNameFromPort ( jack_port_t *  p)
inline

Given a port id, extract the port name.

Parameters
pThe port to find the client name from.
Returns
the port name (final portion) of the full port name.

Definition at line 462 of file JackBase.H.

◆ print()

virtual void JackBase::print ( ostream &  os)
inlinevirtual

Print ports and clients.

Parameters
osThe output stream to print to.

Reimplemented in JackPortMonitor.

Definition at line 418 of file JackBase.H.

◆ reSyncConnections()

virtual void JackBase::reSyncConnections ( void  )
inlineprotectedvirtual

Find all input and output ports which aren't already in the port list.

Reimplemented in JackPortMonitorGui, and JackPortMonitor.

Definition at line 203 of file JackBase.H.

◆ reSyncPorts()

virtual void JackBase::reSyncPorts ( void  )
inlineprotectedvirtual

Find all physical input and output ports.

Reimplemented in JackPortMonitorGui, and JackPortMonitor.

Definition at line 196 of file JackBase.H.

Here is the caller graph for this function:

◆ setClient()

void JackBase::setClient ( jack_client_t *  c)
inline

Method to set the client.

Parameters
cThe client to set

Definition at line 651 of file JackBase.H.

Here is the caller graph for this function:

◆ setClientName()

virtual void JackBase::setClientName ( string  cn)
inlinevirtual

Set the client name.

Parameters
theclient name.

Definition at line 443 of file JackBase.H.

Here is the caller graph for this function:

◆ shortPortNameFromPortName()

string JackBase::shortPortNameFromPortName ( const string  fullPortName)
inline

Definition at line 503 of file JackBase.H.

◆ stopClient()

virtual int JackBase::stopClient ( void  )
inlinevirtual

Stop the client running

Returns
0 on no error, or JACK_CLOSE_CLIENT_ERROR on failure

Definition at line 244 of file JackBase.H.

Member Data Documentation

◆ client

jack_client_t* JackBase::client
protected

The jack client.

Definition at line 108 of file JackBase.H.

◆ clientName

string JackBase::clientName
protected

The name of this client.

Definition at line 109 of file JackBase.H.

◆ connect1To1

bool JackBase::connect1To1

When true, then connections are made in a 1 to 1 manner. When False, then connections are made in an all to all manner.

Definition at line 208 of file JackBase.H.

◆ inputLatencies

vector<jack_nframes_t> JackBase::inputLatencies
protected

The input latencies, one for each port.

Definition at line 121 of file JackBase.H.

◆ inputPorts

vector<jack_port_t *> JackBase::inputPorts
protected

The input ports.

Definition at line 118 of file JackBase.H.

◆ jackOptions

jack_options_t JackBase::jackOptions
protected

Options for jack.

Definition at line 112 of file JackBase.H.

◆ outputLatencies

vector<jack_nframes_t> JackBase::outputLatencies
protected

The output latencies, one for each port.

Definition at line 122 of file JackBase.H.

◆ outputPorts

vector<jack_port_t *> JackBase::outputPorts
protected

The output ports.

Definition at line 119 of file JackBase.H.

◆ physicalInputPortCnt

int JackBase::physicalInputPortCnt
protected

The number of physical input ports.

Definition at line 115 of file JackBase.H.

◆ physicalOutputPortCnt

int JackBase::physicalOutputPortCnt
protected

The number of physical input ports.

Definition at line 116 of file JackBase.H.

◆ status

jack_status_t JackBase::status
protected

The status of jack.

Definition at line 113 of file JackBase.H.


The documentation for this class was generated from the following file:
gtkIOStream: JackBase Class Reference
GTK+ IOStream  Beta