146 snd_seq_event_type_t te =
event->getSequencerType();
147 return ( te == SND_SEQ_EVENT_PORT_SUBSCRIBED ||
148 te == SND_SEQ_EVENT_PORT_UNSUBSCRIBED );
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 );
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 );
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 );
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 );
236 snd_seq_ev_set_dest(&
m_event, client, port);
246 snd_seq_ev_set_source(&
m_event, port);
262 snd_seq_ev_set_broadcast(&
m_event);
271 snd_seq_ev_set_direct(&
m_event);
282 snd_seq_ev_schedule_tick(&
m_event, queue, relative, tick);
294 snd_seq_real_time_t rtime;
296 rtime.tv_nsec = nanos;
297 snd_seq_ev_schedule_real(&
m_event, queue, relative, &rtime);
308 snd_seq_ev_set_priority(&
m_event, high);
318#if SND_LIB_VERSION > 0x010008
319 snd_seq_ev_set_tag(&
m_event, aTag);
333 if (n < 3)
return m_event.data.raw32.d[n];
344 if (n < 3)
m_event.data.raw32.d[n] = value;
355 if (n < 12)
return m_event.data.raw8.d[n];
366 if (n < 12)
m_event.data.raw8.d[n] = value;
384 return snd_seq_event_length(&
m_event);
423 snd_seq_ev_set_note(&
m_event, ch, key, vel, dur);
443 snd_seq_ev_set_noteon(&
m_event, ch, key, vel);
463 snd_seq_ev_set_noteoff(&
m_event, ch, key, vel);
483 snd_seq_ev_set_keypress(&
m_event, ch, key, vel);
503 snd_seq_ev_set_controller(&
m_event, ch, cc, val);
522 snd_seq_ev_set_pgmchange(&
m_event, ch, val);
541 snd_seq_ev_set_pitchbend(&
m_event, ch, val);
560 snd_seq_ev_set_chanpress(&
m_event, ch, val);
579 snd_seq_ev_set_variable ( &
m_event, m_data.size(), m_data.data() );
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() );
602 snd_seq_ev_set_variable ( &
m_event, m_data.size(), m_data.data() );
612 m_data = other.m_data;
613 snd_seq_ev_set_variable ( &
m_event, m_data.size(), m_data.data() );
624 m_data = QByteArray(dataptr, datalen);
625 snd_seq_ev_set_variable( &
m_event, m_data.size(), m_data.data() );
636 m_data = other.m_data;
637 snd_seq_ev_set_variable ( &
m_event, m_data.size(), m_data.data() );
656 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
666 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
676 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
686 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
697 snd_seq_ev_set_sysex( &
m_event, m_data.size(), m_data.data() );
717 m_data = other.m_data;
718 snd_seq_ev_set_sysex(&
m_event, m_data.size(), m_data.data());
780 return QString::fromUtf8(m_data.data(), m_data.size());
809 m_data = other.m_data;
811 snd_seq_ev_set_variable(&
m_event, m_data.size(), m_data.data());
822 snd_seq_ev_set_fixed(&
m_event);
844 snd_seq_ev_set_queue_control(&
m_event, type, queue, value);
863 snd_seq_ev_set_fixed(&
m_event);
884 snd_seq_ev_set_queue_tempo(&
m_event, queue, tempo);
928 snd_seq_remove_events_malloc(&m_Info);
937 snd_seq_remove_events_malloc(&m_Info);
938 snd_seq_remove_events_copy(m_Info, other.m_Info);
947 snd_seq_remove_events_malloc(&m_Info);
948 snd_seq_remove_events_copy(m_Info, other);
956 snd_seq_remove_events_free(m_Info);
979 snd_seq_remove_events_copy(m_Info, other.m_Info);
990 return snd_seq_remove_events_sizeof();
1001 return snd_seq_remove_events_get_channel(m_Info);
1012 return snd_seq_remove_events_get_condition(m_Info);
1020const snd_seq_addr_t*
1023 return snd_seq_remove_events_get_dest(m_Info);
1034 return snd_seq_remove_events_get_event_type(m_Info);
1045 return snd_seq_remove_events_get_queue(m_Info);
1056 return snd_seq_remove_events_get_tag(m_Info);
1064const snd_seq_timestamp_t*
1067 return snd_seq_remove_events_get_time(m_Info);
1078 snd_seq_remove_events_set_channel(m_Info, chan);
1102 snd_seq_remove_events_set_condition(m_Info, cond);
1113 snd_seq_remove_events_set_dest(m_Info, dest);
1124 snd_seq_remove_events_set_event_type(m_Info, type);
1135 snd_seq_remove_events_set_queue(m_Info, queue);
1146 snd_seq_remove_events_set_tag(m_Info, tag);
1157 snd_seq_remove_events_set_time(m_Info, time);
1175 snd_midi_event_free(m_Info);
1184 snd_midi_event_init(m_Info);
1197 const snd_seq_event_t *ev)
1212 snd_seq_event_t *ev)
1225 snd_seq_event_t *ev)
1237 snd_midi_event_no_status(m_Info, enable ? 0 : 1);
1246 snd_midi_event_reset_decode(m_Info);
1255 snd_midi_event_reset_encode(m_Info);
1271 char *realname = abi::__cxa_demangle(
typeid(v).name(), 0, 0, &status);
1272 QString name(realname && realname[0] ? realname :
"drumstick::ALSA::SequencerEvent");
1279 QDebugStateSaver saver(d);
1286 QDebugStateSaver saver(d);
1287 d.noquote().nospace() <<
typeOfEvent(*event) <<
"*";
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.
QString typeOfEvent(const SequencerEvent &v)
typeOfEvent returns a QString representing the type of the event
QDebug operator<<(QDebug d, const SequencerEvent &event)
operator << outputs a SequencerEvent instance reference to a QDebug stream
const QEvent::Type SequencerEventType
Constant SequencerEventType is the QEvent::type() of any SequencerEvent object to be used to check th...