drumstick 2.10.0
C++ MIDI libraries using Qt objects, idioms, and style.
alsaport.cpp
Go to the documentation of this file.
1/*
2 MIDI Sequencer C++ library
3 Copyright (C) 2006-2024, Pedro Lopez-Cabanillas <plcl@users.sf.net>
4
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#include <QMetaMethod>
20
21#include "errorcheck.h"
23#include <drumstick/alsaqueue.h>
24
30namespace drumstick {
31namespace ALSA {
32
60{
61 snd_seq_port_info_malloc(&m_Info);
62}
63
69{
70 snd_seq_port_info_malloc(&m_Info);
71 snd_seq_port_info_copy(m_Info, other.m_Info);
72 m_ReadSubscribers = other.m_ReadSubscribers;
73 m_WriteSubscribers = other.m_WriteSubscribers;
74 m_ClientName = other.m_ClientName;
75}
76
81PortInfo::PortInfo(snd_seq_port_info_t* other)
82{
83 snd_seq_port_info_malloc(&m_Info);
84 snd_seq_port_info_copy(m_Info, other);
85}
86
93PortInfo::PortInfo(MidiClient* seq, const int client, const int port)
94{
95 snd_seq_port_info_malloc(&m_Info);
96 DRUMSTICK_ALSA_CHECK_WARNING(snd_seq_get_any_port_info(seq->getHandle(), client, port, m_Info));
97}
98
104PortInfo::PortInfo(MidiClient* seq, const int port)
105{
106 snd_seq_port_info_malloc(&m_Info);
107 DRUMSTICK_ALSA_CHECK_WARNING(snd_seq_get_port_info(seq->getHandle(), port, m_Info));
108}
109
114{
115 snd_seq_port_info_free(m_Info);
117}
118
124{
125 return new PortInfo(m_Info);
126}
127
134{
135 if (this == &other)
136 return *this;
137 snd_seq_port_info_copy(m_Info, other.m_Info);
138 m_ReadSubscribers = other.m_ReadSubscribers;
139 m_WriteSubscribers = other.m_WriteSubscribers;
140 m_ClientName = other.m_ClientName;
141 return *this;
142}
143
149int
151{
152 return snd_seq_port_info_get_client(m_Info);
153}
154
160int
162{
163 return snd_seq_port_info_get_port(m_Info);
164}
165
172{
173 return m_ClientName;
174}
175
181const snd_seq_addr_t*
183{
184 return snd_seq_port_info_get_addr(m_Info);
185}
186
192QString
194{
195 return QString(snd_seq_port_info_get_name(m_Info));
196}
197
203unsigned int
205{
206 return snd_seq_port_info_get_capability(m_Info);
207}
208
214unsigned int
216{
217 return snd_seq_port_info_get_type(m_Info);
218}
219
225int
227{
228 return snd_seq_port_info_get_midi_channels(m_Info);
229}
230
236int
238{
239 return snd_seq_port_info_get_midi_voices(m_Info);
240}
241
247int
249{
250 return snd_seq_port_info_get_synth_voices(m_Info);
251}
252
257int
259{
260 return snd_seq_port_info_get_read_use(m_Info);
261}
262
267int
269{
270 return snd_seq_port_info_get_write_use(m_Info);
271}
272
278int
280{
281 return snd_seq_port_info_get_port_specified(m_Info);
282}
283
289void
291{
292 snd_seq_port_info_set_client(m_Info, client);
293}
294
300void
302{
303 snd_seq_port_info_set_port(m_Info, port);
304}
305
311void
312PortInfo::setAddr(const snd_seq_addr_t* addr)
313{
314 snd_seq_port_info_set_addr(m_Info, addr);
315}
316
322void
323PortInfo::setName(QString const& name)
324{
325 snd_seq_port_info_set_name(m_Info, name.toLocal8Bit().data());
326}
327
344void
345PortInfo::setCapability(unsigned int capability)
346{
347 snd_seq_port_info_set_capability(m_Info, capability);
348}
349
371void
372PortInfo::setType(unsigned int type)
373{
374 snd_seq_port_info_set_type(m_Info, type);
375}
376
382void
384{
385 snd_seq_port_info_set_midi_channels(m_Info, channels);
386}
387
393void
395{
396 snd_seq_port_info_set_midi_voices(m_Info, voices);
397}
398
404void
406{
407 snd_seq_port_info_set_synth_voices(m_Info, voices);
408}
409
415void
417{
418 snd_seq_port_info_set_port_specified(m_Info, val);
419}
420
427{
428 return m_ReadSubscribers; // copy
429}
430
437{
438 return m_WriteSubscribers; // copy
439}
440
445void
447{
448 Subscriber subs;
449 snd_seq_addr_t tmp;
451 tmp.client = getClient();
452 tmp.port = getPort();
453 // Read subs
454 subs.setType(SND_SEQ_QUERY_SUBS_READ);
455 subs.setIndex(0);
456 subs.setRoot(&tmp);
457 while (snd_seq_query_port_subscribers(seq->getHandle(), subs.m_Info) >= 0)
458 {
459 m_ReadSubscribers.append(subs);
460 subs.setIndex(subs.getIndex() + 1);
461 }
462 // Write subs
463 subs.setType(SND_SEQ_QUERY_SUBS_WRITE);
464 subs.setIndex(0);
465 subs.setRoot(&tmp);
466 while (snd_seq_query_port_subscribers(seq->getHandle(), subs.m_Info) >= 0)
467 {
468 m_WriteSubscribers.append(subs);
469 subs.setIndex(subs.getIndex() + 1);
470 }
471}
472
476void
478{
479 m_ReadSubscribers.clear();
480 m_WriteSubscribers.clear();
481}
482
488void PortInfo::setClientName(QString name)
489{
490 m_ClientName = name;
491}
492
497int
499{
500 return snd_seq_port_info_sizeof();
501}
502
508bool
510{
511 return (snd_seq_port_info_get_timestamping(m_Info) == 1);
512}
513
519bool
521{
522 return (snd_seq_port_info_get_timestamp_real(m_Info) == 1);
523}
524
530int
532{
533 return snd_seq_port_info_get_timestamp_queue(m_Info);
534}
535
541void
543{
544 snd_seq_port_info_set_timestamping(m_Info, value?1:0);
545}
546
552void
554{
555 snd_seq_port_info_set_timestamp_real(m_Info, value?1:0);
556}
557
563void
565{
566 snd_seq_port_info_set_timestamp_queue(m_Info, queueId);
567}
568
569
575 QObject( parent ),
576 m_MidiClient( nullptr ),
577 m_Attached( false )
578{}
579
586{
588 detach();
590}
591
598{
599 return &m_Info;
600}
601
608{
609 return m_Subscriptions;
610}
611
615void
617{
618 m_Subscriptions.clear();
619}
620
625void
627{
628 if (m_MidiClient != seq)
629 {
630 m_MidiClient = seq;
631 Q_EMIT midiClientChanged( this, m_MidiClient );
633 }
634}
635
640void
642{
643 static const QMetaMethod subscribedSignal = QMetaMethod::fromSignal(&MidiPort::subscribed);
644 subs->subscribe(m_MidiClient);
645 m_Subscriptions.append(*subs);
646 if (isSignalConnected(subscribedSignal)) {
647 Q_EMIT subscribed(this, subs->clone());
648 }
649}
650
655void
657{
658 Subscription subs2;
659 if (m_MidiClient == nullptr)
660 {
661 return;
662 }
663 subs->unsubscribe(m_MidiClient);
664 SubscriptionsList::iterator it;
665 for(it = m_Subscriptions.begin(); it != m_Subscriptions.end(); ++it)
666 {
667 subs2 = (*it);
668 if ((subs2.getSender()->client == subs->getSender()->client) &&
669 (subs2.getSender()->port == subs->getSender()->port) &&
670 (subs2.getDest()->client == subs->getDest()->client) &&
671 (subs2.getDest()->port == subs->getDest()->port))
672 {
673 m_Subscriptions.erase(it);
674 break;
675 }
676 }
677}
678
683void
685{
686 Subscription subs;
687 subs.setSender(m_Info.getAddr());
688 subs.setDest(info->getAddr());
689 subscribe(&subs);
690}
691
697void
698MidiPort::subscribeTo( int client, int port )
699{
700 Subscription subs;
701 snd_seq_addr addr;
702 addr.client = client;
703 addr.port = port;
704 subs.setSender(m_Info.getAddr());
705 subs.setDest(&addr);
706 subscribe(&subs);
707}
708
713void
714MidiPort::subscribeTo( QString const& name )
715{
716 Subscription subs;
717 snd_seq_addr addr;
718 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
719 {
720 subs.setSender(m_Info.getAddr());
721 if (m_MidiClient->parseAddress(name, addr)) {
722 subs.setDest(&addr);
723 subscribe(&subs);
724 }
725 }
726}
727
732void
733MidiPort::unsubscribeTo( QString const& name )
734{
735 Subscription subs;
736 snd_seq_addr addr;
737 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
738 {
739 subs.setSender(m_Info.getAddr());
740 if (m_MidiClient->parseAddress(name, addr)) {
741 subs.setDest(&addr);
742 unsubscribe(&subs);
743 }
744 }
745}
746
751void
753{
754 Subscription subs;
755 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
756 {
757 subs.setSender(m_Info.getAddr());
758 subs.setDest(port->getAddr());
759 unsubscribe(&subs);
760 }
761}
762
767void
768MidiPort::unsubscribeTo( const snd_seq_addr_t* addr )
769{
770 Subscription subs;
771 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
772 {
773 subs.setSender(m_Info.getAddr());
774 subs.setDest(addr);
775 unsubscribe(&subs);
776 }
777}
778
783void
785{
786 Subscription subs;
787 subs.setSender( port->getAddr() );
788 subs.setDest( m_Info.getAddr() );
789 subscribe(&subs);
790}
791
797void
798MidiPort::subscribeFrom( int client, int port )
799{
800 Subscription subs;
801 snd_seq_addr addr;
802 addr.client = client;
803 addr.port = port;
804 subs.setSender(&addr);
805 subs.setDest(m_Info.getAddr());
806 subscribe(&subs);
807}
808
813void
814MidiPort::subscribeFrom( QString const& name )
815{
816 Subscription subs;
817 snd_seq_addr addr;
818 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
819 {
820 if (m_MidiClient->parseAddress(name, addr)) {
821 subs.setSender(&addr);
822 subs.setDest(m_Info.getAddr());
823 subscribe(&subs);
824 }
825 }
826}
827
832void
833MidiPort::unsubscribeFrom( QString const& name )
834{
835 Subscription subs;
836 snd_seq_addr addr;
837 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
838 {
839 if (m_MidiClient->parseAddress(name, addr)) {
840 subs.setSender(&addr);
841 subs.setDest(m_Info.getAddr());
842 unsubscribe(&subs);
843 }
844 }
845}
846
851void
853{
854 Subscription subs;
855 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
856 {
857 subs.setSender(port->getAddr());
858 subs.setDest(m_Info.getAddr());
859 unsubscribe(&subs);
860 }
861}
862
867void
868MidiPort::unsubscribeFrom( const snd_seq_addr_t* addr )
869{
870 Subscription subs;
871 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
872 {
873 subs.setSender(addr);
874 subs.setDest(m_Info.getAddr());
875 unsubscribe(&subs);
876 }
877}
878
882void
884{
885 subscribeFrom(SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
886}
887
891void
893{
894 if (m_MidiClient == nullptr) {
895 return;
896 }
897 SubscriptionsList::Iterator it;
898 for( it = m_Subscriptions.begin(); it != m_Subscriptions.end(); ++it) {
899 Subscription s = (*it);
900 s.unsubscribe(m_MidiClient);
901 }
902 m_Subscriptions.clear();
903}
904
908void
910{
911 if (m_Attached && (m_MidiClient != nullptr) && (m_MidiClient->isOpened()))
912 {
913 DRUMSTICK_ALSA_CHECK_WARNING(snd_seq_set_port_info( m_MidiClient->getHandle(),
914 m_Info.getPort(), m_Info.m_Info ));
915 }
916}
917
922QString
924{
925 return m_Info.getName();
926}
927
932void
933MidiPort::setPortName( QString const& newName )
934{
935 m_Info.setName(newName);
937}
938
943int
945{
946 return m_Info.getPort();
947}
948
954unsigned int
956{
957 return m_Info.getCapability();
958}
959
965void
966MidiPort::setCapability(unsigned int newValue)
967{
968 m_Info.setCapability(newValue);
970}
971
977unsigned int
979{
980 return m_Info.getType();
981}
982
988void
989MidiPort::setPortType( unsigned int newValue)
990{
991 m_Info.setType( newValue );
993}
994
999int
1001{
1002 return m_Info.getMidiChannels();
1003}
1004
1009void
1011{
1012 m_Info.setMidiChannels( newValue );
1013 applyPortInfo();
1014}
1015
1020int
1022{
1023 return m_Info.getMidiVoices();
1024}
1025
1030void
1032{
1033 m_Info.setMidiVoices( newValue );
1034 applyPortInfo();
1035}
1036
1041int
1043{
1044 return m_Info.getSynthVoices();
1045}
1046
1051void
1053{
1054 m_Info.setSynthVoices( newValue );
1055 applyPortInfo();
1056}
1057
1062bool
1064{
1065 return m_Info.getTimestamping();
1066}
1067
1072bool
1074{
1075 return m_Info.getTimestampReal();
1076}
1077
1082int
1084{
1085 return m_Info.getTimestampQueue();
1086}
1087
1092void
1094{
1095 m_Info.setTimestamping(value);
1096 applyPortInfo();
1097}
1098
1103void
1105{
1106 m_Info.setTimestampReal(value);
1107 applyPortInfo();
1108}
1109
1114void
1116{
1117 m_Info.setTimestampQueue(queueId);
1118 applyPortInfo();
1119}
1120
1125void
1127{
1128 if (!m_Attached && (seq != nullptr)) {
1129 m_MidiClient = seq;
1130 m_MidiClient->portAttach(this);
1131 m_Attached = true;
1132 Q_EMIT attached(this);
1133 }
1134}
1135
1139void
1141{
1142 if (m_Attached && (m_MidiClient != nullptr)) {
1143 m_MidiClient->portDetach(this);
1144 m_Attached = false;
1145 Q_EMIT detached(this);
1146 }
1147}
1148
1152void
1154{
1155 m_Info.readSubscribers(m_MidiClient);
1156}
1157
1164{
1165 const SubscribersList subs(m_Info.getReadSubscribers());
1166 PortInfoList lst;
1167 SubscribersList::ConstIterator it;
1168 for(it = subs.constBegin(); it != subs.constEnd(); ++it) {
1169 Subscriber s = *it;
1170 int client = s.getAddr()->client;
1171 if ((client != SND_SEQ_CLIENT_SYSTEM) && (client != m_Info.getClient())) {
1172 int port = s.getAddr()->port;
1173 PortInfo p(m_MidiClient, client, port);
1174 if ((p.getCapability() & SND_SEQ_PORT_CAP_NO_EXPORT) == 0) {
1175 p.setClientName(m_MidiClient->getClientName(client));
1176 lst << p;
1177 }
1178 }
1179 }
1180 return lst;
1181}
1182
1189{
1190 const SubscribersList subs(m_Info.getWriteSubscribers());
1191 PortInfoList lst;
1192 SubscribersList::ConstIterator it;
1193 for(it = subs.constBegin(); it != subs.constEnd(); ++it) {
1194 Subscriber s = *it;
1195 int client = s.getAddr()->client;
1196 if ((client != SND_SEQ_CLIENT_SYSTEM) && (client != m_Info.getClient())) {
1197 int port = s.getAddr()->port;
1198 PortInfo p(m_MidiClient, client, port);
1199 if ((p.getCapability() & SND_SEQ_PORT_CAP_NO_EXPORT) == 0) {
1200 p.setClientName(m_MidiClient->getClientName(client));
1201 lst << p;
1202 }
1203 }
1204 }
1205 return lst;
1206}
1207
1214bool
1215MidiPort::containsAddress(const snd_seq_addr_t* addr, const PortInfoList& lst)
1216{
1217 PortInfoList::ConstIterator i;
1218 for( i = lst.begin(); i != lst.end(); ++i) {
1219 PortInfo p = *i;
1220 if ((p.getAddr()->client == addr->client) &&
1221 (p.getAddr()->port == addr->port)) {
1222 return true;
1223 }
1224 }
1225 return false;
1226}
1227
1232void
1234{
1236 PortInfoList::ConstIterator i;
1237 for (i = subs.constBegin(); i != subs.constEnd(); ++i) {
1238 PortInfo s = *i;
1239 if (!containsAddress(s.getAddr(), ports)) {
1241 }
1242 }
1243 for (i = ports.constBegin(); i != ports.constEnd(); ++i) {
1244 PortInfo p = *i;
1245 if (!containsAddress(p.getAddr(), subs)) {
1246 subscribeTo(&p);
1247 }
1248 }
1249}
1250
1255void
1257{
1259 PortInfoList::ConstIterator i;
1260 for (i = subs.constBegin(); i != subs.constEnd(); ++i) {
1261 PortInfo s = *i;
1262 if (!containsAddress(s.getAddr(), ports)) {
1264 }
1265 }
1266 for (i = ports.constBegin(); i != ports.constEnd(); ++i) {
1267 PortInfo p = *i;
1268 if (!containsAddress(p.getAddr(), subs)) {
1269 subscribeFrom(&p);
1270 }
1271 }
1272}
1273
1274} // namespace ALSA
1275} // namespace drumstick
1276
Classes managing ALSA Sequencer clients.
Classes managing ALSA Sequencer queues.
The QObject class is the base class of all Qt objects.
Client management.
Definition: alsaclient.h:219
QString getPortName()
Gets the port name.
Definition: alsaport.cpp:923
void freeSubscriptions()
Releases the lists of subscriptions.
Definition: alsaport.cpp:616
void detached(drumstick::ALSA::MidiPort *port)
Signal emitted when the port is detached from a MidiClient.
MidiPort(QObject *parent=nullptr)
Constructor.
Definition: alsaport.cpp:574
void subscribeTo(PortInfo *port)
Subscribe to another port destination.
Definition: alsaport.cpp:684
void updateConnectionsTo(const PortInfoList &desired)
Update the write subscriptions.
Definition: alsaport.cpp:1233
virtual ~MidiPort()
Destructor.
Definition: alsaport.cpp:585
void unsubscribeAll()
Unsubscribe all subscriptions.
Definition: alsaport.cpp:892
void attached(drumstick::ALSA::MidiPort *port)
Signal emitted when the port is attached to a MidiClient.
void unsubscribeTo(QString const &name)
Unsubscribe a destination port.
Definition: alsaport.cpp:733
void subscribe(Subscription *subs)
Subscribe a Subscription object.
Definition: alsaport.cpp:641
void subscribeFrom(PortInfo *port)
Subscribe a source port.
Definition: alsaport.cpp:784
PortInfoList getWriteSubscribers()
Gets the list of write subscribers.
Definition: alsaport.cpp:1188
bool getTimestamping()
Gets the timestamping mode.
Definition: alsaport.cpp:1063
void updateConnectionsFrom(const PortInfoList &desired)
Update the read susbcriptions.
Definition: alsaport.cpp:1256
void setPortName(QString const &newName)
Sets the port name.
Definition: alsaport.cpp:933
unsigned int getPortType()
Gets the port type.
Definition: alsaport.cpp:978
int getMidiVoices()
Gets the MIDI voices.
Definition: alsaport.cpp:1021
void unsubscribe(Subscription *subs)
Unsubscribe a Subscription object.
Definition: alsaport.cpp:656
int getTimestampQueue()
Gets the timestamp queue number.
Definition: alsaport.cpp:1083
void attach(MidiClient *seq)
Attach the port to a MidiClient instance.
Definition: alsaport.cpp:1126
void setPortType(unsigned int newValue)
Sets the port type bitmap.
Definition: alsaport.cpp:989
PortInfoList getReadSubscribers()
Gets the list of read subscribers.
Definition: alsaport.cpp:1163
int getMidiChannels()
Gets the MIDI channels.
Definition: alsaport.cpp:1000
void setCapability(unsigned int newValue)
Sets the port capabilities.
Definition: alsaport.cpp:966
bool getTimestampReal()
Gets the timestamp real mode.
Definition: alsaport.cpp:1073
static bool containsAddress(const snd_seq_addr_t *addr, const PortInfoList &lst)
Checks if the provided address is included in the port list.
Definition: alsaport.cpp:1215
void subscribeFromAnnounce()
Subscribe from the System:announce port.
Definition: alsaport.cpp:883
void setTimestamping(bool value)
Sets the timestamping mode.
Definition: alsaport.cpp:1093
void setMidiClient(MidiClient *seq)
Sets the MidiClient.
Definition: alsaport.cpp:626
int getSynthVoices()
Gets the synth voices.
Definition: alsaport.cpp:1042
int getPortId()
Gets the port number.
Definition: alsaport.cpp:944
void setMidiVoices(int newValue)
Sets the MIDI voices.
Definition: alsaport.cpp:1031
void setMidiChannels(int newValue)
Sets the MIDI channels.
Definition: alsaport.cpp:1010
void updateSubscribers()
Update the subscribers list in the PortInfo member.
Definition: alsaport.cpp:1153
void detach()
Detach the port from any MidiClient instance previously attached.
Definition: alsaport.cpp:1140
void setSynthVoices(int newValue)
Sets the synth voices.
Definition: alsaport.cpp:1052
void subscribed(drumstick::ALSA::MidiPort *port, drumstick::ALSA::Subscription *subs)
Signal emitted when an internal subscription is done.
void unsubscribeFrom(QString const &name)
Unsubscribe a source port.
Definition: alsaport.cpp:833
PortInfo * getPortInfo()
Gets the PortInfo object pointer.
Definition: alsaport.cpp:597
void midiClientChanged(drumstick::ALSA::MidiPort *port, drumstick::ALSA::MidiClient *seq)
Signal emitted when the MidiClient has changed.
void setTimestampReal(bool value)
Sets the timestamp real mode.
Definition: alsaport.cpp:1104
unsigned int getCapability()
Gets the port capabilities.
Definition: alsaport.cpp:955
void setTimestampQueue(int queueId)
Sets the timestamp queue number.
Definition: alsaport.cpp:1115
SubscriptionsList getSubscriptions() const
Gets the list of susbcriptions.
Definition: alsaport.cpp:607
void applyPortInfo()
Applies all the the delayed PortInfo changes to the MIDI port object.
Definition: alsaport.cpp:909
Port information container.
Definition: alsaport.h:52
void freeSubscribers()
Releases the subscribers lists.
Definition: alsaport.cpp:477
int getSizeOfInfo() const
Gets the size of the ALSA info object.
Definition: alsaport.cpp:498
void setCapability(unsigned int capability)
Sets the capability bitmap.
Definition: alsaport.cpp:345
int getWriteUse()
Gets the number of write subscriptions.
Definition: alsaport.cpp:268
int getPortSpecified()
Gets the port-specified mode.
Definition: alsaport.cpp:279
QString getClientName() const
Gets the client name.
Definition: alsaport.cpp:171
int getReadUse()
Get the number of read subscriptions.
Definition: alsaport.cpp:258
unsigned int getType()
Gets the port type.
Definition: alsaport.cpp:215
void setType(unsigned int type)
Sets the port type.
Definition: alsaport.cpp:372
SubscribersList getReadSubscribers() const
Gets the list of read subscribers.
Definition: alsaport.cpp:426
void readSubscribers(MidiClient *seq)
Obtains the port subscribers lists.
Definition: alsaport.cpp:446
bool getTimestamping()
Gets the timestamping mode.
Definition: alsaport.cpp:509
void setMidiVoices(int voices)
Sets the MIDI voices.
Definition: alsaport.cpp:394
int getClient()
Gets the client number.
Definition: alsaport.cpp:150
const snd_seq_addr_t * getAddr()
Gets the address record for this port.
Definition: alsaport.cpp:182
virtual ~PortInfo()
Destructor.
Definition: alsaport.cpp:113
int getPort()
Gets the port number.
Definition: alsaport.cpp:161
int getMidiVoices()
Gets the MIDI voices.
Definition: alsaport.cpp:237
int getTimestampQueue()
Gets the timestamping queue number.
Definition: alsaport.cpp:531
int getMidiChannels()
Gets the MIDI channels.
Definition: alsaport.cpp:226
bool getTimestampReal()
Gets the timestamping real mode.
Definition: alsaport.cpp:520
PortInfo & operator=(const PortInfo &other)
Assignment operator.
Definition: alsaport.cpp:133
void setTimestamping(bool value)
Sets the timestamping mode.
Definition: alsaport.cpp:542
PortInfo()
Default constructor.
Definition: alsaport.cpp:59
void setClient(int client)
Sets the client number.
Definition: alsaport.cpp:290
int getSynthVoices()
Gets the synth voices.
Definition: alsaport.cpp:248
QString getName()
Gets the port name.
Definition: alsaport.cpp:193
void setPortSpecified(int val)
Sets the port-specified mode.
Definition: alsaport.cpp:416
void setMidiChannels(int channels)
Set the MIDI channels.
Definition: alsaport.cpp:383
void setName(QString const &name)
Sets the port name.
Definition: alsaport.cpp:323
PortInfo * clone()
Copy the current object.
Definition: alsaport.cpp:123
SubscribersList getWriteSubscribers() const
Gets the list of write subscribers.
Definition: alsaport.cpp:436
void setTimestampReal(bool value)
Sets the timestamping real mode.
Definition: alsaport.cpp:553
unsigned int getCapability()
Gets the capabilities bitmap.
Definition: alsaport.cpp:204
void setClientName(QString name)
Sets the client name.
Definition: alsaport.cpp:488
void setTimestampQueue(int queueId)
Sets the timestamp queue number.
Definition: alsaport.cpp:564
void setPort(int port)
Set the port number.
Definition: alsaport.cpp:301
void setSynthVoices(int voices)
Sets the synth voices.
Definition: alsaport.cpp:405
void setAddr(const snd_seq_addr_t *addr)
Sets the address record.
Definition: alsaport.cpp:312
Subscriber container class.
Definition: subscription.h:58
void setType(snd_seq_query_subs_type_t type)
Sets the subscription type.
void setRoot(snd_seq_addr_t *addr)
Sets the subscriber's root address.
void setIndex(int index)
Sets the index of the subscriber.
int getIndex()
Gets the index of the subscriber container.
const snd_seq_addr_t * getAddr()
Gets the subscriber's address.
Subscription management.
Definition: subscription.h:97
const snd_seq_addr_t * getSender()
Gets the sender address of the subscription (MIDI OUT port)
void setSender(unsigned char client, unsigned char port)
Sets the Subscription's sender (MIDI OUT) port.
void unsubscribe(MidiClient *seq)
Breaks the subscription in the ALSA sequencer subsystem.
Subscription * clone()
Copy the current object.
void setDest(unsigned char client, unsigned char port)
Sets the Subscription's destination (MIDI IN) port.
const snd_seq_addr_t * getDest()
Gets the destination address of the subscription (MIDI IN port)
void subscribe(MidiClient *seq)
Performs the subscription in the ALSA sequencer subsystem.
Error checking functions and macros.
bool parseAddress(const QString &straddr, snd_seq_addr &result)
Parse a text address representation, returning an ALSA address record.
snd_seq_t * getHandle()
Returns the sequencer handler managed by ALSA.
Definition: alsaclient.cpp:289
void portDetach(MidiPort *port)
Detach a MidiPort instance from this client.
Definition: alsaclient.cpp:896
QString getClientName()
Gets the client's public name.
Definition: alsaclient.cpp:819
void portAttach(MidiPort *port)
Attach a MidiPort instance to this client.
Definition: alsaclient.cpp:883
bool isOpened()
Returns true if the sequencer is opened.
Definition: alsaclient.cpp:298
#define DRUMSTICK_ALSA_CHECK_WARNING(x)
This macro calls the check warning function.
Definition: errorcheck.h:86
QList< PortInfo > PortInfoList
List of port information objects.
Definition: alsaport.h:117
QList< Subscription > SubscriptionsList
List of subscriptions.
Definition: subscription.h:133
QList< Subscriber > SubscribersList
List of subscribers.
Definition: subscription.h:138
Drumstick common.
Definition: alsaclient.cpp:71