drumstick  2.9.0
C++MIDIlibrariesusingQtobjects,idioms,andstyle.
alsaevent.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"
20 #include <drumstick/alsaevent.h>
32 namespace drumstick { namespace ALSA {
33 
100 {
101  snd_seq_ev_clear( &m_event );
102 }
103 
109 {
110  snd_seq_ev_clear( &m_event );
111  m_event = *event;
112 }
113 
119 {
120  snd_seq_ev_clear( &m_event );
121  m_event = other.m_event;
122 }
123 
131 {
132  m_event = other.m_event;
133  return *this;
134 }
135 
141 bool
143 {
144  snd_seq_event_type_t te = event->getSequencerType();
145  return ( te == SND_SEQ_EVENT_PORT_SUBSCRIBED ||
146  te == SND_SEQ_EVENT_PORT_UNSUBSCRIBED );
147 }
148 
154 bool
156 {
157  snd_seq_event_type_t te = event->getSequencerType();
158  return ( te == SND_SEQ_EVENT_PORT_START ||
159  te == SND_SEQ_EVENT_PORT_EXIT ||
160  te == SND_SEQ_EVENT_PORT_CHANGE );
161 }
162 
168 bool
170 {
171  snd_seq_event_type_t te = event->getSequencerType();
172  return ( te == SND_SEQ_EVENT_CLIENT_START ||
173  te == SND_SEQ_EVENT_CLIENT_EXIT ||
174  te == SND_SEQ_EVENT_CLIENT_CHANGE );
175 }
176 
182 bool
184 {
185  snd_seq_event_type_t te = event->getSequencerType();
186  return ( te == SND_SEQ_EVENT_PORT_START ||
187  te == SND_SEQ_EVENT_PORT_EXIT ||
188  te == SND_SEQ_EVENT_PORT_CHANGE ||
189  te == SND_SEQ_EVENT_CLIENT_START ||
190  te == SND_SEQ_EVENT_CLIENT_EXIT ||
191  te == SND_SEQ_EVENT_CLIENT_CHANGE ||
192  te == SND_SEQ_EVENT_PORT_SUBSCRIBED ||
193  te == SND_SEQ_EVENT_PORT_UNSUBSCRIBED );
194 }
195 
202 bool
204 {
205  snd_seq_event_type_t te = event->getSequencerType();
206  return ( te == SND_SEQ_EVENT_NOTEOFF ||
207  te == SND_SEQ_EVENT_NOTEON ||
208  te == SND_SEQ_EVENT_NOTE ||
209  te == SND_SEQ_EVENT_KEYPRESS ||
210  te == SND_SEQ_EVENT_CONTROLLER ||
211  te == SND_SEQ_EVENT_CONTROL14 ||
212  te == SND_SEQ_EVENT_PGMCHANGE ||
213  te == SND_SEQ_EVENT_CHANPRESS ||
214  te == SND_SEQ_EVENT_PITCHBEND );
215 }
216 
221 void SequencerEvent::setSequencerType(const snd_seq_event_type_t eventType)
222 {
223  m_event.type = eventType;
224 }
225 
232 void SequencerEvent::setDestination(const unsigned char client, const unsigned char port)
233 {
234  snd_seq_ev_set_dest(&m_event, client, port);
235 }
236 
242 void SequencerEvent::setSource(const unsigned char port)
243 {
244  snd_seq_ev_set_source(&m_event, port);
245 }
246 
251 {
252  snd_seq_ev_set_subs(&m_event);
253 }
254 
259 {
260  snd_seq_ev_set_broadcast(&m_event);
261 }
262 
268 {
269  snd_seq_ev_set_direct(&m_event);
270 }
271 
278 void SequencerEvent::scheduleTick(int queue, int tick, bool relative)
279 {
280  snd_seq_ev_schedule_tick(&m_event, queue, relative, tick);
281 }
282 
290 void SequencerEvent::scheduleReal(int queue, ulong secs, ulong nanos, bool relative)
291 {
292  snd_seq_real_time_t rtime;
293  rtime.tv_sec = secs;
294  rtime.tv_nsec = nanos;
295  snd_seq_ev_schedule_real(&m_event, queue, relative, &rtime);
296 }
297 
304 void SequencerEvent::setPriority(const bool high)
305 {
306  snd_seq_ev_set_priority(&m_event, high);
307 }
308 
314 void SequencerEvent::setTag(const unsigned char aTag)
315 {
316 #if SND_LIB_VERSION > 0x010008
317  snd_seq_ev_set_tag(&m_event, aTag);
318 #else
319  m_event.tag = aTag;
320 #endif
321 }
322 
329 unsigned int SequencerEvent::getRaw32(const unsigned int n) const
330 {
331  if (n < 3) return m_event.data.raw32.d[n];
332  return 0;
333 }
334 
340 void SequencerEvent::setRaw32(const unsigned int n, const unsigned int value)
341 {
342  if (n < 3) m_event.data.raw32.d[n] = value;
343 }
344 
351 unsigned char SequencerEvent::getRaw8(const unsigned int n) const
352 {
353  if (n < 12) return m_event.data.raw8.d[n];
354  return 0;
355 }
356 
362 void SequencerEvent::setRaw8(const unsigned int n, const unsigned char value)
363 {
364  if (n < 12) m_event.data.raw8.d[n] = value;
365 }
366 
372 {
373  snd_seq_free_event(&m_event);
374 }
375 
381 {
382  return snd_seq_event_length(&m_event);
383 }
384 
390 {
391  return new SequencerEvent(&m_event);
392 }
393 
399 {
400  return new ChannelEvent(&m_event);
401 }
402 
408 {
409  return new KeyEvent(&m_event);
410 }
411 
419 NoteEvent::NoteEvent(const int ch, const int key, const int vel, const int dur) : KeyEvent()
420 {
421  snd_seq_ev_set_note(&m_event, ch, key, vel, dur);
422 }
423 
429 {
430  return new NoteEvent(&m_event);
431 }
432 
439 NoteOnEvent::NoteOnEvent(int ch, int key, int vel) : KeyEvent()
440 {
441  snd_seq_ev_set_noteon(&m_event, ch, key, vel);
442 }
443 
449 {
450  return new NoteOnEvent(&m_event);
451 }
452 
459 NoteOffEvent::NoteOffEvent(int ch, int key, int vel) : KeyEvent()
460 {
461  snd_seq_ev_set_noteoff(&m_event, ch, key, vel);
462 }
463 
469 {
470  return new NoteOffEvent(&m_event);
471 }
472 
479 KeyPressEvent::KeyPressEvent(int ch, int key, int vel) : KeyEvent()
480 {
481  snd_seq_ev_set_keypress(&m_event, ch, key, vel);
482 }
483 
489 {
490  return new KeyPressEvent(&m_event);
491 }
492 
499 ControllerEvent::ControllerEvent(int ch, int cc, int val) : ChannelEvent()
500 {
501  snd_seq_ev_set_controller(&m_event, ch, cc, val);
502 }
503 
509 {
510  return new ControllerEvent(&m_event);
511 }
512 
519 {
520  snd_seq_ev_set_pgmchange(&m_event, ch, val);
521 }
522 
528 {
529  return new ProgramChangeEvent(&m_event);
530 }
531 
538 {
539  snd_seq_ev_set_pitchbend(&m_event, ch, val);
540 }
541 
547 {
548  return new PitchBendEvent(&m_event);
549 }
550 
557 {
558  snd_seq_ev_set_chanpress(&m_event, ch, val);
559 }
560 
566 {
567  return new ChanPressEvent(&m_event);
568 }
569 
574  : SequencerEvent()
575 {
576  m_data.clear();
577  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
578 }
579 
584 VariableEvent::VariableEvent(const snd_seq_event_t* event)
585  : SequencerEvent(event)
586 {
587  m_data = QByteArray((char *) event->data.ext.ptr,
588  event->data.ext.len);
589  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
590 }
591 
596 VariableEvent::VariableEvent(const QByteArray& data)
597  : SequencerEvent()
598 {
599  m_data = data;
600  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
601 }
602 
608  : SequencerEvent(other)
609 {
610  m_data = other.m_data;
611  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
612 }
613 
619 VariableEvent::VariableEvent(const unsigned int datalen, char* dataptr)
620  : SequencerEvent()
621 {
622  m_data = QByteArray(dataptr, datalen);
623  snd_seq_ev_set_variable( &m_event, m_data.size(), m_data.data() );
624 }
625 
632 {
633  m_event = other.m_event;
634  m_data = other.m_data;
635  snd_seq_ev_set_variable ( &m_event, m_data.size(), m_data.data() );
636  return *this;
637 }
638 
644 {
645  return new VariableEvent(&m_event);
646 }
647 
652  : VariableEvent()
653 {
654  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
655 }
656 
661 SysExEvent::SysExEvent(const snd_seq_event_t* event)
662  : VariableEvent(event)
663 {
664  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
665 }
666 
671 SysExEvent::SysExEvent(const QByteArray& data)
672  : VariableEvent(data)
673 {
674  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
675 }
676 
682  : VariableEvent(other)
683 {
684  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
685 }
686 
692 SysExEvent::SysExEvent(const unsigned int datalen, char* dataptr)
693  : VariableEvent( datalen, dataptr )
694 {
695  snd_seq_ev_set_sysex( &m_event, m_data.size(), m_data.data() );
696 }
697 
703 {
704  return new SysExEvent(&m_event);
705 }
706 
713 {
714  m_event = other.m_event;
715  m_data = other.m_data;
716  snd_seq_ev_set_sysex(&m_event, m_data.size(), m_data.data());
717  return *this;
718 }
719 
724  : VariableEvent(), m_textType(1)
725 {
726  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
727 }
728 
733 TextEvent::TextEvent(const snd_seq_event_t* event)
734  : VariableEvent(event), m_textType(1)
735 {
736  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
737 }
738 
744 TextEvent::TextEvent(const QString& text, const int textType)
745  : VariableEvent(text.toUtf8()), m_textType(textType)
746 {
747  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
748 }
749 
755  : VariableEvent(other)
756 {
757  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
758  m_textType = other.getTextType();
759 }
760 
766 TextEvent::TextEvent(const unsigned int datalen, char* dataptr)
767  : VariableEvent(datalen, dataptr), m_textType(1)
768 {
769  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
770 }
771 
776 QString TextEvent::getText() const
777 {
778  return QString::fromUtf8(m_data.data(), m_data.size());
779 }
780 
786 {
787  return m_textType;
788 }
789 
795 {
796  return new TextEvent(&m_event);
797 }
798 
805 {
806  m_event = other.m_event;
807  m_data = other.m_data;
808  m_textType = other.getTextType();
809  snd_seq_ev_set_variable(&m_event, m_data.size(), m_data.data());
810  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
811  return *this;
812 }
813 
818 SystemEvent::SystemEvent(const snd_seq_event_type_t type) : SequencerEvent()
819 {
820  snd_seq_ev_set_fixed(&m_event);
821  setSequencerType(type);
822 }
823 
829 {
830  return new SystemEvent(&m_event);
831 }
832 
839 QueueControlEvent::QueueControlEvent(snd_seq_event_type_t type, int queue, int value)
840  : SequencerEvent()
841 {
842  snd_seq_ev_set_queue_control(&m_event, type, queue, value);
843 }
844 
850 {
851  return new QueueControlEvent(&m_event);
852 }
853 
859 ValueEvent::ValueEvent(const snd_seq_event_type_t type, int val) : SequencerEvent()
860 {
861  snd_seq_ev_set_fixed(&m_event);
862  setSequencerType(type);
863  setValue(val);
864 }
865 
871 {
872  return new ValueEvent(&m_event);
873 }
874 
880 TempoEvent::TempoEvent(int queue, int tempo) : QueueControlEvent()
881 {
882  snd_seq_ev_set_queue_tempo(&m_event, queue, tempo);
883 }
884 
890 {
891  return new TempoEvent(&m_event);
892 }
893 
899 {
900  return new ClientEvent(&m_event);
901 }
902 
908 {
909  return new PortEvent(&m_event);
910 }
911 
917 {
918  return new SubscriptionEvent(&m_event);
919 }
920 
925 {
926  snd_seq_remove_events_malloc(&m_Info);
927 }
928 
934 {
935  snd_seq_remove_events_malloc(&m_Info);
936  snd_seq_remove_events_copy(m_Info, other.m_Info);
937 }
938 
943 RemoveEvents::RemoveEvents(snd_seq_remove_events_t* other)
944 {
945  snd_seq_remove_events_malloc(&m_Info);
946  snd_seq_remove_events_copy(m_Info, other);
947 }
948 
953 {
954  snd_seq_remove_events_free(m_Info);
955 }
956 
963 {
964  return new RemoveEvents(m_Info);
965 }
966 
974 {
975  if (this == &other)
976  return *this;
977  snd_seq_remove_events_copy(m_Info, other.m_Info);
978  return *this;
979 }
980 
985 int
987 {
988  return snd_seq_remove_events_sizeof();
989 }
990 
996 int
998 {
999  return snd_seq_remove_events_get_channel(m_Info);
1000 }
1001 
1007 unsigned int
1009 {
1010  return snd_seq_remove_events_get_condition(m_Info);
1011 }
1012 
1018 const snd_seq_addr_t*
1020 {
1021  return snd_seq_remove_events_get_dest(m_Info);
1022 }
1023 
1029 int
1031 {
1032  return snd_seq_remove_events_get_event_type(m_Info);
1033 }
1034 
1040 int
1042 {
1043  return snd_seq_remove_events_get_queue(m_Info);
1044 }
1045 
1051 int
1053 {
1054  return snd_seq_remove_events_get_tag(m_Info);
1055 }
1056 
1062 const snd_seq_timestamp_t*
1064 {
1065  return snd_seq_remove_events_get_time(m_Info);
1066 }
1067 
1073 void
1075 {
1076  snd_seq_remove_events_set_channel(m_Info, chan);
1077 }
1078 
1097 void
1098 RemoveEvents::setCondition(unsigned int cond)
1099 {
1100  snd_seq_remove_events_set_condition(m_Info, cond);
1101 }
1102 
1108 void
1109 RemoveEvents::setDest(const snd_seq_addr_t* dest)
1110 {
1111  snd_seq_remove_events_set_dest(m_Info, dest);
1112 }
1113 
1119 void
1121 {
1122  snd_seq_remove_events_set_event_type(m_Info, type);
1123 }
1124 
1130 void
1132 {
1133  snd_seq_remove_events_set_queue(m_Info, queue);
1134 }
1135 
1141 void
1143 {
1144  snd_seq_remove_events_set_tag(m_Info, tag);
1145 }
1146 
1152 void
1153 RemoveEvents::setTime(const snd_seq_timestamp_t* time)
1154 {
1155  snd_seq_remove_events_set_time(m_Info, time);
1156 }
1157 
1163 MidiCodec::MidiCodec( int bufsize, QObject* parent ) : QObject(parent)
1164 {
1165  DRUMSTICK_ALSA_CHECK_ERROR(snd_midi_event_new(bufsize, &m_Info));
1166 }
1167 
1172 {
1173  snd_midi_event_free(m_Info);
1174 }
1175 
1179 void
1181 {
1182  snd_midi_event_init(m_Info);
1183 }
1184 
1192 long
1193 MidiCodec::decode(unsigned char *buf,
1194  long count,
1195  const snd_seq_event_t *ev)
1196 {
1197  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_decode(m_Info, buf, count, ev));
1198 }
1199 
1207 long
1208 MidiCodec::encode(const unsigned char *buf,
1209  long count,
1210  snd_seq_event_t *ev)
1211 {
1212  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_encode(m_Info, buf, count, ev));
1213 }
1214 
1221 long
1223  snd_seq_event_t *ev)
1224 {
1225  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_encode_byte(m_Info, c, ev));
1226 }
1227 
1232 void
1234 {
1235  snd_midi_event_no_status(m_Info, enable ? 0 : 1);
1236 }
1237 
1241 void
1243 {
1244  snd_midi_event_reset_decode(m_Info);
1245 }
1246 
1250 void
1252 {
1253  snd_midi_event_reset_encode(m_Info);
1254 }
1255 
1260 void
1262 {
1263  DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_resize_buffer(m_Info, bufsize));
1264 }
1265 
1266 } // namespace ALSA
1267 } // namespace drumstick
1268 
virtual ChanPressEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:565
NoteEvent()
Default constructor.
Definition: alsaevent.h:235
void resetDecoder()
Reset MIDI decode parser.
Definition: alsaevent.cpp:1242
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:203
Error checking functions and macros.
virtual ProgramChangeEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:527
virtual ~RemoveEvents()
Destructor.
Definition: alsaevent.cpp:952
int getTextType() const
Gets the event&#39;s SMF text type.
Definition: alsaevent.cpp:785
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:278
SysExEvent()
Default constructor.
Definition: alsaevent.cpp:651
void setCondition(unsigned int cond)
Sets the flags of the conditional event&#39;s removal.
Definition: alsaevent.cpp:1098
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:1109
void setSubscribers()
Sets the event&#39;s destination to be all the subscribers of the source port.
Definition: alsaevent.cpp:250
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:142
void setQueue(int queue)
Sets the queue number.
Definition: alsaevent.cpp:1131
virtual PortEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:907
RemoveEvents * clone()
Create a new object copied from this object and return a pointer to the copy.
Definition: alsaevent.cpp:962
int getQueue()
Gets the queue number.
Definition: alsaevent.cpp:1041
snd_seq_event_t m_event
ALSA sequencer event record.
Definition: alsaevent.h:152
void init()
CODEC initialization.
Definition: alsaevent.cpp:1180
void resetEncoder()
Reset MIDI encode parser.
Definition: alsaevent.cpp:1251
#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:1233
void setBroadcast()
Sets the event&#39;s destination to be all queues/clients/ports/channels.
Definition: alsaevent.cpp:258
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:631
void setRaw32(const unsigned int n, const unsigned int value)
Sets an event&#39;s raw 32 bits parameter.
Definition: alsaevent.cpp:340
Q_DECL_DEPRECATED void free()
Releases the event record.
Definition: alsaevent.cpp:371
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:314
void setRaw8(const unsigned int n, const unsigned char value)
Sets an event&#39;s raw 8 bits parameter.
Definition: alsaevent.cpp:362
SequencerEvent & operator=(const SequencerEvent &other)
Assignment operator.
Definition: alsaevent.cpp:130
virtual ChannelEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:398
Generic event having a value property.
Definition: alsaevent.h:618
void setPriority(const bool high)
Sets the priority of the event.
Definition: alsaevent.cpp:304
virtual ValueEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:870
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:508
virtual TextEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:794
const snd_seq_addr_t * getDest()
Gets the destination.
Definition: alsaevent.cpp:1019
TextEvent & operator=(const TextEvent &other)
Assignment operator.
Definition: alsaevent.cpp:804
virtual NoteOnEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:448
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:68
void setChannel(int chan)
Gets the MIDI channel.
Definition: alsaevent.cpp:1074
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:468
void setDirect()
Sets the event to be immediately delivered, not queued/scheduled.
Definition: alsaevent.cpp:267
QString getText() const
Gets the event&#39;s text content.
Definition: alsaevent.cpp:776
RemoveEvents()
Default constructor.
Definition: alsaevent.cpp:924
void setSequencerType(const snd_seq_event_type_t eventType)
Sets the event&#39;s ALSA sequencer type.
Definition: alsaevent.cpp:221
virtual SysExEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:702
static bool isPort(const SequencerEvent *event)
Checks if the event&#39;s type is of type port.
Definition: alsaevent.cpp:155
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:428
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:351
int getEventType()
Gets the event type.
Definition: alsaevent.cpp:1030
Base class for the event&#39;s hierarchy.
Definition: alsaevent.h:67
TextEvent()
Default constructor.
Definition: alsaevent.cpp:723
VariableEvent()
Default constructor.
Definition: alsaevent.cpp:573
static bool isConnectionChange(const SequencerEvent *event)
Checks if the event&#39;s type is of type connection change.
Definition: alsaevent.cpp:183
void setTag(int tag)
Sets the numeric tag.
Definition: alsaevent.cpp:1142
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:389
virtual KeyEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:407
void setEventType(int type)
Sets the event type.
Definition: alsaevent.cpp:1120
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:1163
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:889
unsigned int getCondition()
Gets the condition.
Definition: alsaevent.cpp:1008
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:973
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:1208
const snd_seq_timestamp_t * getTime()
Gets the timestamp.
Definition: alsaevent.cpp:1063
virtual KeyPressEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:488
int getChannel()
Gets the MIDI channel.
Definition: alsaevent.cpp:997
virtual PitchBendEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:546
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:99
int getEncodedLength()
Gets the encoded length of the event record.
Definition: alsaevent.cpp:380
static bool isClient(const SequencerEvent *event)
Checks if the event&#39;s type is of type client.
Definition: alsaevent.cpp:169
void resizeBuffer(int bufsize)
Resize the CODEC buffer.
Definition: alsaevent.cpp:1261
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:828
int getSizeOfInfo() const
Gets the allocated size of the ALSA remove events object.
Definition: alsaevent.cpp:986
unsigned int getRaw32(const unsigned int n) const
Gets an event&#39;s raw 32 bits parameter.
Definition: alsaevent.cpp:329
virtual VariableEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:643
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:1153
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:290
void setSource(const unsigned char port)
Sets the event&#39;s source port ID.
Definition: alsaevent.cpp:242
int getTag()
Gets the numeric tag.
Definition: alsaevent.cpp:1052
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:232
virtual SubscriptionEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:916
SysExEvent & operator=(const SysExEvent &other)
Assignment operator.
Definition: alsaevent.cpp:712
virtual ClientEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:898
long decode(unsigned char *buf, long count, const snd_seq_event_t *ev)
Decode from event to bytes.
Definition: alsaevent.cpp:1193
virtual QueueControlEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:849
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