drumstick  2.10.0
C++MIDIlibrariesusingQtobjects,idioms,andstyle.
alsaevent.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 <cxxabi.h>
20 
21 #include "errorcheck.h"
22 #include <drumstick/alsaevent.h>
23 
35 namespace drumstick { namespace ALSA {
36 
102 {
103  snd_seq_ev_clear( &m_event );
104 }
105 
111 {
112  snd_seq_ev_clear( &m_event );
113  m_event = *event;
114 }
115 
121 {
122  snd_seq_ev_clear( &m_event );
123  m_event = other.m_event;
124 }
125 
133 {
134  m_event = other.m_event;
135  return *this;
136 }
137 
143 bool
145 {
146  snd_seq_event_type_t te = event->getSequencerType();
147  return ( te == SND_SEQ_EVENT_PORT_SUBSCRIBED ||
148  te == SND_SEQ_EVENT_PORT_UNSUBSCRIBED );
149 }
150 
156 bool
158 {
159  snd_seq_event_type_t te = event->getSequencerType();
160  return ( te == SND_SEQ_EVENT_PORT_START ||
161  te == SND_SEQ_EVENT_PORT_EXIT ||
162  te == SND_SEQ_EVENT_PORT_CHANGE );
163 }
164 
170 bool
172 {
173  snd_seq_event_type_t te = event->getSequencerType();
174  return ( te == SND_SEQ_EVENT_CLIENT_START ||
175  te == SND_SEQ_EVENT_CLIENT_EXIT ||
176  te == SND_SEQ_EVENT_CLIENT_CHANGE );
177 }
178 
184 bool
186 {
187  snd_seq_event_type_t te = event->getSequencerType();
188  return ( te == SND_SEQ_EVENT_PORT_START ||
189  te == SND_SEQ_EVENT_PORT_EXIT ||
190  te == SND_SEQ_EVENT_PORT_CHANGE ||
191  te == SND_SEQ_EVENT_CLIENT_START ||
192  te == SND_SEQ_EVENT_CLIENT_EXIT ||
193  te == SND_SEQ_EVENT_CLIENT_CHANGE ||
194  te == SND_SEQ_EVENT_PORT_SUBSCRIBED ||
195  te == SND_SEQ_EVENT_PORT_UNSUBSCRIBED );
196 }
197 
204 bool
206 {
207  snd_seq_event_type_t te = event->getSequencerType();
208  return ( te == SND_SEQ_EVENT_NOTEOFF ||
209  te == SND_SEQ_EVENT_NOTEON ||
210  te == SND_SEQ_EVENT_NOTE ||
211  te == SND_SEQ_EVENT_KEYPRESS ||
212  te == SND_SEQ_EVENT_CONTROLLER ||
213  te == SND_SEQ_EVENT_CONTROL14 ||
214  te == SND_SEQ_EVENT_PGMCHANGE ||
215  te == SND_SEQ_EVENT_CHANPRESS ||
216  te == SND_SEQ_EVENT_PITCHBEND );
217 }
218 
223 void SequencerEvent::setSequencerType(const snd_seq_event_type_t eventType)
224 {
225  m_event.type = eventType;
226 }
227 
234 void SequencerEvent::setDestination(const unsigned char client, const unsigned char port)
235 {
236  snd_seq_ev_set_dest(&m_event, client, port);
237 }
238 
244 void SequencerEvent::setSource(const unsigned char port)
245 {
246  snd_seq_ev_set_source(&m_event, port);
247 }
248 
253 {
254  snd_seq_ev_set_subs(&m_event);
255 }
256 
261 {
262  snd_seq_ev_set_broadcast(&m_event);
263 }
264 
270 {
271  snd_seq_ev_set_direct(&m_event);
272 }
273 
280 void SequencerEvent::scheduleTick(int queue, int tick, bool relative)
281 {
282  snd_seq_ev_schedule_tick(&m_event, queue, relative, tick);
283 }
284 
292 void SequencerEvent::scheduleReal(int queue, ulong secs, ulong nanos, bool relative)
293 {
294  snd_seq_real_time_t rtime;
295  rtime.tv_sec = secs;
296  rtime.tv_nsec = nanos;
297  snd_seq_ev_schedule_real(&m_event, queue, relative, &rtime);
298 }
299 
306 void SequencerEvent::setPriority(const bool high)
307 {
308  snd_seq_ev_set_priority(&m_event, high);
309 }
310 
316 void SequencerEvent::setTag(const unsigned char aTag)
317 {
318 #if SND_LIB_VERSION > 0x010008
319  snd_seq_ev_set_tag(&m_event, aTag);
320 #else
321  m_event.tag = aTag;
322 #endif
323 }
324 
331 unsigned int SequencerEvent::getRaw32(const unsigned int n) const
332 {
333  if (n < 3) return m_event.data.raw32.d[n];
334  return 0;
335 }
336 
342 void SequencerEvent::setRaw32(const unsigned int n, const unsigned int value)
343 {
344  if (n < 3) m_event.data.raw32.d[n] = value;
345 }
346 
353 unsigned char SequencerEvent::getRaw8(const unsigned int n) const
354 {
355  if (n < 12) return m_event.data.raw8.d[n];
356  return 0;
357 }
358 
364 void SequencerEvent::setRaw8(const unsigned int n, const unsigned char value)
365 {
366  if (n < 12) m_event.data.raw8.d[n] = value;
367 }
368 
374 {
375  snd_seq_free_event(&m_event);
376 }
377 
383 {
384  return snd_seq_event_length(&m_event);
385 }
386 
392 {
393  return new SequencerEvent(&m_event);
394 }
395 
401 {
402  return new ChannelEvent(&m_event);
403 }
404 
410 {
411  return new KeyEvent(&m_event);
412 }
413 
421 NoteEvent::NoteEvent(const int ch, const int key, const int vel, const int dur) : KeyEvent()
422 {
423  snd_seq_ev_set_note(&m_event, ch, key, vel, dur);
424 }
425 
431 {
432  return new NoteEvent(&m_event);
433 }
434 
441 NoteOnEvent::NoteOnEvent(int ch, int key, int vel) : KeyEvent()
442 {
443  snd_seq_ev_set_noteon(&m_event, ch, key, vel);
444 }
445 
451 {
452  return new NoteOnEvent(&m_event);
453 }
454 
461 NoteOffEvent::NoteOffEvent(int ch, int key, int vel) : KeyEvent()
462 {
463  snd_seq_ev_set_noteoff(&m_event, ch, key, vel);
464 }
465 
471 {
472  return new NoteOffEvent(&m_event);
473 }
474 
481 KeyPressEvent::KeyPressEvent(int ch, int key, int vel) : KeyEvent()
482 {
483  snd_seq_ev_set_keypress(&m_event, ch, key, vel);
484 }
485 
491 {
492  return new KeyPressEvent(&m_event);
493 }
494 
501 ControllerEvent::ControllerEvent(int ch, int cc, int val) : ChannelEvent()
502 {
503  snd_seq_ev_set_controller(&m_event, ch, cc, val);
504 }
505 
511 {
512  return new ControllerEvent(&m_event);
513 }
514 
521 {
522  snd_seq_ev_set_pgmchange(&m_event, ch, val);
523 }
524 
530 {
531  return new ProgramChangeEvent(&m_event);
532 }
533 
540 {
541  snd_seq_ev_set_pitchbend(&m_event, ch, val);
542 }
543 
549 {
550  return new PitchBendEvent(&m_event);
551 }
552 
559 {
560  snd_seq_ev_set_chanpress(&m_event, ch, val);
561 }
562 
568 {
569  return new ChanPressEvent(&m_event);
570 }
571 
576  : SequencerEvent()
577 {
578  m_data.clear();
579  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
580 }
581 
586 VariableEvent::VariableEvent(const snd_seq_event_t* event)
587  : SequencerEvent(event)
588 {
589  m_data = QByteArray((char *) event->data.ext.ptr,
590  event->data.ext.len);
591  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
592 }
593 
598 VariableEvent::VariableEvent(const QByteArray& data)
599  : SequencerEvent()
600 {
601  m_data = data;
602  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
603 }
604 
610  : SequencerEvent(other)
611 {
612  m_data = other.m_data;
613  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
614 }
615 
621 VariableEvent::VariableEvent(const unsigned int datalen, char* dataptr)
622  : SequencerEvent()
623 {
624  m_data = QByteArray(dataptr, datalen);
625  snd_seq_ev_set_variable( &m_event, m_data.size(), m_data.data() );
626 }
627 
634 {
635  m_event = other.m_event;
636  m_data = other.m_data;
637  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
638  return *this;
639 }
640 
646 {
647  return new VariableEvent(&m_event);
648 }
649 
654  : VariableEvent()
655 {
656  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
657 }
658 
663 SysExEvent::SysExEvent(const snd_seq_event_t* event)
664  : VariableEvent(event)
665 {
666  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
667 }
668 
673 SysExEvent::SysExEvent(const QByteArray& data)
674  : VariableEvent(data)
675 {
676  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
677 }
678 
684  : VariableEvent(other)
685 {
686  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
687 }
688 
694 SysExEvent::SysExEvent(const unsigned int datalen, char* dataptr)
695  : VariableEvent( datalen, dataptr )
696 {
697  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
698 }
699 
705 {
706  return new SysExEvent(&m_event);
707 }
708 
715 {
716  m_event = other.m_event;
717  m_data = other.m_data;
718  snd_seq_ev_set_sysex(&m_event, m_data.size(), m_data.data());
719  return *this;
720 }
721 
726  : VariableEvent(), m_textType(1)
727 {
728  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
729 }
730 
735 TextEvent::TextEvent(const snd_seq_event_t* event)
736  : VariableEvent(event), m_textType(1)
737 {
738  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
739 }
740 
746 TextEvent::TextEvent(const QString& text, const int textType)
747  : VariableEvent(text.toUtf8()), m_textType(textType)
748 {
749  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
750 }
751 
757  : VariableEvent(other)
758 {
759  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
760  m_textType = other.getTextType();
761 }
762 
768 TextEvent::TextEvent(const unsigned int datalen, char* dataptr)
769  : VariableEvent(datalen, dataptr), m_textType(1)
770 {
771  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
772 }
773 
778 QString TextEvent::getText() const
779 {
780  return QString::fromUtf8(m_data.data(), m_data.size());
781 }
782 
788 {
789  return m_textType;
790 }
791 
797 {
798  return new TextEvent(&m_event);
799 }
800 
807 {
808  m_event = other.m_event;
809  m_data = other.m_data;
810  m_textType = other.getTextType();
811  snd_seq_ev_set_variable(&m_event, m_data.size(), m_data.data());
812  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
813  return *this;
814 }
815 
820 SystemEvent::SystemEvent(const snd_seq_event_type_t type) : SequencerEvent()
821 {
822  snd_seq_ev_set_fixed(&m_event);
823  setSequencerType(type);
824 }
825 
831 {
832  return new SystemEvent(&m_event);
833 }
834 
841 QueueControlEvent::QueueControlEvent(snd_seq_event_type_t type, int queue, int value)
842  : SequencerEvent()
843 {
844  snd_seq_ev_set_queue_control(&m_event, type, queue, value);
845 }
846 
852 {
853  return new QueueControlEvent(&m_event);
854 }
855 
861 ValueEvent::ValueEvent(const snd_seq_event_type_t type, int val) : SequencerEvent()
862 {
863  snd_seq_ev_set_fixed(&m_event);
864  setSequencerType(type);
865  setValue(val);
866 }
867 
873 {
874  return new ValueEvent(&m_event);
875 }
876 
882 TempoEvent::TempoEvent(int queue, int tempo) : QueueControlEvent()
883 {
884  snd_seq_ev_set_queue_tempo(&m_event, queue, tempo);
885 }
886 
892 {
893  return new TempoEvent(&m_event);
894 }
895 
901 {
902  return new ClientEvent(&m_event);
903 }
904 
910 {
911  return new PortEvent(&m_event);
912 }
913 
919 {
920  return new SubscriptionEvent(&m_event);
921 }
922 
927 {
928  snd_seq_remove_events_malloc(&m_Info);
929 }
930 
936 {
937  snd_seq_remove_events_malloc(&m_Info);
938  snd_seq_remove_events_copy(m_Info, other.m_Info);
939 }
940 
945 RemoveEvents::RemoveEvents(snd_seq_remove_events_t* other)
946 {
947  snd_seq_remove_events_malloc(&m_Info);
948  snd_seq_remove_events_copy(m_Info, other);
949 }
950 
955 {
956  snd_seq_remove_events_free(m_Info);
957 }
958 
965 {
966  return new RemoveEvents(m_Info);
967 }
968 
976 {
977  if (this == &other)
978  return *this;
979  snd_seq_remove_events_copy(m_Info, other.m_Info);
980  return *this;
981 }
982 
987 int
989 {
990  return snd_seq_remove_events_sizeof();
991 }
992 
998 int
1000 {
1001  return snd_seq_remove_events_get_channel(m_Info);
1002 }
1003 
1009 unsigned int
1011 {
1012  return snd_seq_remove_events_get_condition(m_Info);
1013 }
1014 
1020 const snd_seq_addr_t*
1022 {
1023  return snd_seq_remove_events_get_dest(m_Info);
1024 }
1025 
1031 int
1033 {
1034  return snd_seq_remove_events_get_event_type(m_Info);
1035 }
1036 
1042 int
1044 {
1045  return snd_seq_remove_events_get_queue(m_Info);
1046 }
1047 
1053 int
1055 {
1056  return snd_seq_remove_events_get_tag(m_Info);
1057 }
1058 
1064 const snd_seq_timestamp_t*
1066 {
1067  return snd_seq_remove_events_get_time(m_Info);
1068 }
1069 
1075 void
1077 {
1078  snd_seq_remove_events_set_channel(m_Info, chan);
1079 }
1080 
1099 void
1100 RemoveEvents::setCondition(unsigned int cond)
1101 {
1102  snd_seq_remove_events_set_condition(m_Info, cond);
1103 }
1104 
1110 void
1111 RemoveEvents::setDest(const snd_seq_addr_t* dest)
1112 {
1113  snd_seq_remove_events_set_dest(m_Info, dest);
1114 }
1115 
1121 void
1123 {
1124  snd_seq_remove_events_set_event_type(m_Info, type);
1125 }
1126 
1132 void
1134 {
1135  snd_seq_remove_events_set_queue(m_Info, queue);
1136 }
1137 
1143 void
1145 {
1146  snd_seq_remove_events_set_tag(m_Info, tag);
1147 }
1148 
1154 void
1155 RemoveEvents::setTime(const snd_seq_timestamp_t* time)
1156 {
1157  snd_seq_remove_events_set_time(m_Info, time);
1158 }
1159 
1165 MidiCodec::MidiCodec( int bufsize, QObject* parent ) : QObject(parent)
1166 {
1167  DRUMSTICK_ALSA_CHECK_ERROR(snd_midi_event_new(bufsize, &m_Info));
1168 }
1169 
1174 {
1175  snd_midi_event_free(m_Info);
1176 }
1177 
1181 void
1183 {
1184  snd_midi_event_init(m_Info);
1185 }
1186 
1194 long
1195 MidiCodec::decode(unsigned char *buf,
1196  long count,
1197  const snd_seq_event_t *ev)
1198 {
1199  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_decode(m_Info, buf, count, ev));
1200 }
1201 
1209 long
1210 MidiCodec::encode(const unsigned char *buf,
1211  long count,
1212  snd_seq_event_t *ev)
1213 {
1214  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_encode(m_Info, buf, count, ev));
1215 }
1216 
1223 long
1225  snd_seq_event_t *ev)
1226 {
1227  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_encode_byte(m_Info, c, ev));
1228 }
1229 
1234 void
1236 {
1237  snd_midi_event_no_status(m_Info, enable ? 0 : 1);
1238 }
1239 
1243 void
1245 {
1246  snd_midi_event_reset_decode(m_Info);
1247 }
1248 
1252 void
1254 {
1255  snd_midi_event_reset_encode(m_Info);
1256 }
1257 
1262 void
1264 {
1265  DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_resize_buffer(m_Info, bufsize));
1266 }
1267 
1268 QString typeOfEvent(const SequencerEvent &v)
1269 {
1270  int status;
1271  char *realname = abi::__cxa_demangle(typeid(v).name(), 0, 0, &status);
1272  QString name(realname && realname[0] ? realname : "drumstick::ALSA::SequencerEvent");
1273  free(realname);
1274  return name;
1275 }
1276 
1277 QDebug operator<<(QDebug d, const SequencerEvent &event)
1278 {
1279  QDebugStateSaver saver(d);
1280  d.noquote() << typeOfEvent(event);
1281  return d;
1282 }
1283 
1284 QDebug operator<<(QDebug d, const SequencerEvent *event)
1285 {
1286  QDebugStateSaver saver(d);
1287  d.noquote().nospace() << typeOfEvent(*event) << "*";
1288  return d;
1289 }
1290 
1291 } // namespace ALSA
1292 } // namespace drumstick
1293 
virtual ChanPressEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:567
NoteEvent()
Default constructor.
Definition: alsaevent.h:235
QDebug operator<<(QDebug d, const SequencerEvent &event)
operator << outputs a SequencerEvent instance reference to a QDebug stream
Definition: alsaevent.cpp:1277
void resetDecoder()
Reset MIDI decode parser.
Definition: alsaevent.cpp:1244
ControllerEvent()
Default constructor.
Definition: alsaevent.h:328
static bool isChannel(const SequencerEvent *event)
Checks if the event&#39;s type is a Channel Voice message.
Definition: alsaevent.cpp:205
Error checking functions and macros.
virtual ProgramChangeEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:529
virtual ~RemoveEvents()
Destructor.
Definition: alsaevent.cpp:954
int getTextType() const
Gets the event&#39;s SMF text type.
Definition: alsaevent.cpp:787
ChanPressEvent()
Default constructor.
Definition: alsaevent.h:432
ClientEvent()
Default constructor.
Definition: alsaevent.h:712
void scheduleTick(const int queue, const int tick, const bool relative)
Sets the event to be scheduled in musical time (ticks) units.
Definition: alsaevent.cpp:280
SysExEvent()
Default constructor.
Definition: alsaevent.cpp:653
void setCondition(unsigned int cond)
Sets the flags of the conditional event&#39;s removal.
Definition: alsaevent.cpp:1100
Base class for the events having Key and Velocity properties.
Definition: alsaevent.h:187
void setDest(const snd_seq_addr_t *dest)
Set the destination address.
Definition: alsaevent.cpp:1111
void setSubscribers()
Sets the event&#39;s destination to be all the subscribers of the source port.
Definition: alsaevent.cpp:252
QueueControlEvent()
Default constructor.
Definition: alsaevent.h:545
Event representing a MIDI bender, or pitch wheel event.
Definition: alsaevent.h:398
static bool isSubscription(const SequencerEvent *event)
Checks if the event&#39;s type is a subscription.
Definition: alsaevent.cpp:144
void setQueue(int queue)
Sets the queue number.
Definition: alsaevent.cpp:1133
virtual PortEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:909
RemoveEvents * clone()
Create a new object copied from this object and return a pointer to the copy.
Definition: alsaevent.cpp:964
int getQueue()
Gets the queue number.
Definition: alsaevent.cpp:1043
snd_seq_event_t m_event
ALSA sequencer event record.
Definition: alsaevent.h:152
void init()
CODEC initialization.
Definition: alsaevent.cpp:1182
void resetEncoder()
Reset MIDI encode parser.
Definition: alsaevent.cpp:1253
#define DRUMSTICK_ALSA_CHECK_WARNING(x)
This macro calls the check warning function.
Definition: errorcheck.h:86
void enableRunningStatus(bool enable)
Enable MIDI running status (command merge)
Definition: alsaevent.cpp:1235
void setBroadcast()
Sets the event&#39;s destination to be all queues/clients/ports/channels.
Definition: alsaevent.cpp:260
Event representing a note-off MIDI event.
Definition: alsaevent.h:284
NoteOnEvent()
Default constructor.
Definition: alsaevent.h:268
Event representing a MIDI system exclusive event.
Definition: alsaevent.h:485
VariableEvent & operator=(const VariableEvent &other)
Assignment operator.
Definition: alsaevent.cpp:633
void setRaw32(const unsigned int n, const unsigned int value)
Sets an event&#39;s raw 32 bits parameter.
Definition: alsaevent.cpp:342
Q_DECL_DEPRECATED void free()
Releases the event record.
Definition: alsaevent.cpp:373
The QObject class is the base class of all Qt objects.
void setTag(const unsigned char aTag)
Sets the event&#39;s tag.
Definition: alsaevent.cpp:316
void setRaw8(const unsigned int n, const unsigned char value)
Sets an event&#39;s raw 8 bits parameter.
Definition: alsaevent.cpp:364
SequencerEvent & operator=(const SequencerEvent &other)
Assignment operator.
Definition: alsaevent.cpp:132
virtual ChannelEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:400
Generic event having a value property.
Definition: alsaevent.h:618
void setPriority(const bool high)
Sets the priority of the event.
Definition: alsaevent.cpp:306
virtual ValueEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:872
KeyPressEvent()
Default constructor.
Definition: alsaevent.h:308
virtual ControllerEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:510
virtual TextEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:796
const snd_seq_addr_t * getDest()
Gets the destination.
Definition: alsaevent.cpp:1021
TextEvent & operator=(const TextEvent &other)
Assignment operator.
Definition: alsaevent.cpp:806
virtual NoteOnEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:450
void setValue(const int v)
Sets the event&#39;s value.
Definition: alsaevent.h:638
ChannelEvent()
Default constructor.
Definition: alsaevent.h:162
Drumstick common.
Definition: alsaclient.cpp:71
void setChannel(int chan)
Gets the MIDI channel.
Definition: alsaevent.cpp:1076
NoteOffEvent()
Default constructor.
Definition: alsaevent.h:288
const QEvent::Type SequencerEventType
Constant SequencerEventType is the QEvent::type() of any SequencerEvent object to be used to check th...
Definition: alsaevent.h:59
virtual NoteOffEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:470
void setDirect()
Sets the event to be immediately delivered, not queued/scheduled.
Definition: alsaevent.cpp:269
QString getText() const
Gets the event&#39;s text content.
Definition: alsaevent.cpp:778
RemoveEvents()
Default constructor.
Definition: alsaevent.cpp:926
void setSequencerType(const snd_seq_event_type_t eventType)
Sets the event&#39;s ALSA sequencer type.
Definition: alsaevent.cpp:223
virtual SysExEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:704
static bool isPort(const SequencerEvent *event)
Checks if the event&#39;s type is of type port.
Definition: alsaevent.cpp:157
Event representing a MIDI channel pressure or after-touch event.
Definition: alsaevent.h:428
PitchBendEvent()
Default constructor.
Definition: alsaevent.h:402
virtual NoteEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:430
Class representing a note event with duration.
Definition: alsaevent.h:231
unsigned char getRaw8(const unsigned int n) const
Gets an event&#39;s raw 8 bits parameter.
Definition: alsaevent.cpp:353
int getEventType()
Gets the event type.
Definition: alsaevent.cpp:1032
Base class for the event&#39;s hierarchy.
Definition: alsaevent.h:67
TextEvent()
Default constructor.
Definition: alsaevent.cpp:725
VariableEvent()
Default constructor.
Definition: alsaevent.cpp:575
static bool isConnectionChange(const SequencerEvent *event)
Checks if the event&#39;s type is of type connection change.
Definition: alsaevent.cpp:185
void setTag(int tag)
Sets the numeric tag.
Definition: alsaevent.cpp:1144
KeyEvent()
Default constructor.
Definition: alsaevent.h:191
Auxiliary class to remove events from an ALSA queue.
Definition: alsaevent.h:751
virtual SequencerEvent * clone() const
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:391
virtual KeyEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:409
void setEventType(int type)
Sets the event type.
Definition: alsaevent.cpp:1122
ALSA Event representing a tempo change for an ALSA queue.
Definition: alsaevent.h:645
MidiCodec(int bufsize, QObject *parent=nullptr)
MidiCodec constructor.
Definition: alsaevent.cpp:1165
Base class for variable length events.
Definition: alsaevent.h:458
virtual TempoEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:891
unsigned int getCondition()
Gets the condition.
Definition: alsaevent.cpp:1010
TempoEvent()
Default constructor.
Definition: alsaevent.h:649
ALSA Event representing a queue control command.
Definition: alsaevent.h:541
PortEvent()
Default constructor.
Definition: alsaevent.h:733
RemoveEvents & operator=(const RemoveEvents &other)
Assignment operator.
Definition: alsaevent.cpp:975
Event representing a MIDI program change event.
Definition: alsaevent.h:368
long encode(const unsigned char *buf, long count, snd_seq_event_t *ev)
Encode from byte stream.
Definition: alsaevent.cpp:1210
const snd_seq_timestamp_t * getTime()
Gets the timestamp.
Definition: alsaevent.cpp:1065
QString typeOfEvent(const SequencerEvent &v)
typeOfEvent returns a QString representing the type of the event
Definition: alsaevent.cpp:1268
virtual KeyPressEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:490
int getChannel()
Gets the MIDI channel.
Definition: alsaevent.cpp:999
virtual PitchBendEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:548
Base class for the events having a Channel property.
Definition: alsaevent.h:158
ValueEvent()
Default constructor.
Definition: alsaevent.h:622
Event representing a MIDI key pressure, or polyphonic after-touch event.
Definition: alsaevent.h:304
ProgramChangeEvent()
Default constructor.
Definition: alsaevent.h:372
SequencerEvent()
Default constructor.
Definition: alsaevent.cpp:101
int getEncodedLength()
Gets the encoded length of the event record.
Definition: alsaevent.cpp:382
static bool isClient(const SequencerEvent *event)
Checks if the event&#39;s type is of type client.
Definition: alsaevent.cpp:171
void resizeBuffer(int bufsize)
Resize the CODEC buffer.
Definition: alsaevent.cpp:1263
Event representing a note-on MIDI event.
Definition: alsaevent.h:264
virtual SystemEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:830
int getSizeOfInfo() const
Gets the allocated size of the ALSA remove events object.
Definition: alsaevent.cpp:988
unsigned int getRaw32(const unsigned int n) const
Gets an event&#39;s raw 32 bits parameter.
Definition: alsaevent.cpp:331
virtual VariableEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:645
ALSA Event representing a change on some ALSA sequencer client on the system.
Definition: alsaevent.h:708
The QEvent class is the base class of all event classes.
void setTime(const snd_seq_timestamp_t *time)
Sets the timestamp.
Definition: alsaevent.cpp:1155
void scheduleReal(const int queue, const ulong secs, const ulong nanos, const bool relative)
Sets the event to be scheduled in real (clock) time units.
Definition: alsaevent.cpp:292
void setSource(const unsigned char port)
Sets the event&#39;s source port ID.
Definition: alsaevent.cpp:244
int getTag()
Gets the numeric tag.
Definition: alsaevent.cpp:1054
Classes managing ALSA Sequencer events.
SubscriptionEvent()
Default constructor.
Definition: alsaevent.h:666
void setDestination(const unsigned char client, const unsigned char port)
Sets the client:port destination of the event.
Definition: alsaevent.cpp:234
virtual SubscriptionEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:918
SysExEvent & operator=(const SysExEvent &other)
Assignment operator.
Definition: alsaevent.cpp:714
virtual ClientEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:900
long decode(unsigned char *buf, long count, const snd_seq_event_t *ev)
Decode from event to bytes.
Definition: alsaevent.cpp:1195
virtual QueueControlEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:851
Event representing a MIDI control change event.
Definition: alsaevent.h:324
SystemEvent()
Default constructor.
Definition: alsaevent.h:526
ALSA Event representing a subscription between two ALSA clients and ports.
Definition: alsaevent.h:662
ALSA Event representing a change on some ALSA sequencer port on the system.
Definition: alsaevent.h:729
Event representing a SMF text event.
Definition: alsaevent.h:503
#define DRUMSTICK_ALSA_CHECK_ERROR(x)
This macro calls the check error function.
Definition: errorcheck.h:80