19 #ifndef DRUMSTICK_ALSAEVENT_H 20 #define DRUMSTICK_ALSAEVENT_H 23 #include <alsa/asoundlib.h> 65 void setSequencerType(
const snd_seq_event_type_t eventType);
72 void setDestination(
const unsigned char client,
const unsigned char port);
73 void setSource(
const unsigned char port);
91 snd_seq_tick_time_t
getTick()
const {
return m_event.time.tick; }
104 void setSubscribers();
107 void scheduleTick(
const int queue,
const int tick,
const bool relative);
108 void scheduleReal(
const int queue,
const ulong secs,
const ulong nanos,
const bool relative);
109 void setPriority(
const bool high);
115 unsigned char getTag()
const {
return m_event.tag; }
116 void setTag(
const unsigned char aTag);
117 unsigned int getRaw32(
const unsigned int n)
const;
118 void setRaw32(
const unsigned int n,
const unsigned int value);
119 unsigned char getRaw8(
const unsigned int n)
const;
120 void setRaw8(
const unsigned int n,
const unsigned char value);
126 int getEncodedLength();
136 Q_DECL_DEPRECATED
void free();
192 int getKey()
const {
return m_event.data.note.note; }
212 virtual KeyEvent* clone()
const override;
234 NoteEvent(
const int ch,
const int key,
const int vel,
const int dur);
246 void setDuration(
const ulong d) { m_event.data.note.duration = d; }
248 virtual NoteEvent* clone()
const override;
267 NoteOnEvent(
const int ch,
const int key,
const int vel);
287 NoteOffEvent(
const int ch,
const int key,
const int vel);
333 uint
getParam()
const {
return m_event.data.control.param; }
339 void setParam(
const uint p ) { m_event.data.control.param = p; }
345 int getValue()
const {
return m_event.data.control.value; }
351 void setValue(
const int v ) { m_event.data.control.value = v; }
376 int getValue()
const {
return m_event.data.control.value; }
381 void setValue(
const int v ) { m_event.data.control.value = v; }
406 int getValue()
const {
return m_event.data.control.value; }
411 void setValue(
const int v ) { m_event.data.control.value = v; }
436 int getValue()
const {
return m_event.data.control.value; }
441 void setValue(
const int v ) { m_event.data.control.value = v; }
461 unsigned int getLength()
const {
return m_event.data.ext.len; }
466 const char*
getData()
const {
return static_cast<const char*
>(m_event.data.ext.ptr); }
479 explicit SysExEvent(
const snd_seq_event_t* event);
482 SysExEvent(
const unsigned int datalen,
char* dataptr);
496 explicit TextEvent(
const snd_seq_event_t* event);
497 explicit TextEvent(
const QString& text,
const int textType = 1);
499 TextEvent(
const unsigned int datalen,
char* dataptr);
500 QString getText()
const;
501 int getTextType()
const;
502 virtual TextEvent* clone()
const override;
520 explicit SystemEvent(
const snd_seq_event_type_t type);
539 QueueControlEvent(
const snd_seq_event_type_t type,
const int queue,
const int value);
544 int getQueue()
const {
return m_event.data.queue.queue; }
549 void setQueue(
const uchar q) { m_event.data.queue.queue = q; }
554 int getValue()
const {
return m_event.data.queue.param.value; }
559 void setValue(
const int val) { m_event.data.queue.param.value = val; }
564 uint
getPosition()
const {
return m_event.data.queue.param.position; }
569 void setPosition(
const uint pos) { m_event.data.queue.param.position = pos; }
574 snd_seq_tick_time_t
getTickTime()
const {
return m_event.data.queue.param.time.tick; }
579 void setTickTime(
const snd_seq_tick_time_t t) { m_event.data.queue.param.time.tick = t; }
584 uint
getSkewBase()
const {
return m_event.data.queue.param.skew.base; }
589 void setSkewBase(
const uint base) { m_event.data.queue.param.skew.base = base; }
594 uint
getSkewValue()
const {
return m_event.data.queue.param.skew.value; }
599 void setSkewValue(
const uint val) {m_event.data.queue.param.skew.value = val; }
616 ValueEvent(
const snd_seq_event_type_t type,
const int val);
621 int getValue()
const {
return m_event.data.control.value; }
626 void setValue(
const int v ) { m_event.data.control.value = v; }
664 bool subscribed()
const {
return (m_event.type == SND_SEQ_EVENT_PORT_SUBSCRIBED); }
669 bool unsubscribed()
const {
return (m_event.type == SND_SEQ_EVENT_PORT_UNSUBSCRIBED); }
689 int getDestPort()
const {
return m_event.data.connect.dest.port; }
710 int getClient()
const {
return m_event.data.addr.client; }
731 int getPort()
const {
return m_event.data.addr.port; }
732 virtual PortEvent* clone()
const override;
751 int getSizeOfInfo()
const;
754 unsigned int getCondition();
755 const snd_seq_addr_t* getDest();
759 const snd_seq_timestamp_t* getTime();
760 void setChannel(
int chan);
761 void setCondition(
unsigned int cond);
762 void setDest(
const snd_seq_addr_t* dest);
763 void setEventType(
int type);
764 void setQueue(
int queue);
765 void setTag(
int tag);
766 void setTime(
const snd_seq_timestamp_t* time);
769 snd_seq_remove_events_t* m_Info;
783 long decode(
unsigned char *buf,
785 const snd_seq_event_t *ev);
786 long encode(
const unsigned char *buf,
788 snd_seq_event_t *ev);
790 snd_seq_event_t *ev);
791 void enableRunningStatus(
bool enable);
794 void resizeBuffer(
int bufsize);
796 snd_midi_event_t* m_Info;
806 #endif //DRUMSTICK_ALSAEVENT_H void setPosition(const uint pos)
Sets the queue position.
NoteEvent()
Default constructor.
TempoEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
ControllerEvent()
Default constructor.
unsigned int getRealTimeSecs() const
Gets the seconds of the event's real time.
void setChannel(const MidiByte c)
Sets the channel of the event.
int getQueue() const
Gets the queue number.
ChanPressEvent()
Default constructor.
ClientEvent()
Default constructor.
KeyPressEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
void setValue(const int v)
Sets the controller event's value.
Base class for the events having Key and Velocity properties.
snd_seq_tick_time_t getTickTime() const
Gets the musical time in ticks.
int getValue() const
Gets the controller event's value.
unsigned int getRealTimeNanos() const
Gets the nanoseconds of the event's real time.
void setTickTime(const snd_seq_tick_time_t t)
Sets the musical time in ticks.
ClientEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
QueueControlEvent()
Default constructor.
unsigned char getSourcePort() const
Gets the source port id.
NoteEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
Event representing a MIDI bender, or pitch wheel event.
snd_seq_event_t m_event
ALSA sequencer event record.
unsigned int getLength() const
Gets the data length.
SubscriptionEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
Event representing a note-off MIDI event.
NoteOnEvent()
Default constructor.
void setValue(const int v)
Sets the MIDI program number.
Event representing a MIDI system exclusive event.
PortEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
void setSkewValue(const uint val)
Sets the skew value.
int getPort() const
Gets the port number.
void setVelocity(const MidiByte b)
Sets the note velocity of this event.
The QObject class is the base class of all Qt objects.
QueueControlEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
int getChannel() const
Gets the event's channel.
Generic event having a value property.
void setValue(const int val)
Sets the event's value.
Drumstick visibility macros.
SystemEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
KeyPressEvent()
Default constructor.
uint getPosition() const
Gets the queue position.
void setValue(const int v)
Sets the event's value.
int getKey() const
Gets the MIDI note of this event.
int getSenderClient() const
Gets the sender client number.
ChannelEvent()
Default constructor.
NoteOffEvent()
Default constructor.
int getClient() const
Gets the client number.
snd_seq_event_t * getHandle()
Gets the handle of the event.
const QEvent::Type SequencerEventType
Constant SequencerEventType is the QEvent::type() of any SequencerEvent object to be used to check th...
ValueEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
Event representing a MIDI channel pressure or after-touch event.
PitchBendEvent()
Default constructor.
void setQueue(const uchar q)
Sets the queue number.
void setValue(const int v)
Sets the MIDI pitch bend value, zero centered from -8192 to 8191.
Class representing a note event with duration.
Base class for the event's hierarchy.
void setKey(const MidiByte b)
Sets the MIDI note of this event.
NoteOnEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
int getValue() const
Gets the MIDI program number.
quint8 MidiByte
8-bit unsigned number to be used as a MIDI message parameter
KeyEvent()
Default constructor.
snd_seq_event_type_t getSequencerType() const
Gets the sequencer event type.
int getSenderPort() const
Gets the sender port number.
Auxiliary class to remove events from an ALSA queue.
unsigned char getTag() const
Gets the tag of the event.
ALSA Event representing a tempo change for an ALSA queue.
Auxiliary class to translate between raw MIDI streams and ALSA events.
KeyEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
Base class for variable length events.
ulong getDuration() const
Gets the note's duration.
NoteOffEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
bool unsubscribed() const
Returns true if the event was an unsubscribed port.
TempoEvent()
Default constructor.
ALSA Event representing a queue control command.
uint getSkewValue() const
Gets the skew value.
ProgramChangeEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
PortEvent()
Default constructor.
PitchBendEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
int getValue() const
Gets the MIDI pitch bend value, zero centered from -8192 to 8191.
ControllerEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
int getValue() const
Gets the event's value.
Event representing a MIDI program change event.
void setValue(const int v)
Sets the channel aftertouch value.
Base class for the events having a Channel property.
ValueEvent()
Default constructor.
void setParam(const uint p)
Sets the controller event's parameter.
Event representing a MIDI key pressure, or polyphonic after-touch event.
ChanPressEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
int getValue() const
Gets the event's value.
ProgramChangeEvent()
Default constructor.
int getDestClient() const
Gets the destination client number.
snd_seq_tick_time_t getTick() const
Gets the tick time of the event.
void setDuration(const ulong d)
Sets the note's duration.
void setSkewBase(const uint base)
Sets the skew base, should be 65536.
ChannelEvent(const snd_seq_event_t *event)
Constructor from an ALSA event record.
int getValue() const
Gets the channel aftertouch value.
bool subscribed() const
Returns true if the event was a subscribed port.
Event representing a note-on MIDI event.
int getVelocity() const
Gets the note velocity of this event.
uint getSkewBase() const
Gets the skew base.
const char * getData() const
Gets the data pointer.
ALSA Event representing a change on some ALSA sequencer client on the system.
The QEvent class is the base class of all event classes.
SubscriptionEvent()
Default constructor.
int getDestPort() const
Gets the destination port number.
unsigned char getSourceClient() const
Gets the source client id.
uint getParam() const
Gets the controller event's parameter.
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.