drumstick 0.5.0
MidiPort Class Reference

Port management. More...

#include <alsaport.h>

Inheritance diagram for MidiPort:

List of all members.

Signals

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

Public Member Functions

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

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.

Protected Member Functions

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

Detailed Description

Port management.

This class represents an ALSA sequencer port.

Examples:

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

Definition at line 119 of file alsaport.h.


Constructor & Destructor Documentation

MidiPort ( QObject parent = 0)

Constructor.

Parameters:
parentAn optional parent object

Definition at line 549 of file alsaport.cpp.

~MidiPort ( ) [virtual]

Destructor.

All subscriptions are released.

Definition at line 560 of file alsaport.cpp.

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


Member Function Documentation

void attach ( MidiClient seq)

Attach the port to a MidiClient instance.

Parameters:
seqA MidiClient object pointer

Definition at line 1097 of file alsaport.cpp.

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

Referenced by MidiClient::createPort().

void attached ( MidiPort port) [signal]

Signal emitted when the port is attached to a MidiClient.

Parameters:
portMIDI port object pointer

Referenced by MidiPort::attach().

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 1186 of file alsaport.cpp.

References PortInfo::getAddr().

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

void detached ( MidiPort port) [signal]

Signal emitted when the port is detached from a MidiClient.

Parameters:
portMIDI port object pointer

Referenced by MidiPort::detach().

unsigned int getCapability ( )

Gets the port capabilities.

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

Definition at line 926 of file alsaport.cpp.

References PortInfo::getCapability().

int getMidiChannels ( )

Gets the MIDI channels.

Returns:
The MIDI channels

Definition at line 971 of file alsaport.cpp.

References PortInfo::getMidiChannels().

int getMidiVoices ( )

Gets the MIDI voices.

Returns:
The MIDI voices

Definition at line 992 of file alsaport.cpp.

References PortInfo::getMidiVoices().

int getPortId ( )

Gets the port number.

Returns:
The port number

Definition at line 915 of file alsaport.cpp.

References PortInfo::getPort().

QString getPortName ( )

Gets the port name.

Returns:
The port name

Definition at line 894 of file alsaport.cpp.

References PortInfo::getName().

unsigned int getPortType ( )

Gets the port type.

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

Definition at line 949 of file alsaport.cpp.

References PortInfo::getType().

PortInfoList getReadSubscribers ( )

Gets the list of read subscribers.

Returns:
The list of read subscribers

Definition at line 1134 of file alsaport.cpp.

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

Referenced by MidiPort::updateConnectionsTo().

SubscriptionsList getSubscriptions ( ) const

Gets the list of susbcriptions.

Returns:
The list of susbcriptions

Definition at line 581 of file alsaport.cpp.

int getSynthVoices ( )

Gets the synth voices.

Returns:
The synth voices

Definition at line 1013 of file alsaport.cpp.

References PortInfo::getSynthVoices().

bool getTimestamping ( )

Gets the timestamping mode.

Returns:
The timestamping mode

Definition at line 1034 of file alsaport.cpp.

References PortInfo::getTimestamping().

int getTimestampQueue ( )

Gets the timestamp queue number.

Returns:
The timestamp queue number

Definition at line 1054 of file alsaport.cpp.

References PortInfo::getTimestampQueue().

bool getTimestampReal ( )

Gets the timestamp real mode.

Returns:
The timestamp real mode

Definition at line 1044 of file alsaport.cpp.

References PortInfo::getTimestampReal().

PortInfoList getWriteSubscribers ( )

Gets the list of write subscribers.

Returns:
The list of write subscribers

Definition at line 1159 of file alsaport.cpp.

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

Referenced by MidiPort::updateConnectionsFrom().

void midiClientChanged ( MidiPort port,
MidiClient seq 
) [signal]

Signal emitted when the MidiClient has changed.

Parameters:
portMIDI port object pinter
seqMidiClient object pointer

Referenced by MidiPort::setMidiClient().

void setCapability ( unsigned int  newValue)

Sets the port capabilities.

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

Definition at line 937 of file alsaport.cpp.

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

void setMidiChannels ( int  newValue)

Sets the MIDI channels.

Parameters:
newValueThe MIDI channels

Definition at line 981 of file alsaport.cpp.

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

void setMidiClient ( MidiClient seq) [protected]

Sets the MidiClient.

Parameters:
seqA MidiClient object pointer

Definition at line 600 of file alsaport.cpp.

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

Referenced by MidiClient::portDetach().

void setMidiVoices ( int  newValue)

Sets the MIDI voices.

Parameters:
newValueThe MIDI voices

Definition at line 1002 of file alsaport.cpp.

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

void setPortName ( QString const &  newName)

Sets the port name.

Parameters:
newNameThe new port name

Definition at line 904 of file alsaport.cpp.

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

void setPortType ( unsigned int  newValue)

Sets the port type bitmap.

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

Definition at line 960 of file alsaport.cpp.

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

void setSynthVoices ( int  newValue)

Sets the synth voices.

Parameters:
newValueThe synth voices

Definition at line 1023 of file alsaport.cpp.

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

void setTimestamping ( bool  value)

Sets the timestamping mode.

Parameters:
valueThe timestamping mode

Definition at line 1064 of file alsaport.cpp.

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

void setTimestampQueue ( int  queueId)

Sets the timestamp queue number.

Parameters:
queueIdThe queue number

Definition at line 1086 of file alsaport.cpp.

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

void setTimestampReal ( bool  value)

Sets the timestamp real mode.

Parameters:
valueThe timestamp real mode

Definition at line 1075 of file alsaport.cpp.

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

void subscribe ( Subscription subs)

Subscribe a Subscription object.

Parameters:
subsA Subscription object pointer

Definition at line 615 of file alsaport.cpp.

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

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

void subscribed ( MidiPort port,
Subscription subs 
) [signal]

Signal emitted when an internal subscription is done.

Parameters:
portMIDI port object pointer
subsSubscription object pointer

Referenced by MidiPort::subscribe().

void subscribeFrom ( int  client,
int  port 
)

Subscribe a source port.

Parameters:
clientALSA client number
portALSA port number

Definition at line 769 of file alsaport.cpp.

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

void subscribeFrom ( QString const &  name)

Subscribe a source port.

Parameters:
nameA string representing a client:port pair

Definition at line 785 of file alsaport.cpp.

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

void subscribeFrom ( PortInfo port)

Subscribe a source port.

Parameters:
portA PortInfo object pointer

Definition at line 755 of file alsaport.cpp.

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

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

void subscribeTo ( QString const &  name)

Subscribe to another port destination.

Parameters:
nameA string representing a client:port pair

Definition at line 685 of file alsaport.cpp.

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

void subscribeTo ( PortInfo info)

Subscribe to another port destination.

Parameters:
infoA PortInfo object pointer

Definition at line 655 of file alsaport.cpp.

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

Referenced by MidiPort::updateConnectionsTo().

void subscribeTo ( int  client,
int  port 
)

Susbcribe to another port destination.

Parameters:
clientALSA client number
portALSA port number

Definition at line 669 of file alsaport.cpp.

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

void unsubscribe ( Subscription subs)

Unsubscribe a Subscription object.

Parameters:
subsA Subscription object pointer

Definition at line 627 of file alsaport.cpp.

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

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

void unsubscribeFrom ( const snd_seq_addr_t *  addr)

Unsubscribe a source port.

Parameters:
addrAn ALSA address record pointer

Definition at line 839 of file alsaport.cpp.

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

void unsubscribeFrom ( PortInfo port)

Unsubscribe a source port.

Parameters:
portA PortInfo object pointer

Definition at line 823 of file alsaport.cpp.

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

void unsubscribeFrom ( QString const &  name)

Unsubscribe a source port.

Parameters:
nameA string representing a client:port pair

Definition at line 804 of file alsaport.cpp.

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

Referenced by MidiPort::updateConnectionsFrom().

void unsubscribeTo ( PortInfo port)

Unsubscribe a destination port.

Parameters:
portA PortInfo object pointer

Definition at line 723 of file alsaport.cpp.

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

void unsubscribeTo ( QString const &  name)

Unsubscribe a destination port.

Parameters:
nameA string representing a client:port pair

Definition at line 704 of file alsaport.cpp.

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

Referenced by MidiPort::updateConnectionsTo().

void unsubscribeTo ( const snd_seq_addr_t *  addr)

Unsubscribe a destination port.

Parameters:
addrAn ALSA address record pointer

Definition at line 739 of file alsaport.cpp.

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

void updateConnectionsFrom ( const PortInfoList &  ports)

Update the read susbcriptions.

Parameters:
portsList of readable ports to be subscribed

Definition at line 1227 of file alsaport.cpp.

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

void updateConnectionsTo ( const PortInfoList &  ports)

Update the write subscriptions.

Parameters:
portsList of writable ports to be subscribed

Definition at line 1204 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: