drumstick 2.9.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-2023, 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 "errorcheck.h"
21#include <drumstick/alsaqueue.h>
22
28namespace drumstick {
29namespace ALSA {
30
58{
59 snd_seq_port_info_malloc(&m_Info);
60}
61
67{
68 snd_seq_port_info_malloc(&m_Info);
69 snd_seq_port_info_copy(m_Info, other.m_Info);
70 m_ReadSubscribers = other.m_ReadSubscribers;
71 m_WriteSubscribers = other.m_WriteSubscribers;
72 m_ClientName = other.m_ClientName;
73}
74
79PortInfo::PortInfo(snd_seq_port_info_t* other)
80{
81 snd_seq_port_info_malloc(&m_Info);
82 snd_seq_port_info_copy(m_Info, other);
83}
84
91PortInfo::PortInfo(MidiClient* seq, const int client, const int port)
92{
93 snd_seq_port_info_malloc(&m_Info);
94 DRUMSTICK_ALSA_CHECK_WARNING(snd_seq_get_any_port_info(seq->getHandle(), client, port, m_Info));
95}
96
102PortInfo::PortInfo(MidiClient* seq, const int port)
103{
104 snd_seq_port_info_malloc(&m_Info);
105 DRUMSTICK_ALSA_CHECK_WARNING(snd_seq_get_port_info(seq->getHandle(), port, m_Info));
106}
107
112{
113 snd_seq_port_info_free(m_Info);
115}
116
122{
123 return new PortInfo(m_Info);
124}
125
132{
133 if (this == &other)
134 return *this;
135 snd_seq_port_info_copy(m_Info, other.m_Info);
136 m_ReadSubscribers = other.m_ReadSubscribers;
137 m_WriteSubscribers = other.m_WriteSubscribers;
138 m_ClientName = other.m_ClientName;
139 return *this;
140}
141
147int
149{
150 return snd_seq_port_info_get_client(m_Info);
151}
152
158int
160{
161 return snd_seq_port_info_get_port(m_Info);
162}
163
170{
171 return m_ClientName;
172}
173
179const snd_seq_addr_t*
181{
182 return snd_seq_port_info_get_addr(m_Info);
183}
184
190QString
192{
193 return QString(snd_seq_port_info_get_name(m_Info));
194}
195
201unsigned int
203{
204 return snd_seq_port_info_get_capability(m_Info);
205}
206
212unsigned int
214{
215 return snd_seq_port_info_get_type(m_Info);
216}
217
223int
225{
226 return snd_seq_port_info_get_midi_channels(m_Info);
227}
228
234int
236{
237 return snd_seq_port_info_get_midi_voices(m_Info);
238}
239
245int
247{
248 return snd_seq_port_info_get_synth_voices(m_Info);
249}
250
255int
257{
258 return snd_seq_port_info_get_read_use(m_Info);
259}
260
265int
267{
268 return snd_seq_port_info_get_write_use(m_Info);
269}
270
276int
278{
279 return snd_seq_port_info_get_port_specified(m_Info);
280}
281
287void
289{
290 snd_seq_port_info_set_client(m_Info, client);
291}
292
298void
300{
301 snd_seq_port_info_set_port(m_Info, port);
302}
303
309void
310PortInfo::setAddr(const snd_seq_addr_t* addr)
311{
312 snd_seq_port_info_set_addr(m_Info, addr);
313}
314
320void
321PortInfo::setName(QString const& name)
322{
323 snd_seq_port_info_set_name(m_Info, name.toLocal8Bit().data());
324}
325
342void
343PortInfo::setCapability(unsigned int capability)
344{
345 snd_seq_port_info_set_capability(m_Info, capability);
346}
347
369void
370PortInfo::setType(unsigned int type)
371{
372 snd_seq_port_info_set_type(m_Info, type);
373}
374
380void
382{
383 snd_seq_port_info_set_midi_channels(m_Info, channels);
384}
385
391void
393{
394 snd_seq_port_info_set_midi_voices(m_Info, voices);
395}
396
402void
404{
405 snd_seq_port_info_set_synth_voices(m_Info, voices);
406}
407
413void
415{
416 snd_seq_port_info_set_port_specified(m_Info, val);
417}
418
425{
426 return m_ReadSubscribers; // copy
427}
428
435{
436 return m_WriteSubscribers; // copy
437}
438
443void
445{
446 Subscriber subs;
447 snd_seq_addr_t tmp;
449 tmp.client = getClient();
450 tmp.port = getPort();
451 // Read subs
452 subs.setType(SND_SEQ_QUERY_SUBS_READ);
453 subs.setIndex(0);
454 subs.setRoot(&tmp);
455 while (snd_seq_query_port_subscribers(seq->getHandle(), subs.m_Info) >= 0)
456 {
457 m_ReadSubscribers.append(subs);
458 subs.setIndex(subs.getIndex() + 1);
459 }
460 // Write subs
461 subs.setType(SND_SEQ_QUERY_SUBS_WRITE);
462 subs.setIndex(0);
463 subs.setRoot(&tmp);
464 while (snd_seq_query_port_subscribers(seq->getHandle(), subs.m_Info) >= 0)
465 {
466 m_WriteSubscribers.append(subs);
467 subs.setIndex(subs.getIndex() + 1);
468 }
469}
470
474void
476{
477 m_ReadSubscribers.clear();
478 m_WriteSubscribers.clear();
479}
480
486void PortInfo::setClientName(QString name)
487{
488 m_ClientName = name;
489}
490
495int
497{
498 return snd_seq_port_info_sizeof();
499}
500
506bool
508{
509 return (snd_seq_port_info_get_timestamping(m_Info) == 1);
510}
511
517bool
519{
520 return (snd_seq_port_info_get_timestamp_real(m_Info) == 1);
521}
522
528int
530{
531 return snd_seq_port_info_get_timestamp_queue(m_Info);
532}
533
539void
541{
542 snd_seq_port_info_set_timestamping(m_Info, value?1:0);
543}
544
550void
552{
553 snd_seq_port_info_set_timestamp_real(m_Info, value?1:0);
554}
555
561void
563{
564 snd_seq_port_info_set_timestamp_queue(m_Info, queueId);
565}
566
567
573 QObject( parent ),
574 m_MidiClient( nullptr ),
575 m_Attached( false )
576{}
577
584{
586 detach();
588}
589
596{
597 return &m_Info;
598}
599
606{
607 return m_Subscriptions;
608}
609
613void
615{
616 m_Subscriptions.clear();
617}
618
623void
625{
626 if (m_MidiClient != seq)
627 {
628 m_MidiClient = seq;
629 Q_EMIT midiClientChanged( this, m_MidiClient );
631 }
632}
633
638void
640{
641 subs->subscribe(m_MidiClient);
642 m_Subscriptions.append(*subs);
643 Q_EMIT subscribed(this, subs);
644}
645
650void
652{
653 Subscription subs2;
654 if (m_MidiClient == nullptr)
655 {
656 return;
657 }
658 subs->unsubscribe(m_MidiClient);
659 SubscriptionsList::iterator it;
660 for(it = m_Subscriptions.begin(); it != m_Subscriptions.end(); ++it)
661 {
662 subs2 = (*it);
663 if ((subs2.getSender()->client == subs->getSender()->client) &&
664 (subs2.getSender()->port == subs->getSender()->port) &&
665 (subs2.getDest()->client == subs->getDest()->client) &&
666 (subs2.getDest()->port == subs->getDest()->port))
667 {
668 m_Subscriptions.erase(it);
669 break;
670 }
671 }
672}
673
678void
680{
681 Subscription subs;
682 subs.setSender(m_Info.getAddr());
683 subs.setDest(info->getAddr());
684 subscribe(&subs);
685}
686
692void
693MidiPort::subscribeTo( int client, int port )
694{
695 Subscription subs;
696 snd_seq_addr addr;
697 addr.client = client;
698 addr.port = port;
699 subs.setSender(m_Info.getAddr());
700 subs.setDest(&addr);
701 subscribe(&subs);
702}
703
708void
709MidiPort::subscribeTo( QString const& name )
710{
711 Subscription subs;
712 snd_seq_addr addr;
713 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
714 {
715 subs.setSender(m_Info.getAddr());
716 if (m_MidiClient->parseAddress(name, addr)) {
717 subs.setDest(&addr);
718 subscribe(&subs);
719 }
720 }
721}
722
727void
728MidiPort::unsubscribeTo( QString const& name )
729{
730 Subscription subs;
731 snd_seq_addr addr;
732 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
733 {
734 subs.setSender(m_Info.getAddr());
735 if (m_MidiClient->parseAddress(name, addr)) {
736 subs.setDest(&addr);
737 unsubscribe(&subs);
738 }
739 }
740}
741
746void
748{
749 Subscription subs;
750 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
751 {
752 subs.setSender(m_Info.getAddr());
753 subs.setDest(port->getAddr());
754 unsubscribe(&subs);
755 }
756}
757
762void
763MidiPort::unsubscribeTo( const snd_seq_addr_t* addr )
764{
765 Subscription subs;
766 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
767 {
768 subs.setSender(m_Info.getAddr());
769 subs.setDest(addr);
770 unsubscribe(&subs);
771 }
772}
773
778void
780{
781 Subscription subs;
782 subs.setSender( port->getAddr() );
783 subs.setDest( m_Info.getAddr() );
784 subscribe(&subs);
785}
786
792void
793MidiPort::subscribeFrom( int client, int port )
794{
795 Subscription subs;
796 snd_seq_addr addr;
797 addr.client = client;
798 addr.port = port;
799 subs.setSender(&addr);
800 subs.setDest(m_Info.getAddr());
801 subscribe(&subs);
802}
803
808void
809MidiPort::subscribeFrom( QString const& name )
810{
811 Subscription subs;
812 snd_seq_addr addr;
813 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
814 {
815 if (m_MidiClient->parseAddress(name, addr)) {
816 subs.setSender(&addr);
817 subs.setDest(m_Info.getAddr());
818 subscribe(&subs);
819 }
820 }
821}
822
827void
828MidiPort::unsubscribeFrom( QString const& name )
829{
830 Subscription subs;
831 snd_seq_addr addr;
832 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
833 {
834 if (m_MidiClient->parseAddress(name, addr)) {
835 subs.setSender(&addr);
836 subs.setDest(m_Info.getAddr());
837 unsubscribe(&subs);
838 }
839 }
840}
841
846void
848{
849 Subscription subs;
850 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
851 {
852 subs.setSender(port->getAddr());
853 subs.setDest(m_Info.getAddr());
854 unsubscribe(&subs);
855 }
856}
857
862void
863MidiPort::unsubscribeFrom( const snd_seq_addr_t* addr )
864{
865 Subscription subs;
866 if ((m_MidiClient != nullptr) && (m_MidiClient->getHandle() != nullptr))
867 {
868 subs.setSender(addr);
869 subs.setDest(m_Info.getAddr());
870 unsubscribe(&subs);
871 }
872}
873
877void
879{
880 subscribeFrom(SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
881}
882
886void
888{
889 if (m_MidiClient == nullptr) {
890 return;
891 }
892 SubscriptionsList::Iterator it;
893 for( it = m_Subscriptions.begin(); it != m_Subscriptions.end(); ++it) {
894 Subscription s = (*it);
895 s.unsubscribe(m_MidiClient);
896 }
897 m_Subscriptions.clear();
898}
899
903void
905{
906 if (m_Attached && (m_MidiClient != nullptr) && (m_MidiClient->isOpened()))
907 {
908 DRUMSTICK_ALSA_CHECK_WARNING(snd_seq_set_port_info( m_MidiClient->getHandle(),
909 m_Info.getPort(), m_Info.m_Info ));
910 }
911}
912
917QString
919{
920 return m_Info.getName();
921}
922
927void
928MidiPort::setPortName( QString const& newName )
929{
930 m_Info.setName(newName);
932}
933
938int
940{
941 return m_Info.getPort();
942}
943
949unsigned int
951{
952 return m_Info.getCapability();
953}
954
960void
961MidiPort::setCapability(unsigned int newValue)
962{
963 m_Info.setCapability(newValue);
965}
966
972unsigned int
974{
975 return m_Info.getType();
976}
977
983void
984MidiPort::setPortType( unsigned int newValue)
985{
986 m_Info.setType( newValue );
988}
989
994int
996{
997 return m_Info.getMidiChannels();
998}
999
1004void
1006{
1007 m_Info.setMidiChannels( newValue );
1008 applyPortInfo();
1009}
1010
1015int
1017{
1018 return m_Info.getMidiVoices();
1019}
1020
1025void
1027{
1028 m_Info.setMidiVoices( newValue );
1029 applyPortInfo();
1030}
1031
1036int
1038{
1039 return m_Info.getSynthVoices();
1040}
1041
1046void
1048{
1049 m_Info.setSynthVoices( newValue );
1050 applyPortInfo();
1051}
1052
1057bool
1059{
1060 return m_Info.getTimestamping();
1061}
1062
1067bool
1069{
1070 return m_Info.getTimestampReal();
1071}
1072
1077int
1079{
1080 return m_Info.getTimestampQueue();
1081}
1082
1087void
1089{
1090 m_Info.setTimestamping(value);
1091 applyPortInfo();
1092}
1093
1098void
1100{
1101 m_Info.setTimestampReal(value);
1102 applyPortInfo();
1103}
1104
1109void
1111{
1112 m_Info.setTimestampQueue(queueId);
1113 applyPortInfo();
1114}
1115
1120void
1122{
1123 if (!m_Attached && (seq != nullptr)) {
1124 m_MidiClient = seq;
1125 m_MidiClient->portAttach(this);
1126 m_Attached = true;
1127 Q_EMIT attached(this);
1128 }
1129}
1130
1134void
1136{
1137 if (m_Attached && (m_MidiClient != nullptr)) {
1138 m_MidiClient->portDetach(this);
1139 m_Attached = false;
1140 Q_EMIT detached(this);
1141 }
1142}
1143
1147void
1149{
1150 m_Info.readSubscribers(m_MidiClient);
1151}
1152
1159{
1160 const SubscribersList subs(m_Info.getReadSubscribers());
1161 PortInfoList lst;
1162 SubscribersList::ConstIterator it;
1163 for(it = subs.constBegin(); it != subs.constEnd(); ++it) {
1164 Subscriber s = *it;
1165 int client = s.getAddr()->client;
1166 if ((client != SND_SEQ_CLIENT_SYSTEM) && (client != m_Info.getClient())) {
1167 int port = s.getAddr()->port;
1168 PortInfo p(m_MidiClient, client, port);
1169 if ((p.getCapability() & SND_SEQ_PORT_CAP_NO_EXPORT) == 0) {
1170 p.setClientName(m_MidiClient->getClientName(client));
1171 lst << p;
1172 }
1173 }
1174 }
1175 return lst;
1176}
1177
1184{
1185 const SubscribersList subs(m_Info.getWriteSubscribers());
1186 PortInfoList lst;
1187 SubscribersList::ConstIterator it;
1188 for(it = subs.constBegin(); it != subs.constEnd(); ++it) {
1189 Subscriber s = *it;
1190 int client = s.getAddr()->client;
1191 if ((client != SND_SEQ_CLIENT_SYSTEM) && (client != m_Info.getClient())) {
1192 int port = s.getAddr()->port;
1193 PortInfo p(m_MidiClient, client, port);
1194 if ((p.getCapability() & SND_SEQ_PORT_CAP_NO_EXPORT) == 0) {
1195 p.setClientName(m_MidiClient->getClientName(client));
1196 lst << p;
1197 }
1198 }
1199 }
1200 return lst;
1201}
1202
1209bool
1210MidiPort::containsAddress(const snd_seq_addr_t* addr, const PortInfoList& lst)
1211{
1212 PortInfoList::ConstIterator i;
1213 for( i = lst.begin(); i != lst.end(); ++i) {
1214 PortInfo p = *i;
1215 if ((p.getAddr()->client == addr->client) &&
1216 (p.getAddr()->port == addr->port)) {
1217 return true;
1218 }
1219 }
1220 return false;
1221}
1222
1227void
1229{
1231 PortInfoList::ConstIterator i;
1232 for (i = subs.constBegin(); i != subs.constEnd(); ++i) {
1233 PortInfo s = *i;
1234 if (!containsAddress(s.getAddr(), ports)) {
1236 }
1237 }
1238 for (i = ports.constBegin(); i != ports.constEnd(); ++i) {
1239 PortInfo p = *i;
1240 if (!containsAddress(p.getAddr(), subs)) {
1241 subscribeTo(&p);
1242 }
1243 }
1244}
1245
1250void
1252{
1254 PortInfoList::ConstIterator i;
1255 for (i = subs.constBegin(); i != subs.constEnd(); ++i) {
1256 PortInfo s = *i;
1257 if (!containsAddress(s.getAddr(), ports)) {
1259 }
1260 }
1261 for (i = ports.constBegin(); i != ports.constEnd(); ++i) {
1262 PortInfo p = *i;
1263 if (!containsAddress(p.getAddr(), subs)) {
1264 subscribeFrom(&p);
1265 }
1266 }
1267}
1268
1269} // namespace ALSA
1270} // namespace drumstick
1271
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:918
void freeSubscriptions()
Releases the lists of subscriptions.
Definition: alsaport.cpp:614
void detached(drumstick::ALSA::MidiPort *port)
Signal emitted when the port is detached from a MidiClient.
MidiPort(QObject *parent=nullptr)
Constructor.
Definition: alsaport.cpp:572
void subscribeTo(PortInfo *port)
Subscribe to another port destination.
Definition: alsaport.cpp:679
void updateConnectionsTo(const PortInfoList &desired)
Update the write subscriptions.
Definition: alsaport.cpp:1228
virtual ~MidiPort()
Destructor.
Definition: alsaport.cpp:583
void unsubscribeAll()
Unsubscribe all subscriptions.
Definition: alsaport.cpp:887
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:728
void subscribe(Subscription *subs)
Subscribe a Subscription object.
Definition: alsaport.cpp:639
void subscribeFrom(PortInfo *port)
Subscribe a source port.
Definition: alsaport.cpp:779
PortInfoList getWriteSubscribers()
Gets the list of write subscribers.
Definition: alsaport.cpp:1183
bool getTimestamping()
Gets the timestamping mode.
Definition: alsaport.cpp:1058
void updateConnectionsFrom(const PortInfoList &desired)
Update the read susbcriptions.
Definition: alsaport.cpp:1251
void setPortName(QString const &newName)
Sets the port name.
Definition: alsaport.cpp:928
unsigned int getPortType()
Gets the port type.
Definition: alsaport.cpp:973
int getMidiVoices()
Gets the MIDI voices.
Definition: alsaport.cpp:1016
void unsubscribe(Subscription *subs)
Unsubscribe a Subscription object.
Definition: alsaport.cpp:651
int getTimestampQueue()
Gets the timestamp queue number.
Definition: alsaport.cpp:1078
void attach(MidiClient *seq)
Attach the port to a MidiClient instance.
Definition: alsaport.cpp:1121
void setPortType(unsigned int newValue)
Sets the port type bitmap.
Definition: alsaport.cpp:984
PortInfoList getReadSubscribers()
Gets the list of read subscribers.
Definition: alsaport.cpp:1158
int getMidiChannels()
Gets the MIDI channels.
Definition: alsaport.cpp:995
void setCapability(unsigned int newValue)
Sets the port capabilities.
Definition: alsaport.cpp:961
bool getTimestampReal()
Gets the timestamp real mode.
Definition: alsaport.cpp:1068
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:1210
void subscribeFromAnnounce()
Subscribe from the System:announce port.
Definition: alsaport.cpp:878
void setTimestamping(bool value)
Sets the timestamping mode.
Definition: alsaport.cpp:1088
void setMidiClient(MidiClient *seq)
Sets the MidiClient.
Definition: alsaport.cpp:624
int getSynthVoices()
Gets the synth voices.
Definition: alsaport.cpp:1037
int getPortId()
Gets the port number.
Definition: alsaport.cpp:939
void setMidiVoices(int newValue)
Sets the MIDI voices.
Definition: alsaport.cpp:1026
void setMidiChannels(int newValue)
Sets the MIDI channels.
Definition: alsaport.cpp:1005
void updateSubscribers()
Update the subscribers list in the PortInfo member.
Definition: alsaport.cpp:1148
void detach()
Detach the port from any MidiClient instance previously attached.
Definition: alsaport.cpp:1135
void setSynthVoices(int newValue)
Sets the synth voices.
Definition: alsaport.cpp:1047
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:828
PortInfo * getPortInfo()
Gets the PortInfo object pointer.
Definition: alsaport.cpp:595
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:1099
unsigned int getCapability()
Gets the port capabilities.
Definition: alsaport.cpp:950
void setTimestampQueue(int queueId)
Sets the timestamp queue number.
Definition: alsaport.cpp:1110
SubscriptionsList getSubscriptions() const
Gets the list of susbcriptions.
Definition: alsaport.cpp:605
void applyPortInfo()
Applies all the the delayed PortInfo changes to the MIDI port object.
Definition: alsaport.cpp:904
Port information container.
Definition: alsaport.h:52
void freeSubscribers()
Releases the subscribers lists.
Definition: alsaport.cpp:475
int getSizeOfInfo() const
Gets the size of the ALSA info object.
Definition: alsaport.cpp:496
void setCapability(unsigned int capability)
Sets the capability bitmap.
Definition: alsaport.cpp:343
int getWriteUse()
Gets the number of write subscriptions.
Definition: alsaport.cpp:266
int getPortSpecified()
Gets the port-specified mode.
Definition: alsaport.cpp:277
QString getClientName() const
Gets the client name.
Definition: alsaport.cpp:169
int getReadUse()
Get the number of read subscriptions.
Definition: alsaport.cpp:256
unsigned int getType()
Gets the port type.
Definition: alsaport.cpp:213
void setType(unsigned int type)
Sets the port type.
Definition: alsaport.cpp:370
SubscribersList getReadSubscribers() const
Gets the list of read subscribers.
Definition: alsaport.cpp:424
void readSubscribers(MidiClient *seq)
Obtains the port subscribers lists.
Definition: alsaport.cpp:444
bool getTimestamping()
Gets the timestamping mode.
Definition: alsaport.cpp:507
void setMidiVoices(int voices)
Sets the MIDI voices.
Definition: alsaport.cpp:392
int getClient()
Gets the client number.
Definition: alsaport.cpp:148
const snd_seq_addr_t * getAddr()
Gets the address record for this port.
Definition: alsaport.cpp:180
virtual ~PortInfo()
Destructor.
Definition: alsaport.cpp:111
int getPort()
Gets the port number.
Definition: alsaport.cpp:159
int getMidiVoices()
Gets the MIDI voices.
Definition: alsaport.cpp:235
int getTimestampQueue()
Gets the timestamping queue number.
Definition: alsaport.cpp:529
int getMidiChannels()
Gets the MIDI channels.
Definition: alsaport.cpp:224
bool getTimestampReal()
Gets the timestamping real mode.
Definition: alsaport.cpp:518
PortInfo & operator=(const PortInfo &other)
Assignment operator.
Definition: alsaport.cpp:131
void setTimestamping(bool value)
Sets the timestamping mode.
Definition: alsaport.cpp:540
PortInfo()
Default constructor.
Definition: alsaport.cpp:57
void setClient(int client)
Sets the client number.
Definition: alsaport.cpp:288
int getSynthVoices()
Gets the synth voices.
Definition: alsaport.cpp:246
QString getName()
Gets the port name.
Definition: alsaport.cpp:191
void setPortSpecified(int val)
Sets the port-specified mode.
Definition: alsaport.cpp:414
void setMidiChannels(int channels)
Set the MIDI channels.
Definition: alsaport.cpp:381
void setName(QString const &name)
Sets the port name.
Definition: alsaport.cpp:321
PortInfo * clone()
Copy the current object.
Definition: alsaport.cpp:121
SubscribersList getWriteSubscribers() const
Gets the list of write subscribers.
Definition: alsaport.cpp:434
void setTimestampReal(bool value)
Sets the timestamping real mode.
Definition: alsaport.cpp:551
unsigned int getCapability()
Gets the capabilities bitmap.
Definition: alsaport.cpp:202
void setClientName(QString name)
Sets the client name.
Definition: alsaport.cpp:486
void setTimestampQueue(int queueId)
Sets the timestamp queue number.
Definition: alsaport.cpp:562
void setPort(int port)
Set the port number.
Definition: alsaport.cpp:299
void setSynthVoices(int voices)
Sets the synth voices.
Definition: alsaport.cpp:403
void setAddr(const snd_seq_addr_t *addr)
Sets the address record.
Definition: alsaport.cpp:310
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.
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:286
void portDetach(MidiPort *port)
Detach a MidiPort instance from this client.
Definition: alsaclient.cpp:890
QString getClientName()
Gets the client's public name.
Definition: alsaclient.cpp:813
void portAttach(MidiPort *port)
Attach a MidiPort instance to this client.
Definition: alsaclient.cpp:877
bool isOpened()
Returns true if the sequencer is opened.
Definition: alsaclient.cpp:295
#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:68