20#ifndef DRUMSTICK_ALSAEVENT_H
21#define DRUMSTICK_ALSAEVENT_H
45#define CLONE_EVENT_DECLARATION(T) virtual T* clone() { return new T(&m_event); }
63 void setSequencerType(
const snd_seq_event_type_t eventType);
70 void setDestination(
const unsigned char client,
const unsigned char port);
71 void setSource(
const unsigned char port);
102 void setSubscribers();
105 void scheduleTick(
const int queue,
const int tick,
const bool relative);
106 void scheduleReal(
const int queue,
const ulong secs,
const ulong nanos,
const bool relative);
107 void setPriority(
const bool high);
114 void setTag(
const unsigned char aTag);
115 unsigned int getRaw32(
const unsigned int n)
const;
116 void setRaw32(
const unsigned int n,
const unsigned int value);
117 unsigned char getRaw8(
const unsigned int n)
const;
118 void setRaw8(
const unsigned int n,
const unsigned char value);
124 int getEncodedLength();
136 void free() __attribute__((deprecated));
218 NoteEvent(
const int ch,
const int key,
const int vel,
const int dur);
245 NoteOnEvent(
const int ch,
const int key,
const int vel);
260 NoteOffEvent(
const int ch,
const int key,
const int vel);
391 const char*
getData()
const {
return static_cast<const char*
>(
m_event.data.ext.ptr); }
408 SysExEvent(
const unsigned int datalen,
char* dataptr);
424 explicit TextEvent(
const QString& text,
const int textType = 1);
426 TextEvent(
const unsigned int datalen,
char* dataptr);
462 QueueControlEvent(
const snd_seq_event_type_t type,
const int queue,
const int value);
501 ValueEvent(
const snd_seq_event_type_t type,
const int val);
561 int getClient()
const {
return m_event.data.addr.client; }
589 friend class MidiClient;
603 const snd_seq_addr_t*
getDest();
607 const snd_seq_timestamp_t*
getTime();
610 void setDest(
const snd_seq_addr_t* dest);
614 void setTime(
const snd_seq_timestamp_t* time);
617 snd_seq_remove_events_t* m_Info;
631 long decode(
unsigned char *buf,
633 const snd_seq_event_t *ev);
634 long encode(
const unsigned char *buf,
636 snd_seq_event_t *ev);
638 snd_seq_event_t *ev);
644 snd_midi_event_t* m_Info;
#define CLONE_EVENT_DECLARATION(T)
Macro to declare a virtual clone() method for SequencerEvent and derived classes.
const QEvent::Type SequencerEventType
Constant SequencerEventType is the QEvent::type() of any SequencerEvent object to be used to check th...
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.
ChanPressEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
void setValue(const int v)
Sets the channel aftertouch value.
int getValue() const
Gets the channel aftertouch value.
ChanPressEvent()
Default constructor.
void setChannel(const MidiByte c)
Sets the channel of the event.
ChannelEvent()
Default constructor.
int getChannel() const
Gets the event's channel.
ChannelEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
ClientEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
ClientEvent()
Default constructor.
Event representing a MIDI control change event.
uint getParam() const
Gets the controller event's parameter.
void setParam(const uint p)
Sets the controller event's parameter.
ControllerEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
void setValue(const int v)
Sets the controller event's value.
ControllerEvent()
Default constructor.
int getValue() const
Gets the controller event's value.
int getKey() const
Gets the MIDI note of this event.
KeyEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
void setKey(const MidiByte b)
Sets the MIDI note of this event.
KeyEvent()
Default constructor.
void setVelocity(const MidiByte b)
Sets the note velocity of this event.
int getVelocity() const
Gets the note velocity of this event.
Event representing a MIDI key pressure, or polyphonic after-touch event.
KeyPressEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
KeyPressEvent()
Default constructor.
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.
MidiCodec(int bufsize, QObject *parent=0)
MidiCodec constructor.
void enableRunningStatus(bool enable)
Enable MIDI running status (command merge)
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.
void setDuration(const ulong d)
Sets the note's duration.
ulong getDuration() const
Gets the note's duration.
NoteEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
Event representing a note-off MIDI event.
NoteOffEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
NoteOffEvent()
Default constructor.
Event representing a note-on MIDI event.
NoteOnEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
NoteOnEvent()
Default constructor.
Event representing a MIDI bender, or pitch wheel event.
void setValue(const int v)
Sets the MIDI pitch bend value, zero centered from -8192 to 8191.
PitchBendEvent(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.
PitchBendEvent()
Default constructor.
ALSA Event representing a change on some ALSA sequencer port on the system.
PortEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
PortEvent()
Default constructor.
int getPort() const
Gets the port number.
Event representing a MIDI program change event.
void setValue(const int v)
Sets the MIDI program number.
ProgramChangeEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
ProgramChangeEvent()
Default constructor.
int getValue() const
Gets the MIDI program number.
ALSA Event representing a queue control command.
void setSkewValue(const uint val)
Sets the skew value.
void setTickTime(const snd_seq_tick_time_t t)
Sets the musical time in ticks.
uint getPosition() const
Gets the queue position.
uint getSkewBase() const
Gets the skew base.
QueueControlEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
void setSkewBase(const uint base)
Sets the skew base, should be 65536.
snd_seq_tick_time_t getTickTime() const
Gets the musical time in ticks.
int getQueue() const
Gets the queue number.
void setQueue(const uchar q)
Sets the queue number.
uint getSkewValue() const
Gets the skew value.
int getValue() const
Gets the event's value.
void setPosition(const uint pos)
Sets the queue position.
QueueControlEvent()
Default constructor.
void setValue(const int val)
Sets the event's value.
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.
CLONE_EVENT_DECLARATION(SequencerEvent)
Clone this object returning a pointer to the new object.
snd_seq_event_t * getHandle()
Gets the handle of the event.
unsigned char getSourceClient() const
Gets the source client id.
unsigned int getRealTimeSecs() const
Gets the seconds of the event's real time.
unsigned char getTag() const
Gets the tag of the event.
snd_seq_tick_time_t getTick() const
Gets the tick time of the event.
unsigned char getSourcePort() const
Gets the source port id.
void free() __attribute__((deprecated))
Releases the event record.
SequencerEvent()
Default constructor.
virtual ~SequencerEvent()
Destructor.
snd_seq_event_type_t getSequencerType() const
Gets the sequencer event type.
unsigned int getRealTimeNanos() const
Gets the nanoseconds of the event's real time.
ALSA Event representing a subscription between two ALSA clients and ports.
bool subscribed() const
Returns true if the event was a subscribed port.
SubscriptionEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
int getDestClient() const
Gets the destination client number.
int getDestPort() const
Gets the destination port number.
SubscriptionEvent()
Default constructor.
int getSenderClient() const
Gets the sender client number.
int getSenderPort() const
Gets the sender port number.
bool unsubscribed() const
Returns true if the event was an unsubscribed port.
SysExEvent()
Default constructor.
SystemEvent()
Default constructor.
SystemEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
ALSA Event representing a tempo change for an ALSA queue.
TempoEvent()
Default constructor.
TempoEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
TextEvent()
Default constructor.
int m_textType
Clone this object returning a pointer to the new object.
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.
void setValue(const int v)
Sets the event's value.
ValueEvent(snd_seq_event_t *event)
Constructor from an ALSA event record.
ValueEvent()
Default constructor.
int getValue() const
Gets the event's value.
Base class for variable length events.
QByteArray m_data
Clone this object returning a pointer to the new object.
unsigned int getLength() const
Gets the data length.
VariableEvent & operator=(const VariableEvent &other)
Assignment operator.
const char * getData() const
Gets the data pointer.
VariableEvent()
Default constructor.
quint8 MidiByte
8-bit unsigned number to be used as a MIDI message parameter