144 snd_seq_event_type_t te =
event->getSequencerType();
145 return ( te == SND_SEQ_EVENT_PORT_SUBSCRIBED ||
146 te == SND_SEQ_EVENT_PORT_UNSUBSCRIBED );
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 );
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 );
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 );
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 );
234 snd_seq_ev_set_dest(&
m_event, client, port);
244 snd_seq_ev_set_source(&
m_event, port);
260 snd_seq_ev_set_broadcast(&
m_event);
269 snd_seq_ev_set_direct(&
m_event);
280 snd_seq_ev_schedule_tick(&
m_event, queue, relative, tick);
292 snd_seq_real_time_t rtime;
294 rtime.tv_nsec = nanos;
295 snd_seq_ev_schedule_real(&
m_event, queue, relative, &rtime);
306 snd_seq_ev_set_priority(&
m_event, high);
316#if SND_LIB_VERSION > 0x010008
317 snd_seq_ev_set_tag(&
m_event, aTag);
331 if (n < 3)
return m_event.data.raw32.d[n];
342 if (n < 3)
m_event.data.raw32.d[n] = value;
353 if (n < 12)
return m_event.data.raw8.d[n];
364 if (n < 12)
m_event.data.raw8.d[n] = value;
382 return snd_seq_event_length(&
m_event);
421 snd_seq_ev_set_note(&
m_event, ch, key, vel, dur);
441 snd_seq_ev_set_noteon(&
m_event, ch, key, vel);
461 snd_seq_ev_set_noteoff(&
m_event, ch, key, vel);
481 snd_seq_ev_set_keypress(&
m_event, ch, key, vel);
501 snd_seq_ev_set_controller(&
m_event, ch, cc, val);
520 snd_seq_ev_set_pgmchange(&
m_event, ch, val);
539 snd_seq_ev_set_pitchbend(&
m_event, ch, val);
558 snd_seq_ev_set_chanpress(&
m_event, ch, val);
577 snd_seq_ev_set_variable ( &
m_event, m_data.size(), m_data.data() );
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() );
600 snd_seq_ev_set_variable ( &
m_event, m_data.size(), m_data.data() );
610 m_data = other.m_data;
611 snd_seq_ev_set_variable ( &
m_event, m_data.size(), m_data.data() );
622 m_data = QByteArray(dataptr, datalen);
623 snd_seq_ev_set_variable( &
m_event, m_data.size(), m_data.data() );
634 m_data = other.m_data;
635 snd_seq_ev_set_variable ( &
m_event, m_data.size(), m_data.data() );
654 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
664 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
674 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
684 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
695 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
715 m_data = other.m_data;
716 snd_seq_ev_set_sysex(&
m_event, m_data.size(), m_data.data());
778 return QString::fromUtf8(m_data.data(), m_data.size());
807 m_data = other.m_data;
809 snd_seq_ev_set_variable(&
m_event, m_data.size(), m_data.data());
820 snd_seq_ev_set_fixed(&
m_event);
842 snd_seq_ev_set_queue_control(&
m_event, type, queue, value);
861 snd_seq_ev_set_fixed(&
m_event);
882 snd_seq_ev_set_queue_tempo(&
m_event, queue, tempo);
926 snd_seq_remove_events_malloc(&m_Info);
935 snd_seq_remove_events_malloc(&m_Info);
936 snd_seq_remove_events_copy(m_Info, other.m_Info);
945 snd_seq_remove_events_malloc(&m_Info);
946 snd_seq_remove_events_copy(m_Info, other);
954 snd_seq_remove_events_free(m_Info);
977 snd_seq_remove_events_copy(m_Info, other.m_Info);
988 return snd_seq_remove_events_sizeof();
999 return snd_seq_remove_events_get_channel(m_Info);
1010 return snd_seq_remove_events_get_condition(m_Info);
1018const snd_seq_addr_t*
1021 return snd_seq_remove_events_get_dest(m_Info);
1032 return snd_seq_remove_events_get_event_type(m_Info);
1043 return snd_seq_remove_events_get_queue(m_Info);
1054 return snd_seq_remove_events_get_tag(m_Info);
1062const snd_seq_timestamp_t*
1065 return snd_seq_remove_events_get_time(m_Info);
1076 snd_seq_remove_events_set_channel(m_Info, chan);
1100 snd_seq_remove_events_set_condition(m_Info, cond);
1111 snd_seq_remove_events_set_dest(m_Info, dest);
1122 snd_seq_remove_events_set_event_type(m_Info, type);
1133 snd_seq_remove_events_set_queue(m_Info, queue);
1144 snd_seq_remove_events_set_tag(m_Info, tag);
1155 snd_seq_remove_events_set_time(m_Info, time);
1173 snd_midi_event_free(m_Info);
1182 snd_midi_event_init(m_Info);
1195 const snd_seq_event_t *ev)
1210 snd_seq_event_t *ev)
1223 snd_seq_event_t *ev)
1235 snd_midi_event_no_status(m_Info, enable ? 0 : 1);
1244 snd_midi_event_reset_decode(m_Info);
1253 snd_midi_event_reset_encode(m_Info);
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.
virtual ChanPressEvent * clone() const override
Clone this object returning a pointer to the new object.
ChanPressEvent()
Default constructor.
Base class for the events having a Channel property.
ChannelEvent()
Default constructor.
virtual ChannelEvent * clone() const override
Clone this object returning a pointer to the new object.
ALSA Event representing a change on some ALSA sequencer client on the system.
ClientEvent()
Default constructor.
virtual ClientEvent * clone() const override
Clone this object returning a pointer to the new object.
Event representing a MIDI control change event.
virtual ControllerEvent * clone() const override
Clone this object returning a pointer to the new object.
ControllerEvent()
Default constructor.
Base class for the events having Key and Velocity properties.
virtual KeyEvent * clone() const override
Clone this object returning a pointer to the new object.
KeyEvent()
Default constructor.
Event representing a MIDI key pressure, or polyphonic after-touch event.
KeyPressEvent()
Default constructor.
virtual KeyPressEvent * clone() const override
Clone this object returning a pointer to the new object.
void init()
CODEC initialization.
long encode(const unsigned char *buf, long count, snd_seq_event_t *ev)
Encode from byte stream.
void resetEncoder()
Reset MIDI encode parser.
void resizeBuffer(int bufsize)
Resize the CODEC buffer.
void enableRunningStatus(bool enable)
Enable MIDI running status (command merge)
MidiCodec(int bufsize, QObject *parent=nullptr)
MidiCodec constructor.
long decode(unsigned char *buf, long count, const snd_seq_event_t *ev)
Decode from event to bytes.
void resetDecoder()
Reset MIDI decode parser.
Class representing a note event with duration.
NoteEvent()
Default constructor.
virtual NoteEvent * clone() const override
Clone this object returning a pointer to the new object.
Event representing a note-off MIDI event.
NoteOffEvent()
Default constructor.
virtual NoteOffEvent * clone() const override
Clone this object returning a pointer to the new object.
Event representing a note-on MIDI event.
virtual NoteOnEvent * clone() const override
Clone this object returning a pointer to the new object.
NoteOnEvent()
Default constructor.
Event representing a MIDI bender, or pitch wheel event.
virtual PitchBendEvent * clone() const override
Clone this object returning a pointer to the new object.
PitchBendEvent()
Default constructor.
ALSA Event representing a change on some ALSA sequencer port on the system.
PortEvent()
Default constructor.
virtual PortEvent * clone() const override
Clone this object returning a pointer to the new object.
Event representing a MIDI program change event.
virtual ProgramChangeEvent * clone() const override
Clone this object returning a pointer to the new object.
ProgramChangeEvent()
Default constructor.
ALSA Event representing a queue control command.
virtual QueueControlEvent * clone() const override
Clone this object returning a pointer to the new object.
QueueControlEvent()
Default constructor.
Auxiliary class to remove events from an ALSA queue.
virtual ~RemoveEvents()
Destructor.
int getSizeOfInfo() const
Gets the allocated size of the ALSA remove events object.
void setEventType(int type)
Sets the event type.
void setTag(int tag)
Sets the numeric tag.
RemoveEvents & operator=(const RemoveEvents &other)
Assignment operator.
const snd_seq_timestamp_t * getTime()
Gets the timestamp.
RemoveEvents()
Default constructor.
int getQueue()
Gets the queue number.
void setCondition(unsigned int cond)
Sets the flags of the conditional event's removal.
void setQueue(int queue)
Sets the queue number.
void setTime(const snd_seq_timestamp_t *time)
Sets the timestamp.
void setChannel(int chan)
Gets the MIDI channel.
int getEventType()
Gets the event type.
RemoveEvents * clone()
Create a new object copied from this object and return a pointer to the copy.
void setDest(const snd_seq_addr_t *dest)
Set the destination address.
int getTag()
Gets the numeric tag.
const snd_seq_addr_t * getDest()
Gets the destination.
int getChannel()
Gets the MIDI channel.
unsigned int getCondition()
Gets the condition.
Base class for the event's hierarchy.
snd_seq_event_t m_event
ALSA sequencer event record.
static bool isConnectionChange(const SequencerEvent *event)
Checks if the event's type is of type connection change.
void setSequencerType(const snd_seq_event_type_t eventType)
Sets the event's ALSA sequencer type.
int getEncodedLength()
Gets the encoded length of the event record.
static bool isChannel(const SequencerEvent *event)
Checks if the event's type is a Channel Voice message.
void scheduleTick(const int queue, const int tick, const bool relative)
Sets the event to be scheduled in musical time (ticks) units.
void setDirect()
Sets the event to be immediately delivered, not queued/scheduled.
virtual SequencerEvent * clone() const
Clone this object returning a pointer to the new object.
unsigned char getRaw8(const unsigned int n) const
Gets an event's raw 8 bits parameter.
void setRaw32(const unsigned int n, const unsigned int value)
Sets an event's raw 32 bits parameter.
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.
SequencerEvent()
Default constructor.
unsigned int getRaw32(const unsigned int n) const
Gets an event's raw 32 bits parameter.
void setRaw8(const unsigned int n, const unsigned char value)
Sets an event's raw 8 bits parameter.
static bool isSubscription(const SequencerEvent *event)
Checks if the event's type is a subscription.
void setSubscribers()
Sets the event's destination to be all the subscribers of the source port.
void setDestination(const unsigned char client, const unsigned char port)
Sets the client:port destination of the event.
static bool isPort(const SequencerEvent *event)
Checks if the event's type is of type port.
void setSource(const unsigned char port)
Sets the event's source port ID.
Q_DECL_DEPRECATED void free()
Releases the event record.
static bool isClient(const SequencerEvent *event)
Checks if the event's type is of type client.
void setTag(const unsigned char aTag)
Sets the event's tag.
void setPriority(const bool high)
Sets the priority of the event.
SequencerEvent & operator=(const SequencerEvent &other)
Assignment operator.
void setBroadcast()
Sets the event's destination to be all queues/clients/ports/channels.
ALSA Event representing a subscription between two ALSA clients and ports.
virtual SubscriptionEvent * clone() const override
Clone this object returning a pointer to the new object.
SubscriptionEvent()
Default constructor.
Event representing a MIDI system exclusive event.
SysExEvent & operator=(const SysExEvent &other)
Assignment operator.
SysExEvent()
Default constructor.
virtual SysExEvent * clone() const override
Clone this object returning a pointer to the new object.
SystemEvent()
Default constructor.
virtual SystemEvent * clone() const override
Clone this object returning a pointer to the new object.
ALSA Event representing a tempo change for an ALSA queue.
TempoEvent()
Default constructor.
virtual TempoEvent * clone() const override
Clone this object returning a pointer to the new object.
Event representing a SMF text event.
TextEvent()
Default constructor.
virtual TextEvent * clone() const override
Clone this object returning a pointer to the new object.
TextEvent & operator=(const TextEvent &other)
Assignment operator.
QString getText() const
Gets the event's text content.
int getTextType() const
Gets the event's SMF text type.
Generic event having a value property.
virtual ValueEvent * clone() const override
Clone this object returning a pointer to the new object.
void setValue(const int v)
Sets the event's value.
ValueEvent()
Default constructor.
Base class for variable length events.
virtual VariableEvent * clone() const override
Clone this object returning a pointer to the new object.
VariableEvent & operator=(const VariableEvent &other)
Assignment operator.
VariableEvent()
Default constructor.
Error checking functions and macros.
#define DRUMSTICK_ALSA_CHECK_WARNING(x)
This macro calls the check warning function.
#define DRUMSTICK_ALSA_CHECK_ERROR(x)
This macro calls the check error function.
const QEvent::Type SequencerEventType
Constant SequencerEventType is the QEvent::type() of any SequencerEvent object to be used to check th...