drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.

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 (drumstick::ALSA::SequencerEvent *ev)
 Signal emitted when an event is received. More...
 

Public Member Functions

 MidiClient (QObject *parent=nullptr)
 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. More...
 
bool isOpened ()
 Returns true if the sequencer is opened. More...
 
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. More...
 
int getOpenMode ()
 Returns the last open mode used in open() More...
 
bool getBlockMode ()
 Returns the last block mode used in open() More...
 
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. More...
 
void setHandler (SequencerEventHandler *handler)
 Sets a sequencer event handler enabling the callback delivery mode. More...
 
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 218 of file alsaclient.h.

Member Function Documentation

◆ eventReceived

void eventReceived ( drumstick::ALSA::SequencerEvent ev)
signal

Signal emitted when an event is received.

Parameters
evpointer to the received event

Referenced by MidiClient::doEvents().


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