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

Port management. More...

#include <alsaport.h>

Inheritance diagram for MidiPort:

Signals

void subscribed (drumstick::ALSA::MidiPort *port, drumstick::ALSA::Subscription *subs)
 Signal emitted when an internal subscription is done. More...
 
void midiClientChanged (drumstick::ALSA::MidiPort *port, drumstick::ALSA::MidiClient *seq)
 Signal emitted when the MidiClient has changed. More...
 
void attached (drumstick::ALSA::MidiPort *port)
 Signal emitted when the port is attached to a MidiClient. More...
 
void detached (drumstick::ALSA::MidiPort *port)
 Signal emitted when the port is detached from a MidiClient. More...
 

Public Member Functions

 MidiPort (QObject *parent=nullptr)
 Constructor. More...
 
virtual ~MidiPort ()
 Destructor. More...
 
void attach (MidiClient *seq)
 Attach the port to a MidiClient instance. More...
 
void detach ()
 Detach the port from any MidiClient instance previously attached.
 
void subscribe (Subscription *subs)
 Subscribe a Subscription object. More...
 
void unsubscribe (Subscription *subs)
 Unsubscribe a Subscription object. More...
 
void unsubscribeAll ()
 Unsubscribe all subscriptions.
 
void unsubscribeTo (QString const &name)
 Unsubscribe a destination port. More...
 
void unsubscribeTo (PortInfo *port)
 Unsubscribe a destination port. More...
 
void unsubscribeTo (const snd_seq_addr_t *addr)
 Unsubscribe a destination port. More...
 
void unsubscribeFrom (QString const &name)
 Unsubscribe a source port. More...
 
void unsubscribeFrom (PortInfo *port)
 Unsubscribe a source port. More...
 
void unsubscribeFrom (const snd_seq_addr_t *addr)
 Unsubscribe a source port. More...
 
void subscribeTo (PortInfo *port)
 Subscribe to another port destination. More...
 
void subscribeTo (int client, int port)
 Susbcribe to another port destination. More...
 
void subscribeTo (QString const &name)
 Subscribe to another port destination. More...
 
void subscribeFrom (PortInfo *port)
 Subscribe a source port. More...
 
void subscribeFrom (int client, int port)
 Subscribe a source port. More...
 
void subscribeFrom (QString const &name)
 Subscribe a source port. More...
 
void subscribeFromAnnounce ()
 Subscribe from the System:announce port.
 
void updateSubscribers ()
 Update the subscribers list in the PortInfo member.
 
SubscriptionsList getSubscriptions () const
 Gets the list of susbcriptions. More...
 
PortInfoList getReadSubscribers ()
 Gets the list of read subscribers. More...
 
PortInfoList getWriteSubscribers ()
 Gets the list of write subscribers. More...
 
void updateConnectionsTo (const PortInfoList &desired)
 Update the write subscriptions. More...
 
void updateConnectionsFrom (const PortInfoList &desired)
 Update the read susbcriptions. More...
 
void applyPortInfo ()
 Applies all the the delayed PortInfo changes to the MIDI port object.
 
QString getPortName ()
 Gets the port name. More...
 
void setPortName (QString const &newName)
 Sets the port name. More...
 
int getPortId ()
 Gets the port number. More...
 
unsigned int getCapability ()
 Gets the port capabilities. More...
 
void setCapability (unsigned int newValue)
 Sets the port capabilities. More...
 
unsigned int getPortType ()
 Gets the port type. More...
 
void setPortType (unsigned int newValue)
 Sets the port type bitmap. More...
 
int getMidiChannels ()
 Gets the MIDI channels. More...
 
void setMidiChannels (int newValue)
 Sets the MIDI channels. More...
 
int getMidiVoices ()
 Gets the MIDI voices. More...
 
void setMidiVoices (int newValue)
 Sets the MIDI voices. More...
 
int getSynthVoices ()
 Gets the synth voices. More...
 
void setSynthVoices (int newValue)
 Sets the synth voices. More...
 
bool getTimestamping ()
 Gets the timestamping mode. More...
 
bool getTimestampReal ()
 Gets the timestamp real mode. More...
 
int getTimestampQueue ()
 Gets the timestamp queue number. More...
 
void setTimestamping (bool value)
 Sets the timestamping mode. More...
 
void setTimestampReal (bool value)
 Sets the timestamp real mode. More...
 
void setTimestampQueue (int queueId)
 Sets the timestamp queue number. More...
 

Static Public Member Functions

static bool containsAddress (const snd_seq_addr_t *addr, const PortInfoList &lst)
 Checks if the provided address is included in the port list. More...
 

Protected Member Functions

PortInfogetPortInfo ()
 Gets the PortInfo object pointer. More...
 
void freeSubscriptions ()
 Releases the lists of subscriptions.
 
void setMidiClient (MidiClient *seq)
 Sets the MidiClient. More...
 

Detailed Description

Port management.

This class represents an ALSA sequencer port.

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

Definition at line 124 of file alsaport.h.

Constructor & Destructor Documentation

◆ MidiPort()

MidiPort ( QObject parent = nullptr)
explicit

Constructor.

Parameters
parentAn optional parent object

Definition at line 572 of file alsaport.cpp.

◆ ~MidiPort()

~MidiPort ( )
virtual

Destructor.

All subscriptions are released.

Definition at line 583 of file alsaport.cpp.

References MidiPort::detach(), MidiPort::freeSubscriptions(), and MidiPort::unsubscribeAll().

Member Function Documentation

◆ attach()

void attach ( MidiClient seq)

Attach the port to a MidiClient instance.

Parameters
seqA MidiClient object pointer

Definition at line 1121 of file alsaport.cpp.

References MidiPort::attached(), and MidiClient::portAttach().

Referenced by MidiClient::createPort().

◆ attached

void attached ( drumstick::ALSA::MidiPort port)
signal

Signal emitted when the port is attached to a MidiClient.

Parameters
portMIDI port object pointer

Referenced by MidiPort::attach().

◆ containsAddress()

bool containsAddress ( const snd_seq_addr_t *  addr,
const PortInfoList lst 
)
static

Checks if the provided address is included in the port list.

Parameters
addrALSA address record pointer
lstList of port information containers
Returns
True if the address is found

Definition at line 1210 of file alsaport.cpp.

References PortInfo::getAddr().

Referenced by MidiPort::updateConnectionsFrom(), and MidiPort::updateConnectionsTo().

◆ detached

void detached ( drumstick::ALSA::MidiPort port)
signal

Signal emitted when the port is detached from a MidiClient.

Parameters
portMIDI port object pointer

Referenced by MidiPort::detach().

◆ getCapability()

unsigned int getCapability ( )

Gets the port capabilities.

Returns
The capabilities bitmap
See also
PortInfo::getCapability()

Definition at line 950 of file alsaport.cpp.

References PortInfo::getCapability().

◆ getMidiChannels()

int getMidiChannels ( )

Gets the MIDI channels.

Returns
The MIDI channels

Definition at line 995 of file alsaport.cpp.

References PortInfo::getMidiChannels().

◆ getMidiVoices()

int getMidiVoices ( )

Gets the MIDI voices.

Returns
The MIDI voices

Definition at line 1016 of file alsaport.cpp.

References PortInfo::getMidiVoices().

◆ getPortId()

int getPortId ( )

Gets the port number.

Returns
The port number

Definition at line 939 of file alsaport.cpp.

References PortInfo::getPort().

◆ getPortInfo()

PortInfo * getPortInfo ( )
protected

Gets the PortInfo object pointer.

Returns
the PortInfo object pointer

Definition at line 595 of file alsaport.cpp.

Referenced by MidiClient::detachAllPorts(), and MidiClient::portDetach().

◆ getPortName()

QString getPortName ( )

Gets the port name.

Returns
The port name

Definition at line 918 of file alsaport.cpp.

References PortInfo::getName().

◆ getPortType()

unsigned int getPortType ( )

Gets the port type.

Returns
The port type bitmap
See also
PortInfo::getType()

Definition at line 973 of file alsaport.cpp.

References PortInfo::getType().

◆ getReadSubscribers()

PortInfoList getReadSubscribers ( )

Gets the list of read subscribers.

Returns
The list of read subscribers

Definition at line 1158 of file alsaport.cpp.

References Subscriber::getAddr(), PortInfo::getCapability(), PortInfo::getClient(), MidiClient::getClientName(), PortInfo::getReadSubscribers(), and PortInfo::setClientName().

Referenced by MidiPort::updateConnectionsTo().

◆ getSubscriptions()

SubscriptionsList getSubscriptions ( ) const

Gets the list of susbcriptions.

Returns
The list of susbcriptions

Definition at line 605 of file alsaport.cpp.

◆ getSynthVoices()

int getSynthVoices ( )

Gets the synth voices.

Returns
The synth voices

Definition at line 1037 of file alsaport.cpp.

References PortInfo::getSynthVoices().

◆ getTimestamping()

bool getTimestamping ( )

Gets the timestamping mode.

Returns
The timestamping mode

Definition at line 1058 of file alsaport.cpp.

References PortInfo::getTimestamping().

◆ getTimestampQueue()

int getTimestampQueue ( )

Gets the timestamp queue number.

Returns
The timestamp queue number

Definition at line 1078 of file alsaport.cpp.

References PortInfo::getTimestampQueue().

◆ getTimestampReal()

bool getTimestampReal ( )

Gets the timestamp real mode.

Returns
The timestamp real mode

Definition at line 1068 of file alsaport.cpp.

References PortInfo::getTimestampReal().

◆ getWriteSubscribers()

PortInfoList getWriteSubscribers ( )

Gets the list of write subscribers.

Returns
The list of write subscribers

Definition at line 1183 of file alsaport.cpp.

References Subscriber::getAddr(), PortInfo::getCapability(), PortInfo::getClient(), MidiClient::getClientName(), PortInfo::getWriteSubscribers(), and PortInfo::setClientName().

Referenced by MidiPort::updateConnectionsFrom().

◆ midiClientChanged

void midiClientChanged ( drumstick::ALSA::MidiPort port,
drumstick::ALSA::MidiClient seq 
)
signal

Signal emitted when the MidiClient has changed.

Parameters
portMIDI port object pinter
seqMidiClient object pointer

Referenced by MidiPort::setMidiClient().

◆ setCapability()

void setCapability ( unsigned int  newValue)

Sets the port capabilities.

Parameters
newValueThe capabilities bitmap
See also
PortInfo::setCapability()

Definition at line 961 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setCapability().

◆ setMidiChannels()

void setMidiChannels ( int  newValue)

Sets the MIDI channels.

Parameters
newValueThe MIDI channels

Definition at line 1005 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setMidiChannels().

◆ setMidiClient()

void setMidiClient ( MidiClient seq)
protected

Sets the MidiClient.

Parameters
seqA MidiClient object pointer

Definition at line 624 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and MidiPort::midiClientChanged().

Referenced by MidiClient::detachAllPorts(), and MidiClient::portDetach().

◆ setMidiVoices()

void setMidiVoices ( int  newValue)

Sets the MIDI voices.

Parameters
newValueThe MIDI voices

Definition at line 1026 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setMidiVoices().

◆ setPortName()

void setPortName ( QString const &  newName)

Sets the port name.

Parameters
newNameThe new port name

Definition at line 928 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setName().

◆ setPortType()

void setPortType ( unsigned int  newValue)

Sets the port type bitmap.

Parameters
newValueThe port type flags bitmap
See also
PortInfo::setType()

Definition at line 984 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setType().

◆ setSynthVoices()

void setSynthVoices ( int  newValue)

Sets the synth voices.

Parameters
newValueThe synth voices

Definition at line 1047 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setSynthVoices().

◆ setTimestamping()

void setTimestamping ( bool  value)

Sets the timestamping mode.

Parameters
valueThe timestamping mode

Definition at line 1088 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setTimestamping().

◆ setTimestampQueue()

void setTimestampQueue ( int  queueId)

Sets the timestamp queue number.

Parameters
queueIdThe queue number

Definition at line 1110 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setTimestampQueue().

◆ setTimestampReal()

void setTimestampReal ( bool  value)

Sets the timestamp real mode.

Parameters
valueThe timestamp real mode

Definition at line 1099 of file alsaport.cpp.

References MidiPort::applyPortInfo(), and PortInfo::setTimestampReal().

◆ subscribe()

void subscribe ( Subscription subs)

Subscribe a Subscription object.

Parameters
subsA Subscription object pointer

Definition at line 639 of file alsaport.cpp.

References Subscription::subscribe(), and MidiPort::subscribed().

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

◆ subscribed

void subscribed ( drumstick::ALSA::MidiPort port,
drumstick::ALSA::Subscription subs 
)
signal

Signal emitted when an internal subscription is done.

Parameters
portMIDI port object pointer
subsSubscription object pointer

Referenced by MidiPort::subscribe().

◆ subscribeFrom() [1/3]

void subscribeFrom ( int  client,
int  port 
)

Subscribe a source port.

Parameters
clientALSA client number
portALSA port number

Definition at line 793 of file alsaport.cpp.

References PortInfo::getAddr(), Subscription::setDest(), Subscription::setSender(), and MidiPort::subscribe().

◆ subscribeFrom() [2/3]

void subscribeFrom ( PortInfo port)

Subscribe a source port.

Parameters
portA PortInfo object pointer

Definition at line 779 of file alsaport.cpp.

References PortInfo::getAddr(), Subscription::setDest(), Subscription::setSender(), and MidiPort::subscribe().

Referenced by MidiPort::subscribeFromAnnounce(), and MidiPort::updateConnectionsFrom().

◆ subscribeFrom() [3/3]

void subscribeFrom ( QString const &  name)

Subscribe a source port.

Parameters
nameA string representing a client:port pair

Definition at line 809 of file alsaport.cpp.

References PortInfo::getAddr(), MidiClient::getHandle(), MidiClient::parseAddress(), Subscription::setDest(), Subscription::setSender(), and MidiPort::subscribe().

◆ subscribeTo() [1/3]

void subscribeTo ( int  client,
int  port 
)

Susbcribe to another port destination.

Parameters
clientALSA client number
portALSA port number

Definition at line 693 of file alsaport.cpp.

References PortInfo::getAddr(), Subscription::setDest(), Subscription::setSender(), and MidiPort::subscribe().

◆ subscribeTo() [2/3]

void subscribeTo ( PortInfo info)

Subscribe to another port destination.

Parameters
infoA PortInfo object pointer

Definition at line 679 of file alsaport.cpp.

References PortInfo::getAddr(), Subscription::setDest(), Subscription::setSender(), and MidiPort::subscribe().

Referenced by MidiPort::updateConnectionsTo().

◆ subscribeTo() [3/3]

void subscribeTo ( QString const &  name)

Subscribe to another port destination.

Parameters
nameA string representing a client:port pair

Definition at line 709 of file alsaport.cpp.

References PortInfo::getAddr(), MidiClient::getHandle(), MidiClient::parseAddress(), Subscription::setDest(), Subscription::setSender(), and MidiPort::subscribe().

◆ unsubscribe()

void unsubscribe ( Subscription subs)

Unsubscribe a Subscription object.

Parameters
subsA Subscription object pointer

Definition at line 651 of file alsaport.cpp.

References Subscription::getDest(), Subscription::getSender(), and Subscription::unsubscribe().

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

◆ unsubscribeFrom() [1/3]

void unsubscribeFrom ( const snd_seq_addr_t *  addr)

Unsubscribe a source port.

Parameters
addrAn ALSA address record pointer

Definition at line 863 of file alsaport.cpp.

References PortInfo::getAddr(), MidiClient::getHandle(), Subscription::setDest(), Subscription::setSender(), and MidiPort::unsubscribe().

◆ unsubscribeFrom() [2/3]

void unsubscribeFrom ( PortInfo port)

Unsubscribe a source port.

Parameters
portA PortInfo object pointer

Definition at line 847 of file alsaport.cpp.

References PortInfo::getAddr(), MidiClient::getHandle(), Subscription::setDest(), Subscription::setSender(), and MidiPort::unsubscribe().

◆ unsubscribeFrom() [3/3]

void unsubscribeFrom ( QString const &  name)

Unsubscribe a source port.

Parameters
nameA string representing a client:port pair

Definition at line 828 of file alsaport.cpp.

References PortInfo::getAddr(), MidiClient::getHandle(), MidiClient::parseAddress(), Subscription::setDest(), Subscription::setSender(), and MidiPort::unsubscribe().

Referenced by MidiPort::updateConnectionsFrom().

◆ unsubscribeTo() [1/3]

void unsubscribeTo ( const snd_seq_addr_t *  addr)

Unsubscribe a destination port.

Parameters
addrAn ALSA address record pointer

Definition at line 763 of file alsaport.cpp.

References PortInfo::getAddr(), MidiClient::getHandle(), Subscription::setDest(), Subscription::setSender(), and MidiPort::unsubscribe().

◆ unsubscribeTo() [2/3]

void unsubscribeTo ( PortInfo port)

Unsubscribe a destination port.

Parameters
portA PortInfo object pointer

Definition at line 747 of file alsaport.cpp.

References PortInfo::getAddr(), MidiClient::getHandle(), Subscription::setDest(), Subscription::setSender(), and MidiPort::unsubscribe().

◆ unsubscribeTo() [3/3]

void unsubscribeTo ( QString const &  name)

Unsubscribe a destination port.

Parameters
nameA string representing a client:port pair

Definition at line 728 of file alsaport.cpp.

References PortInfo::getAddr(), MidiClient::getHandle(), MidiClient::parseAddress(), Subscription::setDest(), Subscription::setSender(), and MidiPort::unsubscribe().

Referenced by MidiPort::updateConnectionsTo().

◆ updateConnectionsFrom()

void updateConnectionsFrom ( const PortInfoList ports)

Update the read susbcriptions.

Parameters
portsList of readable ports to be subscribed

Definition at line 1251 of file alsaport.cpp.

References MidiPort::containsAddress(), PortInfo::getAddr(), MidiPort::getWriteSubscribers(), MidiPort::subscribeFrom(), and MidiPort::unsubscribeFrom().

◆ updateConnectionsTo()

void updateConnectionsTo ( const PortInfoList ports)

Update the write subscriptions.

Parameters
portsList of writable ports to be subscribed

Definition at line 1228 of file alsaport.cpp.

References MidiPort::containsAddress(), PortInfo::getAddr(), MidiPort::getReadSubscribers(), MidiPort::subscribeTo(), and MidiPort::unsubscribeTo().


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