drumstick  1.1.0
MidiClient Class Reference

Client management. More...

#include <alsaclient.h>

Inheritance diagram for MidiClient:

Classes

class  SequencerInputThread
 This class manages event input from the ALSA sequencer. More...
 

Signals

void eventReceived (SequencerEvent *ev)
 Signal emitted when an event is received.
 

Public Member Functions

 MidiClient (QObject *parent=0)
 Constructor. More...
 
virtual ~MidiClient ()
 Destructor. More...
 
void open (const QString deviceName="default", const int openMode=SND_SEQ_OPEN_DUPLEX, const bool blockMode=false)
 Open the sequencer device. More...
 
void open (snd_config_t *conf, const QString deviceName="default", const int openMode=SND_SEQ_OPEN_DUPLEX, const bool blockMode=false)
 Open the sequencer device, providing a configuration object pointer. More...
 
void close ()
 Close the sequencer device. More...
 
void startSequencerInput ()
 Starts reading events from the ALSA sequencer.
 
void stopSequencerInput ()
 Stops reading events from the ALSA sequencer.
 
MidiPortcreatePort ()
 Create and attach a new MidiPort instance to this client. More...
 
MidiQueuecreateQueue ()
 Create and return a new MidiQueue associated to this client. More...
 
MidiQueuecreateQueue (QString const &name)
 Create and return a new MidiQueue with the given name, associated to this client. More...
 
MidiQueuegetQueue ()
 Get the MidiQueue instance associated to this client. More...
 
MidiQueueuseQueue (int queue_id)
 Create a new MidiQueue instance using a queue already existing in the system, associating it to the client. More...
 
MidiQueueuseQueue (const QString &name)
 Create a new MidiQueue instance using a queue already existing in the system, associating it to the client. More...
 
MidiQueueuseQueue (MidiQueue *queue)
 Associate an existing MidiQueue instance to the client. More...
 
void portAttach (MidiPort *port)
 Attach a MidiPort instance to this client. More...
 
void portDetach (MidiPort *port)
 Detach a MidiPort instance from this client. More...
 
void detachAllPorts ()
 Detach all the ports belonging to this client.
 
void addEventFilter (int evtype)
 Add an event filter to the client. More...
 
void output (SequencerEvent *ev, bool async=false, int timeout=-1)
 Output an event using the library output buffer. More...
 
void outputDirect (SequencerEvent *ev, bool async=false, int timeout=-1)
 Output an event directly to the sequencer. More...
 
void outputBuffer (SequencerEvent *ev)
 Output an event using the library output buffer, without draining the buffer. More...
 
void drainOutput (bool async=false, int timeout=-1)
 Drain the library output buffer. More...
 
void synchronizeOutput ()
 Wait until all sent events are processed. More...
 
int getClientId ()
 Gets the client ID. More...
 
snd_seq_type_t getSequencerType ()
 Returns the type snd_seq_type_t of the given sequencer handle. More...
 
snd_seq_t * getHandle ()
 Returns the sequencer handler managed by ALSA.
 
bool isOpened ()
 Returns true if the sequencer is opened.
 
size_t getOutputBufferSize ()
 Gets the size of the library output buffer for the ALSA client. More...
 
void setOutputBufferSize (size_t newSize)
 Sets the size of the library output buffer for the ALSA client. More...
 
size_t getInputBufferSize ()
 Gets the size of the library input buffer for the ALSA client. More...
 
void setInputBufferSize (size_t newSize)
 Sets the size of the library input buffer for the ALSA client. More...
 
QString getDeviceName ()
 Returns the name of the sequencer device.
 
int getOpenMode ()
 Returns the last open mode used in open()
 
bool getBlockMode ()
 Returns the last block mode used in open()
 
void setBlockMode (bool newValue)
 Change the blocking mode of the client. More...
 
QString getClientName ()
 Gets the client's public name. More...
 
QString getClientName (const int clientId)
 Gets the public name corresponding to the given Client ID. More...
 
void setClientName (QString const &newName)
 Changes the public name of the ALSA sequencer client. More...
 
bool getBroadcastFilter ()
 Gets the broadcast filter usage of the client. More...
 
void setBroadcastFilter (bool newValue)
 Sets the broadcast filter usage of the client. More...
 
bool getErrorBounce ()
 Get the error-bounce usage of the client. More...
 
void setErrorBounce (bool newValue)
 Sets the error-bounce usage of the client. More...
 
ClientInfogetThisClientInfo ()
 Gets the ClientInfo object holding data about this client. More...
 
void setThisClientInfo (const ClientInfo &val)
 Sets the data supplied by the ClientInfo object into the ALSA sequencer client. More...
 
MidiPortList getMidiPorts () const
 Gets the list of MidiPort instances belonging to this client. More...
 
ClientInfoList getAvailableClients ()
 Gets the list of clients from the ALSA sequencer. More...
 
PortInfoList getAvailableInputs ()
 Gets the available user input ports in the system. More...
 
PortInfoList getAvailableOutputs ()
 Gets the available user output ports in the system. More...
 
SystemInfogetSystemInfo ()
 Gets a SystemInfo instance with the updated state of the system. More...
 
QList< int > getAvailableQueues ()
 Get a list of the existing queues. More...
 
PoolInfogetPoolInfo ()
 Gets a PoolInfo instance with an updated state of the client memory pool. More...
 
void setPoolInfo (const PoolInfo &info)
 Applies (updates) the client's PoolInfo data into the system. More...
 
void setPoolInput (int size)
 Sets the size of the client's input pool. More...
 
void setPoolOutput (int size)
 Sets the size of the client's output pool. More...
 
void setPoolOutputRoom (int size)
 Sets the room size of the client's output pool. More...
 
void resetPoolInput ()
 Resets the client input pool. More...
 
void resetPoolOutput ()
 Resets the client output pool. More...
 
void dropInput ()
 Clears the client's input buffer and and remove events in sequencer queue. More...
 
void dropInputBuffer ()
 Remove all events on user-space input buffer. More...
 
void dropOutput ()
 Clears the client's output buffer and and remove events in sequencer queue. More...
 
void dropOutputBuffer ()
 Removes all events on the library output buffer. More...
 
void removeEvents (const RemoveEvents *spec)
 Removes events on input/output buffers and pools. More...
 
SequencerEventextractOutput ()
 Extracts (and removes) the first event in the output buffer. More...
 
int outputPending ()
 Returns the size of pending events on the output buffer. More...
 
int inputPending (bool fetch)
 Gets the size of the events on the input buffer. More...
 
int getQueueId (const QString &name)
 Gets the queue's numeric identifier corresponding to the provided name. More...
 
void addListener (QObject *listener)
 Adds a QObject to the listeners list. More...
 
void removeListener (QObject *listener)
 Removes a QObject listener from the listeners list. More...
 
void setEventsEnabled (const bool bEnabled)
 Enables the notification of received SequencerEvent instances to the listeners registered with addListener() More...
 
bool getEventsEnabled () const
 Returns true if the events mode of delivery has been enabled.
 
void setHandler (SequencerEventHandler *handler)
 Sets a sequencer event handler enabling the callback delivery mode.
 
bool parseAddress (const QString &straddr, snd_seq_addr &result)
 Parse a text address representation, returning an ALSA address record. More...
 
void setRealTimeInput (bool enabled)
 Enables real-time priority for the MIDI input thread. More...
 
bool realTimeInputEnabled ()
 Return the real-time priority setting for the MIDI input thread. More...
 

Protected Member Functions

void doEvents ()
 Dispatch the events received from the Sequencer. More...
 
void applyClientInfo ()
 This internal method applies the ClientInfo data to the ALSA sequencer client.
 
void readClients ()
 Reads the ALSA sequencer's clients list.
 
void freeClients ()
 Releases the list of ALSA sequencer's clients.
 
void updateAvailablePorts ()
 Update the internal lists of user ports.
 
PortInfoList filterPorts (unsigned int filter)
 Gets a list of the available user ports in the system, filtered by the given bitmap of desired capabilities. More...
 
const char * _getDeviceName ()
 Gets the internal sequencer device name. More...
 
int getPollDescriptorsCount (short events)
 Returns the number of poll descriptors. More...
 
int pollDescriptors (struct pollfd *pfds, unsigned int space, short events)
 Get poll descriptors. More...
 
unsigned short pollDescriptorsRevents (struct pollfd *pfds, unsigned int nfds)
 Gets the number of returned events from poll descriptors. More...
 
void _setClientName (const char *name)
 Sets the client name. More...
 
int createSimplePort (const char *name, unsigned int caps, unsigned int type)
 Create an ALSA sequencer port, without using MidiPort. More...
 
void deleteSimplePort (int port)
 Remove an ALSA sequencer port. More...
 
void connectFrom (int myport, int client, int port)
 Subscribe one port from another arbitrary sequencer client:port. More...
 
void connectTo (int myport, int client, int port)
 Subscribe one port to another arbitrary sequencer client:port. More...
 
void disconnectFrom (int myport, int client, int port)
 Unsubscribe one port from another arbitrary sequencer client:port. More...
 
void disconnectTo (int myport, int client, int port)
 Unsubscribe one port to another arbitrary sequencer client:port. More...
 

Detailed Description

Client management.

This class represents an ALSA sequencer client

Examples:
drumgrid.cpp, dumpmid.cpp, guiplayer.cpp, metronome.cpp, playsmf.cpp, and sysinfo.cpp.

Definition at line 198 of file alsaclient.h.

Constructor & Destructor Documentation

MidiClient ( QObject parent = 0)

Constructor.

This constructor optionally gets a QObject parent. When you create a MidiClient with another object as parent, the MidiClient object will automatically add itself to the parent's children() list. The parent takes ownership of the object i.e. it will automatically delete its children in its destructor.

It is necessary to invoke open() later to get the sequencer client handler from the ALSA sequencer subsystem.

Parameters
parentThe optional parent object
Returns
a MidiClient instance

Definition at line 258 of file alsaclient.cpp.

~MidiClient ( )
virtual

Destructor.

The ports and queue associated to this client are automatically released.

Definition at line 268 of file alsaclient.cpp.

References MidiClient::close(), MidiClient::detachAllPorts(), MidiClient::freeClients(), and MidiClient::stopSequencerInput().

Member Function Documentation

const char * _getDeviceName ( )
protected

Gets the internal sequencer device name.

Returns
The device name.

Definition at line 1565 of file alsaclient.cpp.

void _setClientName ( const char *  name)
protected

Sets the client name.

Parameters
nameThe new client name.

Definition at line 1575 of file alsaclient.cpp.

References CHECK_WARNING.

void addEventFilter ( int  evtype)

Add an event filter to the client.

Parameters
evtypeAn event filter to be added.

Definition at line 926 of file alsaclient.cpp.

void addListener ( QObject listener)

Adds a QObject to the listeners list.

This object should override the method QObject::customEvent() to receive SequencerEvent instances.

Parameters
listenerA QObject listener to be notified of received events.
See Also
removeListener(), setEventsEnabled()

Definition at line 1286 of file alsaclient.cpp.

void close ( )

Close the sequencer device.

After a client is closed, an event with SND_SEQ_EVENT_CLIENT_EXIT is broadcast to the announce port. The connection between other clients are disconnected. Call this just before exiting your program.

Definition at line 446 of file alsaclient.cpp.

References CHECK_WARNING, and MidiClient::stopSequencerInput().

Referenced by MidiClient::~MidiClient().

void connectFrom ( int  myport,
int  client,
int  port 
)
protected

Subscribe one port from another arbitrary sequencer client:port.

Parameters
myportThe number of the internal port.
clientThe external client's identifier.
portThe external port's identifier.

Definition at line 1613 of file alsaclient.cpp.

References CHECK_WARNING.

void connectTo ( int  myport,
int  client,
int  port 
)
protected

Subscribe one port to another arbitrary sequencer client:port.

Parameters
myportThe number of the internal port.
clientThe external client's identifier.
portThe external port's identifier.

Definition at line 1625 of file alsaclient.cpp.

References CHECK_WARNING.

MidiPort * createPort ( )

Create and attach a new MidiPort instance to this client.

Returns
The pointer to the new MidiPort instance.

Definition at line 859 of file alsaclient.cpp.

References MidiPort::attach().

MidiQueue * createQueue ( )

Create and return a new MidiQueue associated to this client.

Returns
A new MidiQueue instance.

Definition at line 1106 of file alsaclient.cpp.

Referenced by MidiClient::getQueue().

MidiQueue * createQueue ( QString const &  queueName)

Create and return a new MidiQueue with the given name, associated to this client.

Parameters
queueNameThe name for the new queue.
Returns
A new MidiQueue instance.

Definition at line 1122 of file alsaclient.cpp.

int createSimplePort ( const char *  name,
unsigned int  caps,
unsigned int  type 
)
protected

Create an ALSA sequencer port, without using MidiPort.

Parameters
nameThe name of the new port.
capsThe new port capabilities.
typeThe type of the new port.
Returns
The port numeric identifier.

Definition at line 1588 of file alsaclient.cpp.

References CHECK_WARNING.

void deleteSimplePort ( int  port)
protected

Remove an ALSA sequencer port.

Parameters
portThe numeric identifier of the port.

Definition at line 1601 of file alsaclient.cpp.

References CHECK_WARNING.

void disconnectFrom ( int  myport,
int  client,
int  port 
)
protected

Unsubscribe one port from another arbitrary sequencer client:port.

Parameters
myportThe number of the internal port.
clientThe external client's identifier.
portThe external port's identifier.

Definition at line 1637 of file alsaclient.cpp.

References CHECK_WARNING.

void disconnectTo ( int  myport,
int  client,
int  port 
)
protected

Unsubscribe one port to another arbitrary sequencer client:port.

Parameters
myportThe number of the internal port.
clientThe external client's identifier.
portThe external port's identifier.

Definition at line 1649 of file alsaclient.cpp.

References CHECK_WARNING.

void doEvents ( )
protected

Dispatch the events received from the Sequencer.

There are three methods of events delivering:

  • A Callback method. To use this method, you must derive a class from SequencerEventHandler, overriding the method SequencerEventHandler::handleSequencerEvent() to provide your own event processing. You must provide the handler instance to the client using setHandler().
  • Using QEvent listeners. To use this method, you must use one or more classes derived from QObject overriding the method QObject::customEvent(). You must also use the method addListener() to add such objects to the client's listeners list.
  • The third method involves signals and slots. Whenever a sequencer event is received, a signal eventReceived() is emitted, that can be connected to your own supplied slot(s) to process it.
See Also
ALSA Sequencer Clients

Definition at line 582 of file alsaclient.cpp.

References MidiClient::eventReceived().

void drainOutput ( bool  async = false,
int  timeout = -1 
)

Drain the library output buffer.

This function drains all pending events on the output buffer. The function returns immediately after the events are sent to the queues regardless whether the events are processed or not.

Parameters
asyncUse asynchronous mode. If false, this call will block until the buffer can be flushed.
timeoutThe maximum time to wait in synchronous mode.

Definition at line 1059 of file alsaclient.cpp.

References CHECK_WARNING.

void dropInput ( )

Clears the client's input buffer and and remove events in sequencer queue.

See Also
resetPoolInput()

Definition at line 1404 of file alsaclient.cpp.

References CHECK_WARNING.

void dropInputBuffer ( )

Remove all events on user-space input buffer.

See Also
dropInput()

Definition at line 1414 of file alsaclient.cpp.

References CHECK_WARNING.

void dropOutput ( )

Clears the client's output buffer and and remove events in sequencer queue.

This method removes all events on both user-space output buffer and output memory pool on kernel.

See Also
resetPoolOutput()

Definition at line 1427 of file alsaclient.cpp.

References CHECK_WARNING.

void dropOutputBuffer ( )

Removes all events on the library output buffer.

Removes all events on the user-space output buffer. Unlike dropOutput(), this method doesn't remove events on the client's output memory pool.

See Also
dropOutput()

Definition at line 1440 of file alsaclient.cpp.

References CHECK_WARNING.

SequencerEvent * extractOutput ( )

Extracts (and removes) the first event in the output buffer.

Returns
The extracted event.

Definition at line 1462 of file alsaclient.cpp.

References CHECK_WARNING.

PortInfoList filterPorts ( unsigned int  filter)
protected

Gets a list of the available user ports in the system, filtered by the given bitmap of desired capabilities.

Parameters
filterA bitmap of capabilities.
Returns
A filtered list of the available ports in the system.

Definition at line 1214 of file alsaclient.cpp.

References PortInfo::getCapability(), ClientInfo::getClientId(), ClientInfo::getPorts(), and MidiClient::readClients().

Referenced by MidiClient::updateAvailablePorts().

ClientInfoList getAvailableClients ( )

Gets the list of clients from the ALSA sequencer.

Returns
the list of clients.
Examples:
sysinfo.cpp.

Definition at line 758 of file alsaclient.cpp.

References MidiClient::readClients().

PortInfoList getAvailableInputs ( )

Gets the available user input ports in the system.

Returns
The list of available input ports.

Definition at line 1260 of file alsaclient.cpp.

References MidiClient::updateAvailablePorts().

PortInfoList getAvailableOutputs ( )

Gets the available user output ports in the system.

Returns
The list of available output ports.

Definition at line 1272 of file alsaclient.cpp.

References MidiClient::updateAvailablePorts().

QList< int > getAvailableQueues ( )

Get a list of the existing queues.

Returns
a list of existing queues
Examples:
sysinfo.cpp.

Definition at line 1190 of file alsaclient.cpp.

References SystemInfo::getMaxQueues(), and MidiClient::getSystemInfo().

bool getBroadcastFilter ( )

Gets the broadcast filter usage of the client.

Returns
The broadcast filter.

Definition at line 937 of file alsaclient.cpp.

int getClientId ( )

Gets the client ID.

Returns the ID of the client. A client ID is necessary to inquiry or to set the client information. A user client ID is assigned from 128 to 191.

Returns
the client ID.

Definition at line 546 of file alsaclient.cpp.

References CHECK_WARNING.

Referenced by MidiClient::portDetach(), ClientInfo::readPorts(), and SequencerOutputThread::sendEchoEvent().

QString getClientName ( )

Gets the client's public name.

Returns
The client's name

Definition at line 807 of file alsaclient.cpp.

Referenced by MidiPort::getReadSubscribers(), and MidiPort::getWriteSubscribers().

QString getClientName ( const int  clientId)

Gets the public name corresponding to the given Client ID.

Parameters
clientIdThe ID of any existing sequencer client
Returns
The client's name

Definition at line 818 of file alsaclient.cpp.

References MidiClient::readClients().

bool getErrorBounce ( )

Get the error-bounce usage of the client.

Returns
The error-bounce usage.

Definition at line 960 of file alsaclient.cpp.

size_t getInputBufferSize ( )

Gets the size of the library input buffer for the ALSA client.

This buffer is used to read a byte-stream of input events before transferring from the sequencer.

Returns
the size of the library input buffer

Definition at line 494 of file alsaclient.cpp.

Referenced by MidiClient::setInputBufferSize().

MidiPortList getMidiPorts ( ) const

Gets the list of MidiPort instances belonging to this client.

Returns
The list of MidiPort instances.

Definition at line 849 of file alsaclient.cpp.

size_t getOutputBufferSize ( )

Gets the size of the library output buffer for the ALSA client.

This buffer is used to store the decoded byte-stream of output events before transferring to the sequencer.

Returns
the size of the library output buffer

Definition at line 464 of file alsaclient.cpp.

Referenced by MidiClient::setOutputBufferSize().

int getPollDescriptorsCount ( short  events)
protected

Returns the number of poll descriptors.

Parameters
eventsPoll events to be checked (POLLIN and POLLOUT).
Returns
The number of poll descriptors.

Definition at line 1519 of file alsaclient.cpp.

PoolInfo & getPoolInfo ( )

Gets a PoolInfo instance with an updated state of the client memory pool.

Returns
The updated memory pool state.

Definition at line 1332 of file alsaclient.cpp.

MidiQueue * getQueue ( )

Get the MidiQueue instance associated to this client.

If the client is not associated to a MidiQueue, one is created.

Returns
A MidiQueue instance pointer

Definition at line 1093 of file alsaclient.cpp.

References MidiClient::createQueue().

Referenced by SequencerOutputThread::SequencerOutputThread().

int getQueueId ( const QString &  name)

Gets the queue's numeric identifier corresponding to the provided name.

Parameters
nameThe name string to query.
Returns
The number of the matching queue.

Definition at line 1508 of file alsaclient.cpp.

Referenced by MidiClient::useQueue().

snd_seq_type_t getSequencerType ( )

Returns the type snd_seq_type_t of the given sequencer handle.

Returns
the type snd_seq_type_t of the given sequencer handle.

Definition at line 556 of file alsaclient.cpp.

SystemInfo & getSystemInfo ( )

Gets a SystemInfo instance with the updated state of the system.

Returns
The updated system info.
Examples:
sysinfo.cpp.

Definition at line 1321 of file alsaclient.cpp.

Referenced by MidiClient::getAvailableQueues().

ClientInfo & getThisClientInfo ( )

Gets the ClientInfo object holding data about this client.

Returns
the ClientInfo object representing this client.

Definition at line 771 of file alsaclient.cpp.

int inputPending ( bool  fetch)

Gets the size of the events on the input buffer.

If there are events remaining on the user-space input buffer, this method returns the total size of events on it. If the argument is true, this method checks the presence of events on the sequencer FIFO, and when events exist they are transferred to the input buffer, and the number of received events are returned. If the argument is false and no events remain on the input buffer, this method simply returns zero.

Parameters
fetchCheck and fetch the sequencer input pool.
Returns
The size in bytes of the remaining input events on the buffer.

Definition at line 1496 of file alsaclient.cpp.

void open ( const QString  deviceName = "default",
const int  openMode = SND_SEQ_OPEN_DUPLEX,
const bool  blockMode = false 
)

Open the sequencer device.

When opening the MidiClient instance, several properties may optionally be set as the device name, the open mode and block mode. Default values are provided for them. After a successful open, an event with SND_SEQ_EVENT_CLIENT_START is broadcast to the announce port.

Parameters
deviceNamethe sequencer device name, default value = "default". This is not a name you make up for your own purposes; it has special significance to the ALSA library. Usually you need to pass "default" here.
openModethe open mode, default value = SND_SEQ_OPEN_DUPLEX. The read/write mode of the sequencer. Can be one of these three values:
  • SND_SEQ_OPEN_OUTPUT - open the sequencer for output only
  • SND_SEQ_OPEN_INPUT - open the sequencer for input only
  • SND_SEQ_OPEN_DUPLEX - open the sequencer for output and input
blockModeopen in blocking mode, default value = false.
Examples:
sysinfo.cpp.

Definition at line 389 of file alsaclient.cpp.

References CHECK_ERROR, and CHECK_WARNING.

void open ( snd_config_t *  conf,
const QString  deviceName = "default",
const int  openMode = SND_SEQ_OPEN_DUPLEX,
const bool  blockMode = false 
)

Open the sequencer device, providing a configuration object pointer.

This method is like open() except that a configuration is explicitly provided. After a successful open, an event with SND_SEQ_EVENT_CLIENT_START type is broadcasted from the announce port.

Parameters
confa configuration object pointer.
deviceNamethe sequencer device name, default value = "default". This is not a name you make up for your own purposes; it has special significance to the ALSA library. Usually you need to pass "default" here.
openModethe open mode, default value = SND_SEQ_OPEN_DUPLEX. The read/write mode of the sequencer. Can be one of these three values:
  • SND_SEQ_OPEN_OUTPUT - open the sequencer for output only
  • SND_SEQ_OPEN_INPUT - open the sequencer for input only
  • SND_SEQ_OPEN_DUPLEX - open the sequencer for output and input
blockModeopen in blocking mode, default value = false.

Definition at line 422 of file alsaclient.cpp.

References CHECK_ERROR, and CHECK_WARNING.

void output ( SequencerEvent ev,
bool  async = false,
int  timeout = -1 
)

Output an event using the library output buffer.

An event is once expanded on the output buffer. The output buffer will be drained automatically if it becomes full.

Parameters
evThe event to be sent.
asyncUse asynchronous mode. If false, this call will block until the event can be delivered.
timeoutThe maximum time to wait in synchronous mode.

Definition at line 989 of file alsaclient.cpp.

References CHECK_WARNING, and SequencerEvent::getHandle().

void outputBuffer ( SequencerEvent ev)

Output an event using the library output buffer, without draining the buffer.

An event is once expanded on the output buffer. The output buffer will NOT be drained automatically if it becomes full.

Parameters
evThe event to be sent.

Definition at line 1043 of file alsaclient.cpp.

References CHECK_WARNING, and SequencerEvent::getHandle().

void outputDirect ( SequencerEvent ev,
bool  async = false,
int  timeout = -1 
)

Output an event directly to the sequencer.

This function sends an event to the sequencer directly not using the library output buffer.

Parameters
evThe event to be sent.
asyncUse asynchronous mode. If false, this call will block until the event is delivered to the sequencer.
timeoutThe maximum time to wait in synchronous mode.

Definition at line 1017 of file alsaclient.cpp.

References CHECK_WARNING, and SequencerEvent::getHandle().

Referenced by MidiQueue::setRealTimePosition(), and MidiQueue::setTickPosition().

int outputPending ( )

Returns the size of pending events on the output buffer.

Returns
The size of pending events.

Definition at line 1477 of file alsaclient.cpp.

bool parseAddress ( const QString &  straddr,
snd_seq_addr &  addr 
)

Parse a text address representation, returning an ALSA address record.

This function can be used as a replacement of the standard ALSA function snd_seq_parse_address().

Parameters
straddrsource text address representation
addrreturned ALSA address record
Returns
true if the text address was successfully parsed
Since
0.3.1

Definition at line 1666 of file alsaclient.cpp.

References ClientInfo::getClientId(), ClientInfo::getName(), and MidiClient::readClients().

Referenced by MidiPort::subscribeFrom(), MidiPort::subscribeTo(), MidiPort::unsubscribeFrom(), and MidiPort::unsubscribeTo().

int pollDescriptors ( struct pollfd *  pfds,
unsigned int  space,
short  events 
)
protected

Get poll descriptors.

Get poll descriptors assigned to the sequencer handle. Since a sequencer handle can duplex streams, you need to set which direction(s) is/are polled in events argument. When POLLIN bit is specified, the incoming events to the ports are checked.

Parameters
pfdsArray of poll descriptors
spaceSpace in the poll descriptor array
eventsPolling events to be checked (POLLIN and POLLOUT)
Returns
Count of filled descriptors

Definition at line 1538 of file alsaclient.cpp.

unsigned short pollDescriptorsRevents ( struct pollfd *  pfds,
unsigned int  nfds 
)
protected

Gets the number of returned events from poll descriptors.

Parameters
pfdsArray of poll descriptors.
nfdsCount of poll descriptors.
Returns
Number of returned events.

Definition at line 1551 of file alsaclient.cpp.

References CHECK_WARNING.

void portAttach ( MidiPort port)

Attach a MidiPort instance to this client.

Parameters
portThe MidiPort to be attached

Definition at line 871 of file alsaclient.cpp.

References CHECK_ERROR.

Referenced by MidiPort::attach().

void portDetach ( MidiPort port)

Detach a MidiPort instance from this client.

Parameters
portThe MidiPort to be detached

Definition at line 884 of file alsaclient.cpp.

References CHECK_ERROR, PortInfo::getClient(), MidiClient::getClientId(), PortInfo::getPort(), MidiPort::getPortInfo(), and MidiPort::setMidiClient().

Referenced by MidiPort::detach().

bool realTimeInputEnabled ( )

Return the real-time priority setting for the MIDI input thread.

Returns
true if the real-time priority is enabled
Since
0.5.0

Definition at line 361 of file alsaclient.cpp.

void removeEvents ( const RemoveEvents spec)

Removes events on input/output buffers and pools.

Removes matching events with the given condition from input/output buffers and pools. The removal condition is specified in the spec argument.

Parameters
specA RemoveEvents instance specifying the removal condition.

Definition at line 1452 of file alsaclient.cpp.

References CHECK_WARNING.

void removeListener ( QObject listener)

Removes a QObject listener from the listeners list.

Parameters
listenerlistener A QObject listener to be removed of received events.
See Also
addListener(), setEventsEnabled()

Definition at line 1297 of file alsaclient.cpp.

void resetPoolInput ( )

Resets the client input pool.

See Also
dropInput()

Definition at line 1354 of file alsaclient.cpp.

References CHECK_WARNING.

void resetPoolOutput ( )

Resets the client output pool.

See Also
dropOutput()

Definition at line 1364 of file alsaclient.cpp.

References CHECK_WARNING.

void setBlockMode ( bool  newValue)

Change the blocking mode of the client.

In block mode, the client falls into sleep when it fills the output memory pool with full events. The client will be woken up after a certain amount of free space becomes available.

Parameters
newValuethe blocking mode

Definition at line 525 of file alsaclient.cpp.

References CHECK_WARNING.

void setBroadcastFilter ( bool  newValue)

Sets the broadcast filter usage of the client.

Parameters
newValueThe broadcast filter.

Definition at line 948 of file alsaclient.cpp.

References MidiClient::applyClientInfo().

void setClientName ( QString const &  newName)

Changes the public name of the ALSA sequencer client.

Parameters
newNameA new public name
Examples:
sysinfo.cpp.

Definition at line 836 of file alsaclient.cpp.

References MidiClient::applyClientInfo().

void setErrorBounce ( bool  newValue)

Sets the error-bounce usage of the client.

Parameters
newValueThe error-bounce usage.

Definition at line 971 of file alsaclient.cpp.

References MidiClient::applyClientInfo().

void setEventsEnabled ( const bool  bEnabled)

Enables the notification of received SequencerEvent instances to the listeners registered with addListener()

Parameters
bEnabledThe new state of the events delivering mode.
See Also
addListener(), removeListener(), setEventsEnabled()

Definition at line 1309 of file alsaclient.cpp.

void setInputBufferSize ( size_t  newSize)

Sets the size of the library input buffer for the ALSA client.

This buffer is used to read a byte-stream of input events before transferring from the sequencer.

Parameters
newSizethe size of the library input buffer

Definition at line 508 of file alsaclient.cpp.

References CHECK_WARNING, and MidiClient::getInputBufferSize().

void setOutputBufferSize ( size_t  newSize)

Sets the size of the library output buffer for the ALSA client.

This buffer is used to store the decoded byte-stream of output events before transferring to the sequencer.

Parameters
newSizethe size of the library output buffer

Definition at line 478 of file alsaclient.cpp.

References CHECK_WARNING, and MidiClient::getOutputBufferSize().

void setPoolInfo ( const PoolInfo info)

Applies (updates) the client's PoolInfo data into the system.

Parameters
infoThe PoolInfo reference to be applied to the client.

Definition at line 1343 of file alsaclient.cpp.

References CHECK_WARNING.

void setPoolInput ( int  size)

Sets the size of the client's input pool.

Parameters
sizeThe new size

Definition at line 1374 of file alsaclient.cpp.

References CHECK_WARNING.

void setPoolOutput ( int  size)

Sets the size of the client's output pool.

Parameters
sizeThe new size

Definition at line 1384 of file alsaclient.cpp.

References CHECK_WARNING.

void setPoolOutputRoom ( int  size)

Sets the room size of the client's output pool.

Parameters
sizeThe new size

Definition at line 1394 of file alsaclient.cpp.

References CHECK_WARNING.

void setRealTimeInput ( bool  enable)

Enables real-time priority for the MIDI input thread.

The system needs either RLIMIT_RTPRIO or RealtimeKit. First RLIMIT_RTPRIO is tried, and if this method fails, RealtimeKit is used.

Parameters
enablereal-time priority enabled
Since
0.5.0

Definition at line 348 of file alsaclient.cpp.

void setThisClientInfo ( const ClientInfo val)

Sets the data supplied by the ClientInfo object into the ALSA sequencer client.

This allows to change the name, capabilities, type and other data in a single step.

Parameters
vala ClientInfo object reference

Definition at line 785 of file alsaclient.cpp.

void synchronizeOutput ( )

Wait until all sent events are processed.

This function waits until all events of this client are processed.

Definition at line 1082 of file alsaclient.cpp.

MidiQueue * useQueue ( int  queue_id)

Create a new MidiQueue instance using a queue already existing in the system, associating it to the client.

Parameters
queue_idAn existing queue identifier.
Returns
A new MidiQueue instance.

Definition at line 1139 of file alsaclient.cpp.

MidiQueue * useQueue ( const QString &  name)

Create a new MidiQueue instance using a queue already existing in the system, associating it to the client.

Parameters
nameAn existing queue name.
Returns
A new MidiQueue instance.

Definition at line 1156 of file alsaclient.cpp.

References MidiClient::getQueueId().

MidiQueue * useQueue ( MidiQueue queue)

Associate an existing MidiQueue instance to the client.

Parameters
queueAn existing MidiQueue.
Returns
The provided MidiQueue instance.

Definition at line 1175 of file alsaclient.cpp.


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