58 snd_seq_port_info_malloc(&m_Info);
67 snd_seq_port_info_malloc(&m_Info);
68 snd_seq_port_info_copy(m_Info, other.m_Info);
69 m_ReadSubscribers = other.m_ReadSubscribers;
70 m_WriteSubscribers = other.m_WriteSubscribers;
71 m_ClientName = other.m_ClientName;
80 snd_seq_port_info_malloc(&m_Info);
81 snd_seq_port_info_copy(m_Info, other);
92 snd_seq_port_info_malloc(&m_Info);
103 snd_seq_port_info_malloc(&m_Info);
112 snd_seq_port_info_free(m_Info);
132 snd_seq_port_info_copy(m_Info, other.m_Info);
133 m_ReadSubscribers = other.m_ReadSubscribers;
134 m_WriteSubscribers = other.m_WriteSubscribers;
135 m_ClientName = other.m_ClientName;
147 return snd_seq_port_info_get_client(m_Info);
158 return snd_seq_port_info_get_port(m_Info);
166 const snd_seq_addr_t*
169 return snd_seq_port_info_get_addr(m_Info);
180 return QString(snd_seq_port_info_get_name(m_Info));
191 return snd_seq_port_info_get_capability(m_Info);
202 return snd_seq_port_info_get_type(m_Info);
213 return snd_seq_port_info_get_midi_channels(m_Info);
224 return snd_seq_port_info_get_midi_voices(m_Info);
235 return snd_seq_port_info_get_synth_voices(m_Info);
245 return snd_seq_port_info_get_read_use(m_Info);
255 return snd_seq_port_info_get_write_use(m_Info);
266 return snd_seq_port_info_get_port_specified(m_Info);
277 snd_seq_port_info_set_client(m_Info, client);
288 snd_seq_port_info_set_port(m_Info, port);
299 snd_seq_port_info_set_addr(m_Info, addr);
310 snd_seq_port_info_set_name(m_Info, name.toLocal8Bit().data());
332 snd_seq_port_info_set_capability(m_Info, capability);
359 snd_seq_port_info_set_type(m_Info, type);
370 snd_seq_port_info_set_midi_channels(m_Info, channels);
381 snd_seq_port_info_set_midi_voices(m_Info, voices);
392 snd_seq_port_info_set_synth_voices(m_Info, voices);
403 snd_seq_port_info_set_port_specified(m_Info, val);
413 return m_ReadSubscribers;
423 return m_WriteSubscribers;
439 subs.
setType(SND_SEQ_QUERY_SUBS_READ);
442 while (snd_seq_query_port_subscribers(seq->
getHandle(), subs.m_Info) >= 0)
444 m_ReadSubscribers.append(subs);
448 subs.
setType(SND_SEQ_QUERY_SUBS_WRITE);
451 while (snd_seq_query_port_subscribers(seq->
getHandle(), subs.m_Info) >= 0)
453 m_WriteSubscribers.append(subs);
464 m_ReadSubscribers.clear();
465 m_WriteSubscribers.clear();
475 return snd_seq_port_info_sizeof();
486 return (snd_seq_port_info_get_timestamping(m_Info) == 1);
497 return (snd_seq_port_info_get_timestamp_real(m_Info) == 1);
508 return snd_seq_port_info_get_timestamp_queue(m_Info);
519 snd_seq_port_info_set_timestamping(m_Info, value?1:0);
530 snd_seq_port_info_set_timestamp_real(m_Info, value?1:0);
541 snd_seq_port_info_set_timestamp_queue(m_Info, queueId);
551 m_MidiClient( NULL ),
583 return m_Subscriptions;
592 m_Subscriptions.clear();
602 if (m_MidiClient != seq)
618 m_Subscriptions.append(*subs);
630 if (m_MidiClient == NULL)
635 SubscriptionsList::iterator it;
636 for(it = m_Subscriptions.begin(); it != m_Subscriptions.end(); ++it)
644 m_Subscriptions.erase(it);
673 addr.client = client;
689 if ((m_MidiClient != NULL) && (m_MidiClient->
getHandle() != NULL))
708 if ((m_MidiClient != NULL) && (m_MidiClient->
getHandle() != NULL))
726 if ((m_MidiClient != NULL) && (m_MidiClient->
getHandle() != NULL))
742 if ((m_MidiClient != NULL) && (m_MidiClient->
getHandle() != NULL))
773 addr.client = client;
789 if ((m_MidiClient != NULL) && (m_MidiClient->
getHandle() != NULL))
808 if ((m_MidiClient != NULL) && (m_MidiClient->
getHandle() != NULL))
826 if ((m_MidiClient != NULL) && (m_MidiClient->
getHandle() != NULL))
842 if ((m_MidiClient != NULL) && (m_MidiClient->
getHandle() != NULL))
856 subscribeFrom(SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
865 if (m_MidiClient == NULL) {
868 SubscriptionsList::Iterator it;
869 for( it = m_Subscriptions.begin(); it != m_Subscriptions.end(); ++it) {
873 m_Subscriptions.clear();
882 if (m_Attached && (m_MidiClient != NULL) && (m_MidiClient->
isOpened()))
885 m_Info.
getPort(), m_Info.m_Info ));
1099 if (!m_Attached && (seq != NULL)) {
1113 if (m_Attached && (m_MidiClient != NULL)) {
1138 SubscribersList::ConstIterator it;
1139 for(it = subs.constBegin(); it != subs.constEnd(); ++it) {
1141 int client = s.
getAddr()->client;
1142 if ((client != SND_SEQ_CLIENT_SYSTEM) && (client != m_Info.
getClient())) {
1144 PortInfo p(m_MidiClient, client, port);
1145 if ((p.
getCapability() & SND_SEQ_PORT_CAP_NO_EXPORT) == 0) {
1163 SubscribersList::ConstIterator it;
1164 for(it = subs.constBegin(); it != subs.constEnd(); ++it) {
1166 int client = s.
getAddr()->client;
1167 if ((client != SND_SEQ_CLIENT_SYSTEM) && (client != m_Info.
getClient())) {
1169 PortInfo p(m_MidiClient, client, port);
1170 if ((p.
getCapability() & SND_SEQ_PORT_CAP_NO_EXPORT) == 0) {
1188 PortInfoList::ConstIterator i;
1189 for( i = lst.begin(); i != lst.end(); ++i) {
1191 if ((p.
getAddr()->client == addr->client) &&
1192 (p.
getAddr()->port == addr->port)) {
1207 PortInfoList::ConstIterator i;
1208 for (i = subs.constBegin(); i != subs.constEnd(); ++i) {
1214 for (i = ports.constBegin(); i != ports.constEnd(); ++i) {
1230 PortInfoList::ConstIterator i;
1231 for (i = subs.constBegin(); i != subs.constEnd(); ++i) {
1237 for (i = ports.constBegin(); i != ports.constEnd(); ++i) {
PortInfoList getReadSubscribers()
Gets the list of read subscribers.
void unsubscribeAll()
Unsubscribe all subscriptions.
void setClient(int client)
Sets the client number.
void setCapability(unsigned int newValue)
Sets the port capabilities.
int getMidiVoices()
Gets the MIDI voices.
void portAttach(MidiPort *port)
Attach a MidiPort instance to this client.
void setPortSpecified(int val)
Sets the port-specified mode.
void detached(MidiPort *port)
Signal emitted when the port is detached from a MidiClient.
void updateConnectionsFrom(const PortInfoList &desired)
Update the read susbcriptions.
void portDetach(MidiPort *port)
Detach a MidiPort instance from this client.
int getWriteUse()
Gets the number of write subscriptions.
const snd_seq_addr_t * getAddr()
Gets the subscriber's address.
QList< Subscriber > SubscribersList
List of subscribers.
Classes managing ALSA Sequencer clients.
bool parseAddress(const QString &straddr, snd_seq_addr &result)
Parse a text address representation, returning an ALSA address record.
void unsubscribe(Subscription *subs)
Unsubscribe a Subscription object.
void subscribe(Subscription *subs)
Subscribe a Subscription object.
void setPortType(unsigned int newValue)
Sets the port type bitmap.
int getPortId()
Gets the port number.
int getSynthVoices()
Gets the synth voices.
bool isOpened()
Returns true if the sequencer is opened.
int getMidiChannels()
Gets the MIDI channels.
snd_seq_t * getHandle()
Returns the sequencer handler managed by ALSA.
unsigned int getPortType()
Gets the port type.
void freeSubscriptions()
Releases the lists of subscriptions.
int getTimestampQueue()
Gets the timestamping queue number.
const snd_seq_addr_t * getSender()
Gets the sender address of the subscription (MIDI OUT port)
void setPortName(QString const &newName)
Sets the port name.
bool getTimestampReal()
Gets the timestamp real mode.
QList< Subscription > SubscriptionsList
List of subscriptions.
void updateSubscribers()
Update the subscribers list in the PortInfo member.
The QObject class is the base class of all Qt objects.
int getSynthVoices()
Gets the synth voices.
void setTimestampQueue(int queueId)
Sets the timestamp queue number.
void applyPortInfo()
Applies all the the delayed PortInfo changes to the MIDI port object.
SubscribersList getWriteSubscribers() const
Gets the list of write subscribers.
void attach(MidiClient *seq)
Attach the port to a MidiClient instance.
void unsubscribeTo(QString const &name)
Unsubscribe a destination port.
int getClient()
Gets the client number.
QList< PortInfo > PortInfoList
List of port information objects.
int getMidiChannels()
Gets the MIDI channels.
SubscriptionsList getSubscriptions() const
Gets the list of susbcriptions.
void subscribeFromAnnounce()
Subscribe from the System:announce port.
SubscribersList getReadSubscribers() const
Gets the list of read subscribers.
void subscribed(MidiPort *port, Subscription *subs)
Signal emitted when an internal subscription is done.
void setClientName(QString name)
Sets the client name.
void unsubscribeFrom(QString const &name)
Unsubscribe a source port.
void setMidiClient(MidiClient *seq)
Sets the MidiClient.
void subscribeTo(PortInfo *port)
Subscribe to another port destination.
MidiPort(QObject *parent=0)
Constructor.
void setMidiVoices(int voices)
Sets the MIDI voices.
int getPortSpecified()
Gets the port-specified mode.
void unsubscribe(MidiClient *seq)
Breaks the subscription in the ALSA sequencer subsystem.
PortInfo & operator=(const PortInfo &other)
Assignment operator.
unsigned int getCapability()
Gets the port capabilities.
void setMidiChannels(int channels)
Set the MIDI channels.
PortInfoList getWriteSubscribers()
Gets the list of write subscribers.
void setCapability(unsigned int capability)
Sets the capability bitmap.
void updateConnectionsTo(const PortInfoList &desired)
Update the write subscriptions.
static bool containsAddress(const snd_seq_addr_t *addr, const PortInfoList &lst)
Checks if the provided address is included in the port list.
void midiClientChanged(MidiPort *port, MidiClient *seq)
Signal emitted when the MidiClient has changed.
PortInfo()
Default constructor.
void setType(unsigned int type)
Sets the port type.
unsigned int getCapability()
Gets the capabilities bitmap.
QString getClientName()
Gets the client's public name.
void setIndex(int index)
Sets the index of the subscriber.
void subscribe(MidiClient *seq)
Performs the subscription in the ALSA sequencer subsystem.
void setSynthVoices(int newValue)
Sets the synth voices.
void readSubscribers(MidiClient *seq)
Obtains the port subscribers lists.
int getMidiVoices()
Gets the MIDI voices.
void setMidiChannels(int newValue)
Sets the MIDI channels.
void setTimestampReal(bool value)
Sets the timestamp real mode.
int getTimestampQueue()
Gets the timestamp queue number.
PortInfo * getPortInfo()
Gets the PortInfo object pointer.
QString getPortName()
Gets the port name.
void setRoot(snd_seq_addr_t *addr)
Sets the subscriber's root address.
void detach()
Detach the port from any MidiClient instance previously attached.
void subscribeFrom(PortInfo *port)
Subscribe a source port.
void setMidiVoices(int newValue)
Sets the MIDI voices.
Port information container.
bool getTimestampReal()
Gets the timestamping real mode.
bool getTimestamping()
Gets the timestamping mode.
const snd_seq_addr_t * getDest()
Gets the destination address of the subscription (MIDI IN port)
void setTimestamping(bool value)
Sets the timestamping mode.
void attached(MidiPort *port)
Signal emitted when the port is attached to a MidiClient.
void setType(snd_seq_query_subs_type_t type)
Sets the subscription type.
void setDest(unsigned char client, unsigned char port)
Sets the Subscription's destination (MIDI IN) port.
bool getTimestamping()
Gets the timestamping mode.
void setTimestamping(bool value)
Sets the timestamping mode.
void setSender(unsigned char client, unsigned char port)
Sets the Subscription's sender (MIDI OUT) port.
virtual ~PortInfo()
Destructor.
void setTimestampQueue(int queueId)
Sets the timestamp queue number.
int getSizeOfInfo() const
Gets the size of the ALSA info object.
int getPort()
Gets the port number.
int getReadUse()
Get the number of read subscriptions.
QString getName()
Gets the port name.
void setName(QString const &name)
Sets the port name.
#define CHECK_WARNING(x)
This macro calls the check warning function.
Classes managing ALSA Sequencer queues.
const snd_seq_addr_t * getAddr()
Gets the address record for this port.
unsigned int getType()
Gets the port type.
virtual ~MidiPort()
Destructor.
void setSynthVoices(int voices)
Sets the synth voices.
void freeSubscribers()
Releases the subscribers lists.
Subscriber container class.
void setTimestampReal(bool value)
Sets the timestamping real mode.
PortInfo * clone()
Copy the current object.
void setPort(int port)
Set the port number.
void setAddr(const snd_seq_addr_t *addr)
Sets the address record.
int getIndex()
Gets the index of the subscriber container.