drumstick  2.5.1
alsaevent.cpp
Go to the documentation of this file.
1 /*
2  MIDI Sequencer C++ library
3  Copyright (C) 2006-2022, 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(int ch, int key, int vel, 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 
711  : VariableEvent(), m_textType(1)
712 {
713  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
714 }
715 
720 TextEvent::TextEvent(const snd_seq_event_t* event)
721  : VariableEvent(event), m_textType(1)
722 {
723  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
724 }
725 
731 TextEvent::TextEvent(const QString& text, const int textType)
732  : VariableEvent(text.toUtf8()), m_textType(textType)
733 {
734  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
735 }
736 
742  : VariableEvent(other)
743 {
744  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
745  m_textType = other.getTextType();
746 }
747 
753 TextEvent::TextEvent(const unsigned int datalen, char* dataptr)
754  : VariableEvent(datalen, dataptr), m_textType(1)
755 {
756  setSequencerType(SND_SEQ_EVENT_USR_VAR0);
757 }
758 
763 QString TextEvent::getText() const
764 {
765  return QString::fromUtf8(m_data.data(), m_data.size());
766 }
767 
773 {
774  return m_textType;
775 }
776 
782 {
783  return new TextEvent(&m_event);
784 }
785 
790 SystemEvent::SystemEvent(const snd_seq_event_type_t type) : SequencerEvent()
791 {
792  snd_seq_ev_set_fixed(&m_event);
793  setSequencerType(type);
794 }
795 
801 {
802  return new SystemEvent(&m_event);
803 }
804 
811 QueueControlEvent::QueueControlEvent(snd_seq_event_type_t type, int queue, int value)
812  : SequencerEvent()
813 {
814  snd_seq_ev_set_queue_control(&m_event, type, queue, value);
815 }
816 
822 {
823  return new QueueControlEvent(&m_event);
824 }
825 
831 ValueEvent::ValueEvent(const snd_seq_event_type_t type, int val) : SequencerEvent()
832 {
833  snd_seq_ev_set_fixed(&m_event);
834  setSequencerType(type);
835  setValue(val);
836 }
837 
843 {
844  return new ValueEvent(&m_event);
845 }
846 
852 TempoEvent::TempoEvent(int queue, int tempo) : QueueControlEvent()
853 {
854  snd_seq_ev_set_queue_tempo(&m_event, queue, tempo);
855 }
856 
862 {
863  return new TempoEvent(&m_event);
864 }
865 
871 {
872  return new ClientEvent(&m_event);
873 }
874 
880 {
881  return new PortEvent(&m_event);
882 }
883 
889 {
890  return new SubscriptionEvent(&m_event);
891 }
892 
897 {
898  snd_seq_remove_events_malloc(&m_Info);
899 }
900 
906 {
907  snd_seq_remove_events_malloc(&m_Info);
908  snd_seq_remove_events_copy(m_Info, other.m_Info);
909 }
910 
915 RemoveEvents::RemoveEvents(snd_seq_remove_events_t* other)
916 {
917  snd_seq_remove_events_malloc(&m_Info);
918  snd_seq_remove_events_copy(m_Info, other);
919 }
920 
925 {
926  snd_seq_remove_events_free(m_Info);
927 }
928 
935 {
936  return new RemoveEvents(m_Info);
937 }
938 
946 {
947  if (this == &other)
948  return *this;
949  snd_seq_remove_events_copy(m_Info, other.m_Info);
950  return *this;
951 }
952 
957 int
959 {
960  return snd_seq_remove_events_sizeof();
961 }
962 
968 int
970 {
971  return snd_seq_remove_events_get_channel(m_Info);
972 }
973 
979 unsigned int
981 {
982  return snd_seq_remove_events_get_condition(m_Info);
983 }
984 
990 const snd_seq_addr_t*
992 {
993  return snd_seq_remove_events_get_dest(m_Info);
994 }
995 
1001 int
1003 {
1004  return snd_seq_remove_events_get_event_type(m_Info);
1005 }
1006 
1012 int
1014 {
1015  return snd_seq_remove_events_get_queue(m_Info);
1016 }
1017 
1023 int
1025 {
1026  return snd_seq_remove_events_get_tag(m_Info);
1027 }
1028 
1034 const snd_seq_timestamp_t*
1036 {
1037  return snd_seq_remove_events_get_time(m_Info);
1038 }
1039 
1045 void
1047 {
1048  snd_seq_remove_events_set_channel(m_Info, chan);
1049 }
1050 
1069 void
1070 RemoveEvents::setCondition(unsigned int cond)
1071 {
1072  snd_seq_remove_events_set_condition(m_Info, cond);
1073 }
1074 
1080 void
1081 RemoveEvents::setDest(const snd_seq_addr_t* dest)
1082 {
1083  snd_seq_remove_events_set_dest(m_Info, dest);
1084 }
1085 
1091 void
1093 {
1094  snd_seq_remove_events_set_event_type(m_Info, type);
1095 }
1096 
1102 void
1104 {
1105  snd_seq_remove_events_set_queue(m_Info, queue);
1106 }
1107 
1113 void
1115 {
1116  snd_seq_remove_events_set_tag(m_Info, tag);
1117 }
1118 
1124 void
1125 RemoveEvents::setTime(const snd_seq_timestamp_t* time)
1126 {
1127  snd_seq_remove_events_set_time(m_Info, time);
1128 }
1129 
1135 MidiCodec::MidiCodec( int bufsize, QObject* parent ) : QObject(parent)
1136 {
1137  DRUMSTICK_ALSA_CHECK_ERROR(snd_midi_event_new(bufsize, &m_Info));
1138 }
1139 
1144 {
1145  snd_midi_event_free(m_Info);
1146 }
1147 
1151 void
1153 {
1154  snd_midi_event_init(m_Info);
1155 }
1156 
1164 long
1165 MidiCodec::decode(unsigned char *buf,
1166  long count,
1167  const snd_seq_event_t *ev)
1168 {
1169  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_decode(m_Info, buf, count, ev));
1170 }
1171 
1179 long
1180 MidiCodec::encode(const unsigned char *buf,
1181  long count,
1182  snd_seq_event_t *ev)
1183 {
1184  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_encode(m_Info, buf, count, ev));
1185 }
1186 
1193 long
1195  snd_seq_event_t *ev)
1196 {
1197  return DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_encode_byte(m_Info, c, ev));
1198 }
1199 
1204 void
1206 {
1207  snd_midi_event_no_status(m_Info, enable ? 0 : 1);
1208 }
1209 
1213 void
1215 {
1216  snd_midi_event_reset_decode(m_Info);
1217 }
1218 
1222 void
1224 {
1225  snd_midi_event_reset_encode(m_Info);
1226 }
1227 
1232 void
1234 {
1235  DRUMSTICK_ALSA_CHECK_WARNING(snd_midi_event_resize_buffer(m_Info, bufsize));
1236 }
1237 
1238 } // namespace ALSA
1239 } // namespace drumstick
1240 
Classes managing ALSA Sequencer events.
The QEvent class is the base class of all event classes.
The QObject class is the base class of all Qt objects.
Event representing a MIDI channel pressure or after-touch event.
Definition: alsaevent.h:439
virtual ChanPressEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:565
ChanPressEvent()
Default constructor.
Definition: alsaevent.h:442
Base class for the events having a Channel property.
Definition: alsaevent.h:149
ChannelEvent()
Default constructor.
Definition: alsaevent.h:152
virtual ChannelEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:398
ALSA Event representing a change on some ALSA sequencer client on the system.
Definition: alsaevent.h:719
ClientEvent()
Default constructor.
Definition: alsaevent.h:722
virtual ClientEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:870
Event representing a MIDI control change event.
Definition: alsaevent.h:328
virtual ControllerEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:508
ControllerEvent()
Default constructor.
Definition: alsaevent.h:331
Base class for the events having Key and Velocity properties.
Definition: alsaevent.h:178
virtual KeyEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:407
KeyEvent()
Default constructor.
Definition: alsaevent.h:181
Event representing a MIDI key pressure, or polyphonic after-touch event.
Definition: alsaevent.h:305
KeyPressEvent()
Default constructor.
Definition: alsaevent.h:308
virtual KeyPressEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:488
void init()
CODEC initialization.
Definition: alsaevent.cpp:1152
long encode(const unsigned char *buf, long count, snd_seq_event_t *ev)
Encode from byte stream.
Definition: alsaevent.cpp:1180
void resetEncoder()
Reset MIDI encode parser.
Definition: alsaevent.cpp:1223
void resizeBuffer(int bufsize)
Resize the CODEC buffer.
Definition: alsaevent.cpp:1233
void enableRunningStatus(bool enable)
Enable MIDI running status (command merge)
Definition: alsaevent.cpp:1205
MidiCodec(int bufsize, QObject *parent=nullptr)
MidiCodec constructor.
Definition: alsaevent.cpp:1135
long decode(unsigned char *buf, long count, const snd_seq_event_t *ev)
Decode from event to bytes.
Definition: alsaevent.cpp:1165
void resetDecoder()
Reset MIDI decode parser.
Definition: alsaevent.cpp:1214
Class representing a note event with duration.
Definition: alsaevent.h:222
NoteEvent()
Default constructor.
Definition: alsaevent.h:225
virtual NoteEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:428
Event representing a note-off MIDI event.
Definition: alsaevent.h:282
NoteOffEvent()
Default constructor.
Definition: alsaevent.h:285
virtual NoteOffEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:468
Event representing a note-on MIDI event.
Definition: alsaevent.h:259
virtual NoteOnEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:448
NoteOnEvent()
Default constructor.
Definition: alsaevent.h:262
Event representing a MIDI bender, or pitch wheel event.
Definition: alsaevent.h:407
virtual PitchBendEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:546
PitchBendEvent()
Default constructor.
Definition: alsaevent.h:410
ALSA Event representing a change on some ALSA sequencer port on the system.
Definition: alsaevent.h:740
PortEvent()
Default constructor.
Definition: alsaevent.h:743
virtual PortEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:879
Event representing a MIDI program change event.
Definition: alsaevent.h:375
virtual ProgramChangeEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:527
ProgramChangeEvent()
Default constructor.
Definition: alsaevent.h:378
ALSA Event representing a queue control command.
Definition: alsaevent.h:552
virtual QueueControlEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:821
QueueControlEvent()
Default constructor.
Definition: alsaevent.h:555
Auxiliary class to remove events from an ALSA queue.
Definition: alsaevent.h:762
virtual ~RemoveEvents()
Destructor.
Definition: alsaevent.cpp:924
int getSizeOfInfo() const
Gets the allocated size of the ALSA remove events object.
Definition: alsaevent.cpp:958
void setEventType(int type)
Sets the event type.
Definition: alsaevent.cpp:1092
void setTag(int tag)
Sets the numeric tag.
Definition: alsaevent.cpp:1114
RemoveEvents & operator=(const RemoveEvents &other)
Assignment operator.
Definition: alsaevent.cpp:945
const snd_seq_timestamp_t * getTime()
Gets the timestamp.
Definition: alsaevent.cpp:1035
RemoveEvents()
Default constructor.
Definition: alsaevent.cpp:896
int getQueue()
Gets the queue number.
Definition: alsaevent.cpp:1013
void setCondition(unsigned int cond)
Sets the flags of the conditional event's removal.
Definition: alsaevent.cpp:1070
void setQueue(int queue)
Sets the queue number.
Definition: alsaevent.cpp:1103
void setTime(const snd_seq_timestamp_t *time)
Sets the timestamp.
Definition: alsaevent.cpp:1125
void setChannel(int chan)
Gets the MIDI channel.
Definition: alsaevent.cpp:1046
int getEventType()
Gets the event type.
Definition: alsaevent.cpp:1002
RemoveEvents * clone()
Create a new object copied from this object and return a pointer to the copy.
Definition: alsaevent.cpp:934
void setDest(const snd_seq_addr_t *dest)
Set the destination address.
Definition: alsaevent.cpp:1081
int getTag()
Gets the numeric tag.
Definition: alsaevent.cpp:1024
const snd_seq_addr_t * getDest()
Gets the destination.
Definition: alsaevent.cpp:991
int getChannel()
Gets the MIDI channel.
Definition: alsaevent.cpp:969
unsigned int getCondition()
Gets the condition.
Definition: alsaevent.cpp:980
Base class for the event's hierarchy.
Definition: alsaevent.h:58
snd_seq_event_t m_event
ALSA sequencer event record.
Definition: alsaevent.h:142
static bool isConnectionChange(const SequencerEvent *event)
Checks if the event's type is of type connection change.
Definition: alsaevent.cpp:183
void setSequencerType(const snd_seq_event_type_t eventType)
Sets the event's ALSA sequencer type.
Definition: alsaevent.cpp:221
int getEncodedLength()
Gets the encoded length of the event record.
Definition: alsaevent.cpp:380
static bool isChannel(const SequencerEvent *event)
Checks if the event's type is a Channel Voice message.
Definition: alsaevent.cpp:203
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
void setDirect()
Sets the event to be immediately delivered, not queued/scheduled.
Definition: alsaevent.cpp:267
virtual SequencerEvent * clone() const
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:389
unsigned char getRaw8(const unsigned int n) const
Gets an event's raw 8 bits parameter.
Definition: alsaevent.cpp:351
void setRaw32(const unsigned int n, const unsigned int value)
Sets an event's raw 32 bits parameter.
Definition: alsaevent.cpp:340
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
SequencerEvent()
Default constructor.
Definition: alsaevent.cpp:99
unsigned int getRaw32(const unsigned int n) const
Gets an event's raw 32 bits parameter.
Definition: alsaevent.cpp:329
void setRaw8(const unsigned int n, const unsigned char value)
Sets an event's raw 8 bits parameter.
Definition: alsaevent.cpp:362
static bool isSubscription(const SequencerEvent *event)
Checks if the event's type is a subscription.
Definition: alsaevent.cpp:142
void setSubscribers()
Sets the event's destination to be all the subscribers of the source port.
Definition: alsaevent.cpp:250
void setDestination(const unsigned char client, const unsigned char port)
Sets the client:port destination of the event.
Definition: alsaevent.cpp:232
static bool isPort(const SequencerEvent *event)
Checks if the event's type is of type port.
Definition: alsaevent.cpp:155
void setSource(const unsigned char port)
Sets the event's source port ID.
Definition: alsaevent.cpp:242
Q_DECL_DEPRECATED void free()
Releases the event record.
Definition: alsaevent.cpp:371
static bool isClient(const SequencerEvent *event)
Checks if the event's type is of type client.
Definition: alsaevent.cpp:169
void setTag(const unsigned char aTag)
Sets the event's tag.
Definition: alsaevent.cpp:314
void setPriority(const bool high)
Sets the priority of the event.
Definition: alsaevent.cpp:304
SequencerEvent & operator=(const SequencerEvent &other)
Assignment operator.
Definition: alsaevent.cpp:130
void setBroadcast()
Sets the event's destination to be all queues/clients/ports/channels.
Definition: alsaevent.cpp:258
ALSA Event representing a subscription between two ALSA clients and ports.
Definition: alsaevent.h:673
virtual SubscriptionEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:888
SubscriptionEvent()
Default constructor.
Definition: alsaevent.h:676
Event representing a MIDI system exclusive event.
Definition: alsaevent.h:498
SysExEvent()
Default constructor.
Definition: alsaevent.cpp:651
virtual SysExEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:702
SystemEvent()
Default constructor.
Definition: alsaevent.h:536
virtual SystemEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:800
ALSA Event representing a tempo change for an ALSA queue.
Definition: alsaevent.h:656
TempoEvent()
Default constructor.
Definition: alsaevent.h:659
virtual TempoEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:861
Event representing a SMF text event.
Definition: alsaevent.h:515
TextEvent()
Default constructor.
Definition: alsaevent.cpp:710
virtual TextEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:781
QString getText() const
Gets the event's text content.
Definition: alsaevent.cpp:763
int getTextType() const
Gets the event's SMF text type.
Definition: alsaevent.cpp:772
Generic event having a value property.
Definition: alsaevent.h:629
virtual ValueEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:842
void setValue(const int v)
Sets the event's value.
Definition: alsaevent.h:648
ValueEvent()
Default constructor.
Definition: alsaevent.h:632
Base class for variable length events.
Definition: alsaevent.h:471
virtual VariableEvent * clone() const override
Clone this object returning a pointer to the new object.
Definition: alsaevent.cpp:643
VariableEvent & operator=(const VariableEvent &other)
Assignment operator.
Definition: alsaevent.cpp:631
VariableEvent()
Default constructor.
Definition: alsaevent.cpp:573
Error checking functions and macros.
#define DRUMSTICK_ALSA_CHECK_WARNING(x)
This macro calls the check warning function.
Definition: errorcheck.h:86
#define DRUMSTICK_ALSA_CHECK_ERROR(x)
This macro calls the check error function.
Definition: errorcheck.h:80
const QEvent::Type SequencerEventType
Constant SequencerEventType is the QEvent::type() of any SequencerEvent object to be used to check th...
Definition: alsaevent.h:49
Drumstick common.
Definition: alsaclient.cpp:68