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);
1020 const 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);
1064 const 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) <<
"*";
virtual ChanPressEvent * clone() const override
Clone this object returning a pointer to the new object.
NoteEvent()
Default constructor.
QDebug operator<<(QDebug d, const SequencerEvent &event)
operator << outputs a SequencerEvent instance reference to a QDebug stream
void resetDecoder()
Reset MIDI decode parser.
ControllerEvent()
Default constructor.
static bool isChannel(const SequencerEvent *event)
Checks if the event's type is a Channel Voice message.
Error checking functions and macros.
virtual ProgramChangeEvent * clone() const override
Clone this object returning a pointer to the new object.
virtual ~RemoveEvents()
Destructor.
int getTextType() const
Gets the event's SMF text type.
ChanPressEvent()
Default constructor.
ClientEvent()
Default constructor.
void scheduleTick(const int queue, const int tick, const bool relative)
Sets the event to be scheduled in musical time (ticks) units.
SysExEvent()
Default constructor.
void setCondition(unsigned int cond)
Sets the flags of the conditional event's removal.
Base class for the events having Key and Velocity properties.
void setDest(const snd_seq_addr_t *dest)
Set the destination address.
void setSubscribers()
Sets the event's destination to be all the subscribers of the source port.
QueueControlEvent()
Default constructor.
Event representing a MIDI bender, or pitch wheel event.
static bool isSubscription(const SequencerEvent *event)
Checks if the event's type is a subscription.
void setQueue(int queue)
Sets the queue number.
virtual PortEvent * clone() const override
Clone this object returning a pointer to the new object.
RemoveEvents * clone()
Create a new object copied from this object and return a pointer to the copy.
int getQueue()
Gets the queue number.
snd_seq_event_t m_event
ALSA sequencer event record.
void init()
CODEC initialization.
void resetEncoder()
Reset MIDI encode parser.
#define DRUMSTICK_ALSA_CHECK_WARNING(x)
This macro calls the check warning function.
void enableRunningStatus(bool enable)
Enable MIDI running status (command merge)
void setBroadcast()
Sets the event's destination to be all queues/clients/ports/channels.
Event representing a note-off MIDI event.
NoteOnEvent()
Default constructor.
Event representing a MIDI system exclusive event.
VariableEvent & operator=(const VariableEvent &other)
Assignment operator.
void setRaw32(const unsigned int n, const unsigned int value)
Sets an event's raw 32 bits parameter.
Q_DECL_DEPRECATED void free()
Releases the event record.
The QObject class is the base class of all Qt objects.
void setTag(const unsigned char aTag)
Sets the event's tag.
void setRaw8(const unsigned int n, const unsigned char value)
Sets an event's raw 8 bits parameter.
SequencerEvent & operator=(const SequencerEvent &other)
Assignment operator.
virtual ChannelEvent * clone() const override
Clone this object returning a pointer to the new object.
Generic event having a value property.
void setPriority(const bool high)
Sets the priority of the event.
virtual ValueEvent * clone() const override
Clone this object returning a pointer to the new object.
KeyPressEvent()
Default constructor.
virtual ControllerEvent * clone() const override
Clone this object returning a pointer to the new object.
virtual TextEvent * clone() const override
Clone this object returning a pointer to the new object.
const snd_seq_addr_t * getDest()
Gets the destination.
TextEvent & operator=(const TextEvent &other)
Assignment operator.
virtual NoteOnEvent * clone() const override
Clone this object returning a pointer to the new object.
void setValue(const int v)
Sets the event's value.
ChannelEvent()
Default constructor.
void setChannel(int chan)
Gets the MIDI channel.
NoteOffEvent()
Default constructor.
const QEvent::Type SequencerEventType
Constant SequencerEventType is the QEvent::type() of any SequencerEvent object to be used to check th...
virtual NoteOffEvent * clone() const override
Clone this object returning a pointer to the new object.
void setDirect()
Sets the event to be immediately delivered, not queued/scheduled.
QString getText() const
Gets the event's text content.
RemoveEvents()
Default constructor.
void setSequencerType(const snd_seq_event_type_t eventType)
Sets the event's ALSA sequencer type.
virtual SysExEvent * clone() const override
Clone this object returning a pointer to the new object.
static bool isPort(const SequencerEvent *event)
Checks if the event's type is of type port.
Event representing a MIDI channel pressure or after-touch event.
PitchBendEvent()
Default constructor.
virtual NoteEvent * clone() const override
Clone this object returning a pointer to the new object.
Class representing a note event with duration.
unsigned char getRaw8(const unsigned int n) const
Gets an event's raw 8 bits parameter.
int getEventType()
Gets the event type.
Base class for the event's hierarchy.
TextEvent()
Default constructor.
VariableEvent()
Default constructor.
static bool isConnectionChange(const SequencerEvent *event)
Checks if the event's type is of type connection change.
void setTag(int tag)
Sets the numeric tag.
KeyEvent()
Default constructor.
Auxiliary class to remove events from an ALSA queue.
virtual SequencerEvent * clone() const
Clone this object returning a pointer to the new object.
virtual KeyEvent * clone() const override
Clone this object returning a pointer to the new object.
void setEventType(int type)
Sets the event type.
ALSA Event representing a tempo change for an ALSA queue.
MidiCodec(int bufsize, QObject *parent=nullptr)
MidiCodec constructor.
Base class for variable length events.
virtual TempoEvent * clone() const override
Clone this object returning a pointer to the new object.
unsigned int getCondition()
Gets the condition.
TempoEvent()
Default constructor.
ALSA Event representing a queue control command.
PortEvent()
Default constructor.
RemoveEvents & operator=(const RemoveEvents &other)
Assignment operator.
Event representing a MIDI program change event.
long encode(const unsigned char *buf, long count, snd_seq_event_t *ev)
Encode from byte stream.
const snd_seq_timestamp_t * getTime()
Gets the timestamp.
QString typeOfEvent(const SequencerEvent &v)
typeOfEvent returns a QString representing the type of the event
virtual KeyPressEvent * clone() const override
Clone this object returning a pointer to the new object.
int getChannel()
Gets the MIDI channel.
virtual PitchBendEvent * clone() const override
Clone this object returning a pointer to the new object.
Base class for the events having a Channel property.
ValueEvent()
Default constructor.
Event representing a MIDI key pressure, or polyphonic after-touch event.
ProgramChangeEvent()
Default constructor.
SequencerEvent()
Default constructor.
int getEncodedLength()
Gets the encoded length of the event record.
static bool isClient(const SequencerEvent *event)
Checks if the event's type is of type client.
void resizeBuffer(int bufsize)
Resize the CODEC buffer.
Event representing a note-on MIDI event.
virtual SystemEvent * clone() const override
Clone this object returning a pointer to the new object.
int getSizeOfInfo() const
Gets the allocated size of the ALSA remove events object.
unsigned int getRaw32(const unsigned int n) const
Gets an event's raw 32 bits parameter.
virtual VariableEvent * 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.
The QEvent class is the base class of all event classes.
void setTime(const snd_seq_timestamp_t *time)
Sets the timestamp.
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.
void setSource(const unsigned char port)
Sets the event's source port ID.
int getTag()
Gets the numeric tag.
Classes managing ALSA Sequencer events.
SubscriptionEvent()
Default constructor.
void setDestination(const unsigned char client, const unsigned char port)
Sets the client:port destination of the event.
virtual SubscriptionEvent * clone() const override
Clone this object returning a pointer to the new object.
SysExEvent & operator=(const SysExEvent &other)
Assignment operator.
virtual ClientEvent * clone() const override
Clone this object returning a pointer to the new object.
long decode(unsigned char *buf, long count, const snd_seq_event_t *ev)
Decode from event to bytes.
virtual QueueControlEvent * clone() const override
Clone this object returning a pointer to the new object.
Event representing a MIDI control change event.
SystemEvent()
Default constructor.
ALSA Event representing a subscription between two ALSA clients and ports.
ALSA Event representing a change on some ALSA sequencer port on the system.
Event representing a SMF text event.
#define DRUMSTICK_ALSA_CHECK_ERROR(x)
This macro calls the check error function.