drumstick  2.10.0
C++MIDIlibrariesusingQtobjects,idioms,andstyle.
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"
22 #include <drumstick/alsaclient.h>
23 #include <drumstick/alsaqueue.h>
24 
30 namespace drumstick {
31 namespace 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 
81 PortInfo::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 
93 PortInfo::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 
104 PortInfo::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);
116  freeSubscribers();
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 
149 int
151 {
152  return snd_seq_port_info_get_client(m_Info);
153 }
154 
160 int
162 {
163  return snd_seq_port_info_get_port(m_Info);
164 }
165 
171 QString PortInfo::getClientName() const
172 {
173  return m_ClientName;
174 }
175 
181 const snd_seq_addr_t*
183 {
184  return snd_seq_port_info_get_addr(m_Info);
185 }
186 
192 QString
194 {
195  return QString(snd_seq_port_info_get_name(m_Info));
196 }
197 
203 unsigned int
205 {
206  return snd_seq_port_info_get_capability(m_Info);
207 }
208 
214 unsigned int
216 {
217  return snd_seq_port_info_get_type(m_Info);
218 }
219 
225 int
227 {
228  return snd_seq_port_info_get_midi_channels(m_Info);
229 }
230 
236 int
238 {
239  return snd_seq_port_info_get_midi_voices(m_Info);
240 }
241 
247 int
249 {
250  return snd_seq_port_info_get_synth_voices(m_Info);
251 }
252 
257 int
259 {
260  return snd_seq_port_info_get_read_use(m_Info);
261 }
262 
267 int
269 {
270  return snd_seq_port_info_get_write_use(m_Info);
271 }
272 
278 int
280 {
281  return snd_seq_port_info_get_port_specified(m_Info);
282 }
283 
289 void
291 {
292  snd_seq_port_info_set_client(m_Info, client);
293 }
294 
300 void
302 {
303  snd_seq_port_info_set_port(m_Info, port);
304 }
305 
311 void
312 PortInfo::setAddr(const snd_seq_addr_t* addr)
313 {
314  snd_seq_port_info_set_addr(m_Info, addr);
315 }
316 
322 void
323 PortInfo::setName(QString const& name)
324 {
325  snd_seq_port_info_set_name(m_Info, name.toLocal8Bit().data());
326 }
327 
344 void
345 PortInfo::setCapability(unsigned int capability)
346 {
347  snd_seq_port_info_set_capability(m_Info, capability);
348 }
349 
371 void
372 PortInfo::setType(unsigned int type)
373 {
374  snd_seq_port_info_set_type(m_Info, type);
375 }
376 
382 void
384 {
385  snd_seq_port_info_set_midi_channels(m_Info, channels);
386 }
387 
393 void
395 {
396  snd_seq_port_info_set_midi_voices(m_Info, voices);
397 }
398 
404 void
406 {
407  snd_seq_port_info_set_synth_voices(m_Info, voices);
408 }
409 
415 void
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 
445 void
447 {
448  Subscriber subs;
449  snd_seq_addr_t tmp;
450  freeSubscribers();
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 
476 void
478 {
479  m_ReadSubscribers.clear();
480  m_WriteSubscribers.clear();
481 }
482 
488 void PortInfo::setClientName(QString name)
489 {
490  m_ClientName = name;
491 }
492 
497 int
499 {
500  return snd_seq_port_info_sizeof();
501 }
502 
508 bool
510 {
511  return (snd_seq_port_info_get_timestamping(m_Info) == 1);
512 }
513 
519 bool
521 {
522  return (snd_seq_port_info_get_timestamp_real(m_Info) == 1);
523 }
524 
530 int
532 {
533  return snd_seq_port_info_get_timestamp_queue(m_Info);
534 }
535 
541 void
543 {
544  snd_seq_port_info_set_timestamping(m_Info, value?1:0);
545 }
546 
552 void
554 {
555  snd_seq_port_info_set_timestamp_real(m_Info, value?1:0);
556 }
557 
563 void
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 {
587  unsubscribeAll();
588  detach();
590 }
591 
596 PortInfo*
598 {
599  return &m_Info;
600 }
601 
608 {
609  return m_Subscriptions;
610 }
611 
615 void
617 {
618  m_Subscriptions.clear();
619 }
620 
625 void
627 {
628  if (m_MidiClient != seq)
629  {
630  m_MidiClient = seq;
631  Q_EMIT midiClientChanged( this, m_MidiClient );
632  applyPortInfo();
633  }
634 }
635 
640 void
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 
655 void
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 
683 void
685 {
686  Subscription subs;
687  subs.setSender(m_Info.getAddr());
688  subs.setDest(info->getAddr());
689  subscribe(&subs);
690 }
691 
697 void
698 MidiPort::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 
713 void
714 MidiPort::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 
732 void
733 MidiPort::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 
751 void
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 
767 void
768 MidiPort::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 
783 void
785 {
786  Subscription subs;
787  subs.setSender( port->getAddr() );
788  subs.setDest( m_Info.getAddr() );
789  subscribe(&subs);
790 }
791 
797 void
798 MidiPort::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 
813 void
814 MidiPort::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 
832 void
833 MidiPort::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 
851 void
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 
867 void
868 MidiPort::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 
882 void
884 {
885  subscribeFrom(SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
886 }
887 
891 void
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 
908 void
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 
922 QString
924 {
925  return m_Info.getName();
926 }
927 
932 void
933 MidiPort::setPortName( QString const& newName )
934 {
935  m_Info.setName(newName);
936  applyPortInfo();
937 }
938 
943 int
945 {
946  return m_Info.getPort();
947 }
948 
954 unsigned int
956 {
957  return m_Info.getCapability();
958 }
959 
965 void
966 MidiPort::setCapability(unsigned int newValue)
967 {
968  m_Info.setCapability(newValue);
969  applyPortInfo();
970 }
971 
977 unsigned int
979 {
980  return m_Info.getType();
981 }
982 
988 void
989 MidiPort::setPortType( unsigned int newValue)
990 {
991  m_Info.setType( newValue );
992  applyPortInfo();
993 }
994 
999 int
1001 {
1002  return m_Info.getMidiChannels();
1003 }
1004 
1009 void
1011 {
1012  m_Info.setMidiChannels( newValue );
1013  applyPortInfo();
1014 }
1015 
1020 int
1022 {
1023  return m_Info.getMidiVoices();
1024 }
1025 
1030 void
1032 {
1033  m_Info.setMidiVoices( newValue );
1034  applyPortInfo();
1035 }
1036 
1041 int
1043 {
1044  return m_Info.getSynthVoices();
1045 }
1046 
1051 void
1053 {
1054  m_Info.setSynthVoices( newValue );
1055  applyPortInfo();
1056 }
1057 
1062 bool
1064 {
1065  return m_Info.getTimestamping();
1066 }
1067 
1072 bool
1074 {
1075  return m_Info.getTimestampReal();
1076 }
1077 
1082 int
1084 {
1085  return m_Info.getTimestampQueue();
1086 }
1087 
1092 void
1094 {
1095  m_Info.setTimestamping(value);
1096  applyPortInfo();
1097 }
1098 
1103 void
1105 {
1106  m_Info.setTimestampReal(value);
1107  applyPortInfo();
1108 }
1109 
1114 void
1116 {
1117  m_Info.setTimestampQueue(queueId);
1118  applyPortInfo();
1119 }
1120 
1125 void
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 
1139 void
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 
1152 void
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 
1214 bool
1215 MidiPort::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 
1232 void
1234 {
1236  PortInfoList::ConstIterator i;
1237  for (i = subs.constBegin(); i != subs.constEnd(); ++i) {
1238  PortInfo s = *i;
1239  if (!containsAddress(s.getAddr(), ports)) {
1240  unsubscribeTo(s.getAddr());
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 
1255 void
1257 {
1259  PortInfoList::ConstIterator i;
1260  for (i = subs.constBegin(); i != subs.constEnd(); ++i) {
1261  PortInfo s = *i;
1262  if (!containsAddress(s.getAddr(), ports)) {
1263  unsubscribeFrom(s.getAddr());
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 
void setTimestampReal(bool value)
Sets the timestamp real mode.
Definition: alsaport.cpp:1104
bool getTimestampReal()
Gets the timestamp real mode.
Definition: alsaport.cpp:1073
void portDetach(MidiPort *port)
Detach a MidiPort instance from this client.
Definition: alsaclient.cpp:896
void subscribed(drumstick::ALSA::MidiPort *port, drumstick::ALSA::Subscription *subs)
Signal emitted when an internal subscription is done.
Error checking functions and macros.
SubscribersList getReadSubscribers() const
Gets the list of read subscribers.
Definition: alsaport.cpp:426
void freeSubscribers()
Releases the subscribers lists.
Definition: alsaport.cpp:477
MidiPort(QObject *parent=nullptr)
Constructor.
Definition: alsaport.cpp:574
void subscribeTo(PortInfo *port)
Subscribe to another port destination.
Definition: alsaport.cpp:684
void subscribeFromAnnounce()
Subscribe from the System:announce port.
Definition: alsaport.cpp:883
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 setDest(unsigned char client, unsigned char port)
Sets the Subscription&#39;s destination (MIDI IN) port.
void setClient(int client)
Sets the client number.
Definition: alsaport.cpp:290
Classes managing ALSA Sequencer clients.
int getTimestampQueue()
Gets the timestamping queue number.
Definition: alsaport.cpp:531
QString getClientName() const
Gets the client name.
Definition: alsaport.cpp:171
void setPort(int port)
Set the port number.
Definition: alsaport.cpp:301
Subscription management.
Definition: subscription.h:96
void setPortSpecified(int val)
Sets the port-specified mode.
Definition: alsaport.cpp:416
void updateConnectionsFrom(const PortInfoList &desired)
Update the read susbcriptions.
Definition: alsaport.cpp:1256
void setPortType(unsigned int newValue)
Sets the port type bitmap.
Definition: alsaport.cpp:989
unsigned int getPortType()
Gets the port type.
Definition: alsaport.cpp:978
void freeSubscriptions()
Releases the lists of subscriptions.
Definition: alsaport.cpp:616
unsigned int getCapability()
Gets the port capabilities.
Definition: alsaport.cpp:955
snd_seq_t * getHandle()
Returns the sequencer handler managed by ALSA.
Definition: alsaclient.cpp:289
void setName(QString const &name)
Sets the port name.
Definition: alsaport.cpp:323
void setTimestampReal(bool value)
Sets the timestamping real mode.
Definition: alsaport.cpp:553
#define DRUMSTICK_ALSA_CHECK_WARNING(x)
This macro calls the check warning function.
Definition: errorcheck.h:86
int getReadUse()
Get the number of read subscriptions.
Definition: alsaport.cpp:258
int getPort()
Gets the port number.
Definition: alsaport.cpp:161
Subscriber container class.
Definition: subscription.h:57
void setType(snd_seq_query_subs_type_t type)
Sets the subscription type.
The QObject class is the base class of all Qt objects.
void setMidiChannels(int newValue)
Sets the MIDI channels.
Definition: alsaport.cpp:1010
QString getName()
Gets the port name.
Definition: alsaport.cpp:193
unsigned int getType()
Gets the port type.
Definition: alsaport.cpp:215
void setTimestamping(bool value)
Sets the timestamping mode.
Definition: alsaport.cpp:1093
void setTimestamping(bool value)
Sets the timestamping mode.
Definition: alsaport.cpp:542
PortInfo * clone()
Copy the current object.
Definition: alsaport.cpp:123
int getSizeOfInfo() const
Gets the size of the ALSA info object.
Definition: alsaport.cpp:498
QString getPortName()
Gets the port name.
Definition: alsaport.cpp:923
void setTimestampQueue(int queueId)
Sets the timestamp queue number.
Definition: alsaport.cpp:564
void setTimestampQueue(int queueId)
Sets the timestamp queue number.
Definition: alsaport.cpp:1115
int getWriteUse()
Gets the number of write subscriptions.
Definition: alsaport.cpp:268
void unsubscribe(MidiClient *seq)
Breaks the subscription in the ALSA sequencer subsystem.
const snd_seq_addr_t * getAddr()
Gets the subscriber&#39;s address.
void setPortName(QString const &newName)
Sets the port name.
Definition: alsaport.cpp:933
void updateSubscribers()
Update the subscribers list in the PortInfo member.
Definition: alsaport.cpp:1153
void unsubscribeTo(QString const &name)
Unsubscribe a destination port.
Definition: alsaport.cpp:733
QList< PortInfo > PortInfoList
List of port information objects.
Definition: alsaport.h:117
int getIndex()
Gets the index of the subscriber container.
Drumstick common.
Definition: alsaclient.cpp:71
int getMidiVoices()
Gets the MIDI voices.
Definition: alsaport.cpp:237
void unsubscribeAll()
Unsubscribe all subscriptions.
Definition: alsaport.cpp:892
PortInfoList getWriteSubscribers()
Gets the list of write subscribers.
Definition: alsaport.cpp:1188
Port information container.
Definition: alsaport.h:51
const snd_seq_addr_t * getAddr()
Gets the address record for this port.
Definition: alsaport.cpp:182
int getPortId()
Gets the port number.
Definition: alsaport.cpp:944
void setCapability(unsigned int capability)
Sets the capability bitmap.
Definition: alsaport.cpp:345
bool getTimestamping()
Gets the timestamping mode.
Definition: alsaport.cpp:1063
void setMidiVoices(int newValue)
Sets the MIDI voices.
Definition: alsaport.cpp:1031
QList< Subscription > SubscriptionsList
List of subscriptions.
Definition: subscription.h:133
void subscribeFrom(PortInfo *port)
Subscribe a source port.
Definition: alsaport.cpp:784
void setSender(unsigned char client, unsigned char port)
Sets the Subscription&#39;s sender (MIDI OUT) port.
void portAttach(MidiPort *port)
Attach a MidiPort instance to this client.
Definition: alsaclient.cpp:883
void detach()
Detach the port from any MidiClient instance previously attached.
Definition: alsaport.cpp:1140
void setCapability(unsigned int newValue)
Sets the port capabilities.
Definition: alsaport.cpp:966
bool parseAddress(const QString &straddr, snd_seq_addr &result)
Parse a text address representation, returning an ALSA address record.
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
void setAddr(const snd_seq_addr_t *addr)
Sets the address record.
Definition: alsaport.cpp:312
bool getTimestamping()
Gets the timestamping mode.
Definition: alsaport.cpp:509
PortInfo & operator=(const PortInfo &other)
Assignment operator.
Definition: alsaport.cpp:133
virtual ~PortInfo()
Destructor.
Definition: alsaport.cpp:113
bool getTimestampReal()
Gets the timestamping real mode.
Definition: alsaport.cpp:520
int getPortSpecified()
Gets the port-specified mode.
Definition: alsaport.cpp:279
void setSynthVoices(int newValue)
Sets the synth voices.
Definition: alsaport.cpp:1052
int getTimestampQueue()
Gets the timestamp queue number.
Definition: alsaport.cpp:1083
void setMidiVoices(int voices)
Sets the MIDI voices.
Definition: alsaport.cpp:394
void subscribe(MidiClient *seq)
Performs the subscription in the ALSA sequencer subsystem.
PortInfo()
Default constructor.
Definition: alsaport.cpp:59
void midiClientChanged(drumstick::ALSA::MidiPort *port, drumstick::ALSA::MidiClient *seq)
Signal emitted when the MidiClient has changed.
void setSynthVoices(int voices)
Sets the synth voices.
Definition: alsaport.cpp:405
int getSynthVoices()
Gets the synth voices.
Definition: alsaport.cpp:1042
void updateConnectionsTo(const PortInfoList &desired)
Update the write subscriptions.
Definition: alsaport.cpp:1233
bool isOpened()
Returns true if the sequencer is opened.
Definition: alsaclient.cpp:298
int getMidiVoices()
Gets the MIDI voices.
Definition: alsaport.cpp:1021
void readSubscribers(MidiClient *seq)
Obtains the port subscribers lists.
Definition: alsaport.cpp:446
void setClientName(QString name)
Sets the client name.
Definition: alsaport.cpp:488
SubscribersList getWriteSubscribers() const
Gets the list of write subscribers.
Definition: alsaport.cpp:436
void setIndex(int index)
Sets the index of the subscriber.
Subscription * clone()
Copy the current object.
PortInfo * getPortInfo()
Gets the PortInfo object pointer.
Definition: alsaport.cpp:597
const snd_seq_addr_t * getDest()
Gets the destination address of the subscription (MIDI IN port)
QList< Subscriber > SubscribersList
List of subscribers.
Definition: subscription.h:138
void subscribe(Subscription *subs)
Subscribe a Subscription object.
Definition: alsaport.cpp:641
int getClient()
Gets the client number.
Definition: alsaport.cpp:150
int getMidiChannels()
Gets the MIDI channels.
Definition: alsaport.cpp:1000
unsigned int getCapability()
Gets the capabilities bitmap.
Definition: alsaport.cpp:204
virtual ~MidiPort()
Destructor.
Definition: alsaport.cpp:585
Classes managing ALSA Sequencer queues.
void unsubscribeFrom(QString const &name)
Unsubscribe a source port.
Definition: alsaport.cpp:833
void detached(drumstick::ALSA::MidiPort *port)
Signal emitted when the port is detached from a MidiClient.
void setType(unsigned int type)
Sets the port type.
Definition: alsaport.cpp:372
void setMidiChannels(int channels)
Set the MIDI channels.
Definition: alsaport.cpp:383
int getMidiChannels()
Gets the MIDI channels.
Definition: alsaport.cpp:226
void attached(drumstick::ALSA::MidiPort *port)
Signal emitted when the port is attached to a MidiClient.
void attach(MidiClient *seq)
Attach the port to a MidiClient instance.
Definition: alsaport.cpp:1126
PortInfoList getReadSubscribers()
Gets the list of read subscribers.
Definition: alsaport.cpp:1163
const snd_seq_addr_t * getSender()
Gets the sender address of the subscription (MIDI OUT port)
void unsubscribe(Subscription *subs)
Unsubscribe a Subscription object.
Definition: alsaport.cpp:656
Client management.
Definition: alsaclient.h:218
QString getClientName()
Gets the client&#39;s public name.
Definition: alsaclient.cpp:819
void setRoot(snd_seq_addr_t *addr)
Sets the subscriber&#39;s root address.
int getSynthVoices()
Gets the synth voices.
Definition: alsaport.cpp:248
void setMidiClient(MidiClient *seq)
Sets the MidiClient.
Definition: alsaport.cpp:626