Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members

MClient Class Reference

An abstract client module. More...

#include <MClient.h>

Inheritance diagram for MClient:

MModule MSupervisor MUserClient List of all members.

Public Slots

virtual void Activate ()
virtual void Deactivate ()
virtual void Run (const unsigned int n)

Public Member Functions

virtual ~MClient ()
virtual jack_client_t * JACKHandle () const
virtual MProcessCallback () const
virtual MClientAudioInputPortAudioInput (const unsigned int n) const
virtual MClientAudioOutputPortAudioOutput (const unsigned int n) const
virtual MClientControlInputPortControlInput (const unsigned int n) const
virtual MClientControlOutputPortControlOutput (const unsigned int n) const
virtual MAudioInputPortModuleAudioInput (const unsigned int n) const
virtual MAudioOutputPortModuleAudioOutput (const unsigned int n) const
virtual MControlInputPortModuleControlInput (const unsigned int n) const
virtual MControlOutputPortModuleControlOutput (const unsigned int n) const
virtual unsigned int NumberOfAudioInputs () const
virtual unsigned int NumberOfAudioOutputs () const
virtual unsigned int NumberOfControlInputs () const
virtual unsigned int NumberOfControlOutputs () const
virtual void ResetInputs ()

Protected Member Functions

 MClient (const string &name, jack_client_t *jackClient, QObject *parent=0)
virtual MClientAudioInputPortcreateAudioInput (const string &portName)
virtual MClientAudioOutputPortcreateAudioOutput (const string &portName)
virtual MClientAudioInputPortaddAudioInput (jack_port_t *jackPort)
virtual MClientAudioOutputPortaddAudioOutput (jack_port_t *jackPort)
virtual void removePort (MPort *port)
virtual void setCallbackProcess (MProcess *callback)
virtual void removeCallbackProcess ()

Static Protected Member Functions

static jack_client_t * createJackClient (const string &name)

Protected Attributes

jack_client_t * _jack_client
MProcess_callback
vector< MClientAudioInputPort * > _audioInput
vector< MClientAudioOutputPort * > _audioOutput
vector< MClientControlInputPort * > _controlInput
vector< MClientControlOutputPort * > _controlOutput

Detailed Description

This is a wrapper to a JACK client.

A concrete client can be created in both ways :

The function that will be used as a callback by the JACK server for this client will be the MProcess::Run( const unsigned int n ) of the _callback member of this object.


Constructor & Destructor Documentation

MClient::~MClient  )  [virtual]
 

Destructor.

  • closes the jack client
  • does not delete the MProcess _callback process of the client
  • deletes the MClientPort ports of the client

MClient::MClient const string &  name,
jack_client_t *  jackClient,
QObject *  parent = 0
[protected]
 

Creates a client module corresponding to the JACK client jackClient.

Precondition:
name.size( ) > 0
Postcondition:
! IsActive( )

Member Function Documentation

jack_client_t * MClient::JACKHandle  )  const [virtual]
 

The jack_client_t handler of the JACK client corresponding to this client.

MProcess * MClient::Callback  )  const [virtual]
 

The MProcess uses as callback process for the client.

MClientAudioInputPort * MClient::AudioInput const unsigned int  n  )  const [virtual]
 

The nth audio input port ( MClientAudioInputPort ) of the client.

Precondition:
n < NumberOfAudioInputs( )
Postcondition:
result != NULL

MClientAudioOutputPort * MClient::AudioOutput const unsigned int  n  )  const [virtual]
 

The nth audio output port ( MClientAudioOutputPort ) of the client.

Precondition:
n < NumberOfAudioOutputs( )
Postcondition:
result != NULL

MClientControlInputPort * MClient::ControlInput const unsigned int  n  )  const [virtual]
 

The nth control input port ( MClientControlInputPort ) of the client.

Precondition:
n < NumberOfControlInputs( )
Postcondition:
result != NULL

MClientControlOutputPort * MClient::ControlOutput const unsigned int  n  )  const [virtual]
 

The nth control output port ( MClientControlOutputPort ) of the client.

Precondition:
n < NumberOfControlOutputs( )
Postcondition:
result != NULL

MAudioInputPort * MClient::ModuleAudioInput const unsigned int  n  )  const [virtual]
 

The nth audio input port ( MAudioInputPort ) of the module.

Precondition:
n < NumberOfAudioInputs( )
Postcondition:
result != NULL

Implements MModule.

MAudioOutputPort * MClient::ModuleAudioOutput const unsigned int  n  )  const [virtual]
 

The nth audio output port ( MAudioOutputPort ) of the module.

Precondition:
n < NumberOfAudioOutputs( )
Postcondition:
result != NULL

Implements MModule.

MControlInputPort * MClient::ModuleControlInput const unsigned int  n  )  const [virtual]
 

The nth control input port ( MControlInputPort ) of the module.

Precondition:
n < NumberOfControlInputs( )
Postcondition:
result != NULL

Implements MModule.

MControlOutputPort * MClient::ModuleControlOutput const unsigned int  n  )  const [virtual]
 

The nth control output port ( MControlOutputPort ) of the module.

Precondition:
n < NumberOfControlOutputs( )
Postcondition:
result != NULL

Implements MModule.

unsigned int MClient::NumberOfAudioInputs  )  const [virtual]
 

The number of audio input ports ( MClientAudioInputPort ) of the client.

Implements MModule.

unsigned int MClient::NumberOfAudioOutputs  )  const [virtual]
 

The number of audio output ports ( MClientAudioOutputPort ) of the client.

Implements MModule.

unsigned int MClient::NumberOfControlInputs  )  const [virtual]
 

The number of control input ports ( MClientControlInputPort ) of the client.

Implements MModule.

unsigned int MClient::NumberOfControlOutputs  )  const [virtual]
 

The number of control output ports ( MClientControlOutputPort ) of the client.

Implements MModule.

void MClient::ResetInputs  )  [virtual]
 

Resets all the audio inputs.

The audio input ports won't be considered as calculated anymore (

See also:
MClientAudioInputPort::IsCalculated ( ) ). This is done automatically at the beginning of the callback and you won't need to use it.

void MClient::Activate  )  [virtual, slot]
 

Try to activate the module.

At the end of the method, if the module has been activated IsActive( ) should return TRUE and if the module has not been activated IsActive( ) should return FALSE.

Precondition:
! IsActive( )

Implements MModule.

void MClient::Deactivate  )  [virtual, slot]
 

Try to deactivate the module.

At the end of the method, if the module has been deactivated IsActive( ) should return FALSE and if the module has not been deactivated IsActive( ) should return TRUE.

Precondition:
IsActive( )

Implements MModule.

void MClient::Run const unsigned int  n  )  [virtual, slot]
 

Run the module.

Ask the module to proceed a block of audio data.

If the client is run without a callback process ( _callback is NULL ) the callback just won't do anything.

Parameters:
n Indicates the size of the block.
Precondition:
IsActive( )
Postcondition:
IsActive( )

Implements MModule.

Reimplemented in MSupervisor.

jack_client_t * MClient::createJackClient const string &  name  )  [static, protected]
 

Creates a new JACK client.

Precondition:
name.size( ) > 0
Parameters:
name The name of the client to create. If the name is already used ( e.g by the same application already running once ), we will try to create a client named name + _pid, with pid : the pid of this application. This allows you to start multiple times the same application without doing anything special.
Returns:
A pointer to the JACK handle of the new client or NULL if the creation failed. If the creation failed, this might be because the JACK server is not running or because the proposed name is already taken by another client.

MClientAudioInputPort * MClient::createAudioInput const string &  portName  )  [protected, virtual]
 

Creates a new audio input port for this client.

Creates a new jack_port called portName in the _jack_client. Then creates a corresponding MClientAudioInputPort and add it to the MClient.

Precondition:
GetPortByName( name ) == NULL
Postcondition:
GetPortByName( name )->Name( ) == portName

GetPortByName( name )->IsAudio( ) == TRUE

GetPortByName( name )->IsInput( ) == TRUE

MClientAudioOutputPort * MClient::createAudioOutput const string &  portName  )  [protected, virtual]
 

Creates a new audio output port for this client.

Creates a new jack_port called portNam in the _jack_client. Then creates a corresponding MClientAudioOutputPort and add it to the MClient.

Precondition:
GetPortByName( name ) == NULL
Postcondition:
GetPortByName( name )->Name( ) == portName

GetPortByName( name )->IsAudio( ) == TRUE

GetPortByName( name )->IsOutput( ) == TRUE

MClientAudioInputPort * MClient::addAudioInput jack_port_t *  jackPort  )  [protected, virtual]
 

Adds an existing jack_port_t to this MClient.

Creates a MClientAudioInputPort corresponding to jackPort in to the MClient.

Precondition:
jack_port_is_mine ( _jack_client, jackPort )
Postcondition:
IsMine( newPort )
Note:
To actually create a port, use the createAudioInput( const string & portName ) function.

MClientAudioOutputPort * MClient::addAudioOutput jack_port_t *  jackPort  )  [protected, virtual]
 

Adds an existing jack_port_t to this MClient.

Creates a MClientAudioOutputPort corresponding to jackPort in to the MClient.

Precondition:
jack_port_is_mine ( _jack_client, jackPort )
Postcondition:
IsMine( newPort )
Note:
To actually create a port, use the createAudioOutput( const string & portName ) function.

void MClient::removePort MPort port  )  [protected, virtual]
 

Removes a port.

Deletes the jack_port_t from _jack_client and removes it from the MClient ports' list.

Precondition:
IsMine( port )
Postcondition:
! IsMine( port )

void MClient::setCallbackProcess MProcess callback  )  [protected, virtual]
 

Sets the callback process.

Changes the callback process of the MClient to callback.

Precondition:
callback != NULL
Postcondition:
Callback( ) == callback

void MClient::removeCallbackProcess  )  [protected, virtual]
 

Removes the callback process of the MClient.

Postcondition:
Callback( ) == NULL

Member Data Documentation

jack_client_t* MClient::_jack_client [protected]
 

The actual jack_client_t.

MProcess* MClient::_callback [protected]
 

The callback process.

vector< MClientAudioInputPort * > MClient::_audioInput [protected]
 

The audio input ports.

vector< MClientAudioOutputPort * > MClient::_audioOutput [protected]
 

The audio output ports.

vector< MClientControlInputPort * > MClient::_controlInput [protected]
 

The control input ports.

vector< MClientControlOutputPort * > MClient::_controlOutput [protected]
 

The control output ports.


The documentation for this class was generated from the following files:
Generated on Mon Jan 31 12:43:31 2005 for la Marmite by Doxygen 1.4.1