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

#include <JackPortMonitor.H>

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

Classes

struct  CompareStrings
 

Public Member Functions

 JackPortMonitor ()
 
 JackPortMonitor (bool monitorPorts)
 
 JackPortMonitor (bool monitorPorts, bool autoConnectNetClientsIn)
 
 JackPortMonitor (string clientName_)
 
 JackPortMonitor (string clientName_, bool monitorPorts)
 
 JackPortMonitor (string clientName_, bool monitorPorts, bool autoConnectNetClientsIn)
 
 JackPortMonitor (string clientName_, string serverName)
 
 JackPortMonitor (string clientName_, string serverName, bool monitorPorts)
 
 JackPortMonitor (string clientName_, string serverName, bool monitorPorts, bool autoConnectNetClients)
 
 JackPortMonitor (JackBase &jb)
 
virtual ~JackPortMonitor ()
 Destructor. More...
 
virtual void print (ostream &os)
 
void connectPortRenameCallback (void)
 
void connectPortRegistrationCallback (void)
 
void connectPortConnectCallback (void)
 
- Public Member Functions inherited from JackBase
 JackBase ()
 
 JackBase (string clientName_)
 
 JackBase (string clientName_, string serverName)
 
virtual ~JackBase ()
 Destructor. More...
 
virtual int stopClient (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 ()
 
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 Member Functions inherited from WaitingThread
virtual ~WaitingThread (void)
 
- Public Member Functions inherited from ThreadedMethod
virtual int run (int priority=0)
 
- Public Member Functions inherited from Thread
 Thread (void)
 
virtual ~Thread (void)
 
void * stop (void)
 
int run (void *(*start_routine)(void *), void *data, int priority=0)
 
int setPriority (pthread_attr_t *attributes, int priority)
 
int getPriority ()
 
void * meetThread (void)
 
void exit (void *retVal)
 
bool running ()
 

Protected Member Functions

virtual void autoConnectNetClientsPorts (void)
 
virtual void reSyncPorts (void)
 
virtual void reSyncConnections (void)
 
virtual void jackPortConnected (jack_port_id_t a, jack_port_id_t b, int connect)
 
virtual void jackPortRegistered (jack_port_id_t port, int reg)
 
virtual void jackPortRenamed (jack_port_id_t port, const char *oldName, const char *newName)
 
- Protected Member Functions inherited from JackBase
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)
 

Protected Attributes

vector< JackBaseWithPortNames * > knownClients
 A vector of clients and their ports both ids and names. More...
 
bool autoConnectNetClients
 When true, autoconnect networked client's ports to the system ports. More...
 
- Protected Attributes inherited from JackBase
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 (bool monitorPorts)
 
void init (bool monitorPorts, bool autoConnectNetClientsIn)
 
void connectPortMonitoringCallbacks (void)
 
virtual void breakDownPortsToClients (vector< jack_port_t *> &ports)
 
void reSyncPorts (JackPortFlags flags)
 
virtual int disconnect (void)
 
virtual int connect (string clientName_)
 
virtual int connect (const string &clientName_, const string &serverName)
 
virtual void * threadMain (void)
 

Static Private Member Functions

static void jackPortConnectCallback (jack_port_id_t a, jack_port_id_t b, int connect, void *arg)
 
static void jackPortRegistrationCallback (jack_port_id_t port, int reg, void *arg)
 
static void jackPortRenameCallback (jack_port_id_t port, const char *oldName, const char *newName, void *arg)
 

Additional Inherited Members

- Public Attributes inherited from JackBase
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...
 
- Public Attributes inherited from WaitingThread
Cond cond
 

Detailed Description

Maintains knowledge of jack ports. Operates by reconstructing clients to hold only their ports in the knownClients member variable. The list of physical ports are maintained first. Provides methods for connection, disconnection and monitoring.

NOTE: This class requires linking against the gtkIOStream library.

Definition at line 34 of file JackPortMonitor.H.

Constructor & Destructor Documentation

◆ JackPortMonitor() [1/10]

JackPortMonitor::JackPortMonitor ( )

Constructor. Doesn't connect the jack client. By default monitors ports.

Definition at line 181 of file JackPortMonitor.C.

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

◆ JackPortMonitor() [2/10]

JackPortMonitor::JackPortMonitor ( bool  monitorPorts)

Constructor. Doesn't connect the jack client.

Parameters
monitorPortsTrue if port monitoring callbacks are connected, false and ports aren't monitored.

Definition at line 186 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ JackPortMonitor() [3/10]

JackPortMonitor::JackPortMonitor ( bool  monitorPorts,
bool  autoConnectNetClientsIn 
)

Constructor. Doesn't connect the jack client.

Parameters
monitorPortsTrue if port monitoring callbacks are connected, false and ports aren't monitored.
autoConnectNetClientsInIf true, autoconnect network clients.

Definition at line 190 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ JackPortMonitor() [4/10]

JackPortMonitor::JackPortMonitor ( string  clientName_)

Constructor. Connecting the client to the default server. By default monitors ports.

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

Definition at line 194 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ JackPortMonitor() [5/10]

JackPortMonitor::JackPortMonitor ( string  clientName_,
bool  monitorPorts 
)

Constructor. Connecting the client to the default server.

Parameters
clientName_The client name, which will initiate a server connection.
monitorPortsTrue if port monitoring callbacks are connected, false and ports aren't monitored.

Definition at line 199 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ JackPortMonitor() [6/10]

JackPortMonitor::JackPortMonitor ( string  clientName_,
bool  monitorPorts,
bool  autoConnectNetClientsIn 
)

Constructor. Connecting the client to the default server.

Parameters
clientName_The client name, which will initiate a server connection.
monitorPortsTrue if port monitoring callbacks are connected, false and ports aren't monitored.
autoConnectNetClientsInIf true, autoconnect network clients.

Definition at line 203 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ JackPortMonitor() [7/10]

JackPortMonitor::JackPortMonitor ( string  clientName_,
string  serverName 
)

Constructor. Connecting the client to a particular server. By default monitors ports.

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

Definition at line 208 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ JackPortMonitor() [8/10]

JackPortMonitor::JackPortMonitor ( string  clientName_,
string  serverName,
bool  monitorPorts 
)

Constructor. Connecting the client to a particular server.

Parameters
clientName_The client name, which will initiate a server connection.
serverNameThe server to connect to.
monitorPortsIf true, then monitor changes to the prots and connections.

Definition at line 213 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ JackPortMonitor() [9/10]

JackPortMonitor::JackPortMonitor ( string  clientName_,
string  serverName,
bool  monitorPorts,
bool  autoConnectNetClients 
)

Constructor. Connecting the client to a particular server.

Parameters
clientName_The client name, which will initiate a server connection.
serverNameThe server to connect to.
monitorPortsIf true, then monitor changes to the prots and connections.
autoConnectNetClientsInIf true, autoconnect network clients.

Definition at line 217 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ JackPortMonitor() [10/10]

JackPortMonitor::JackPortMonitor ( JackBase jb)

This constructor does no setup nor port monitoring. No connections to servers or port monitoring are setup.

Parameters
jbThe instance of a JackBase object to

Definition at line 221 of file JackPortMonitor.C.

◆ ~JackPortMonitor()

virtual JackPortMonitor::~JackPortMonitor ( )
inlinevirtual

Destructor.

Definition at line 265 of file JackPortMonitor.H.

Here is the call graph for this function:

Member Function Documentation

◆ autoConnectNetClientsPorts()

void JackPortMonitor::autoConnectNetClientsPorts ( void  )
protectedvirtual

Find net client's ports and autoconnect them to system ports.

Definition at line 55 of file JackPortMonitor.C.

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

◆ breakDownPortsToClients()

void JackPortMonitor::breakDownPortsToClients ( vector< jack_port_t *> &  ports)
privatevirtual

Given a list of ports, associate each port with the client it belongs to. If the client doesn't exist, then create the client.

Parameters
portsThe vector of port ids to associate.

Definition at line 115 of file JackPortMonitor.C.

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

◆ connect() [1/2]

virtual int JackPortMonitor::connect ( string  clientName_)
inlineprivatevirtual

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 from JackBase.

Definition at line 109 of file JackPortMonitor.H.

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

◆ connect() [2/2]

int JackPortMonitor::connect ( const string &  clientName_,
const string &  serverName 
)
privatevirtual

Connect to the server. This starts the server and sets up the process callback/arg to use. When the client starts running and is set, reset all known client's client pointers.

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

Reimplemented from JackBase.

Definition at line 48 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ connectPortConnectCallback()

void JackPortMonitor::connectPortConnectCallback ( void  )

Connect the jackPortConnected method for callback. This can be done automatically at class construction time.

Definition at line 110 of file JackPortMonitor.C.

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

◆ connectPortMonitoringCallbacks()

void JackPortMonitor::connectPortMonitoringCallbacks ( void  )
private

Connect callbacks to execute when ports change in any way.

Definition at line 91 of file JackPortMonitor.C.

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

◆ connectPortRegistrationCallback()

void JackPortMonitor::connectPortRegistrationCallback ( void  )

Connect the jackPortRegistered method for callback. This can be done automatically at class construction time.

Definition at line 105 of file JackPortMonitor.C.

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

◆ connectPortRenameCallback()

void JackPortMonitor::connectPortRenameCallback ( void  )

Connect the jackPortRenamed method for callback. This can be done automatically at class construction time.

Definition at line 100 of file JackPortMonitor.C.

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

◆ disconnect()

int JackPortMonitor::disconnect ( void  )
privatevirtual

Stop the client running. When the client stops running and is set to NULL, reset all known client's client pointers.

Returns
0 on no error, or JACK_CLOSE_CLIENT_ERROR on failure

Reimplemented from JackBase.

Definition at line 41 of file JackPortMonitor.C.

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

◆ init() [1/2]

void JackPortMonitor::init ( bool  monitorPorts)
private

Common intialiser.

Parameters
monitorPortsTrue if port monitoring callbacks are connected, false and ports aren't monitored.

Definition at line 19 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ init() [2/2]

void JackPortMonitor::init ( bool  monitorPorts,
bool  autoConnectNetClientsIn 
)
private

Common intialiser.

Parameters
monitorPortsTrue if port monitoring callbacks are connected, false and ports aren't monitored.
autoConnectNetClientsInIf true, autoconnect network clients.

Definition at line 23 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ jackPortConnectCallback()

static void JackPortMonitor::jackPortConnectCallback ( jack_port_id_t  a,
jack_port_id_t  b,
int  connect,
void *  arg 
)
inlinestaticprivate

Static callback to handle port connections and disconnections.

Parameters
aA port (dis)connected
bA port (dis)connected
connect0 for connection removed, connection made otherwise
argThe pointer to the instance of this class for which the callback was connected.

Definition at line 57 of file JackPortMonitor.H.

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

◆ jackPortConnected()

virtual void JackPortMonitor::jackPortConnected ( jack_port_id_t  a,
jack_port_id_t  b,
int  connect 
)
inlineprotectedvirtual

Method to handle the occasion where ports were connected or disconnected.

Parameters
aA port (dis)connected
bA port (dis)connected
connect0 for connection removed, connection made otherwise

Reimplemented in JackPortMonitorGui.

Definition at line 166 of file JackPortMonitor.H.

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

◆ jackPortRegistered()

virtual void JackPortMonitor::jackPortRegistered ( jack_port_id_t  port,
int  reg 
)
inlineprotectedvirtual

Method to handle to handle port registration or deregistration.

Parameters
portThe port which was (de)registered.
regZero if the port is deregistered, otherwise registration.

Reimplemented in JackPortMonitorGui.

Definition at line 175 of file JackPortMonitor.H.

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

◆ jackPortRegistrationCallback()

static void JackPortMonitor::jackPortRegistrationCallback ( jack_port_id_t  port,
int  reg,
void *  arg 
)
inlinestaticprivate

Static callback to handle port registration or deregistration.

Parameters
portThe port which was (de)registered.
regZero if the port is deregistered, otherwise registration.
argThe pointer to the instance of this class for which the callback was connected.

Definition at line 67 of file JackPortMonitor.H.

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

◆ jackPortRenameCallback()

static void JackPortMonitor::jackPortRenameCallback ( jack_port_id_t  port,
const char *  oldName,
const char *  newName,
void *  arg 
)
inlinestaticprivate

Static callback to handle port renaming.

Parameters
portThe port which was renamed.
oldNameThe original name of the port.
newNameThe new name of the port.
argThe pointer to the instance of this class for which the callback was connected.

Definition at line 78 of file JackPortMonitor.H.

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

◆ jackPortRenamed()

virtual void JackPortMonitor::jackPortRenamed ( jack_port_id_t  port,
const char *  oldName,
const char *  newName 
)
inlineprotectedvirtual

Method to handle port renaming.

Parameters
portThe port which was renamed.
oldNameThe original name of the port.
newNameThe new name of the port.

Reimplemented in JackPortMonitorGui.

Definition at line 193 of file JackPortMonitor.H.

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

◆ print()

void JackPortMonitor::print ( ostream &  os)
virtual

Print ports and clients. On a client by client basis.

Parameters
osThe output stream to print to.

Reimplemented from JackBase.

Definition at line 223 of file JackPortMonitor.C.

Here is the caller graph for this function:

◆ reSyncConnections()

void JackPortMonitor::reSyncConnections ( void  )
protectedvirtual

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

Reimplemented from JackBase.

Reimplemented in JackPortMonitorGui.

Definition at line 174 of file JackPortMonitor.C.

Here is the caller graph for this function:

◆ reSyncPorts() [1/2]

void JackPortMonitor::reSyncPorts ( JackPortFlags  flags)
private

Resynchronise either input or output ports. Find all physical ports first and then other ports. Using these ports, rebuild the client objects, breaking down ports to which client they belong to and whether they belong to the input or output set for that client.

Parameters
flagsEither JackPortIsInput or JackPortIsOutput, indicating whether we are looking for input or output ports.

Definition at line 140 of file JackPortMonitor.C.

Here is the call graph for this function:

◆ reSyncPorts() [2/2]

void JackPortMonitor::reSyncPorts ( void  )
protectedvirtual

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

Reimplemented from JackBase.

Reimplemented in JackPortMonitorGui.

Definition at line 158 of file JackPortMonitor.C.

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

◆ threadMain()

void * JackPortMonitor::threadMain ( void  )
privatevirtual

This threaded method waits for a signal to attempt to autoconnect netjack ports to the system ports.

Implements ThreadedMethod.

Definition at line 81 of file JackPortMonitor.C.

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

Member Data Documentation

◆ autoConnectNetClients

bool JackPortMonitor::autoConnectNetClients
protected

When true, autoconnect networked client's ports to the system ports.

Definition at line 147 of file JackPortMonitor.H.

◆ knownClients

vector<JackBaseWithPortNames *> JackPortMonitor::knownClients
protected

A vector of clients and their ports both ids and names.

Definition at line 145 of file JackPortMonitor.H.


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