drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.

Class representing a note event with duration. More...

#include <alsaevent.h>

Inheritance diagram for NoteEvent:

Public Member Functions

 NoteEvent ()
 Default constructor.
 
 NoteEvent (const snd_seq_event_t *event)
 Constructor from an ALSA event record. More...
 
 NoteEvent (const int ch, const int key, const int vel, const int dur)
 Constructor. More...
 
ulong getDuration () const
 Gets the note's duration. More...
 
void setDuration (const ulong d)
 Sets the note's duration. More...
 
virtual NoteEventclone () const override
 Clone this object returning a pointer to the new object. More...
 
int getKey () const
 Gets the MIDI note of this event. More...
 
void setKey (const MidiByte b)
 Sets the MIDI note of this event. More...
 
int getVelocity () const
 Gets the note velocity of this event. More...
 
void setVelocity (const MidiByte b)
 Sets the note velocity of this event. More...
 
void setChannel (const MidiByte c)
 Sets the channel of the event. More...
 
int getChannel () const
 Gets the event's channel. More...
 
void setSequencerType (const snd_seq_event_type_t eventType)
 Sets the event's ALSA sequencer type. More...
 
snd_seq_event_type_t getSequencerType () const
 Gets the sequencer event type. More...
 
void setDestination (const unsigned char client, const unsigned char port)
 Sets the client:port destination of the event. More...
 
void setSource (const unsigned char port)
 Sets the event's source port ID. More...
 
unsigned char getSourceClient () const
 Gets the source client id. More...
 
unsigned char getSourcePort () const
 Gets the source port id. More...
 
snd_seq_tick_time_t getTick () const
 Gets the tick time of the event. More...
 
unsigned int getRealTimeSecs () const
 Gets the seconds of the event's real time. More...
 
unsigned int getRealTimeNanos () const
 Gets the nanoseconds of the event's real time. More...
 
void setSubscribers ()
 Sets the event's destination to be all the subscribers of the source port.
 
void setBroadcast ()
 Sets the event's destination to be all queues/clients/ports/channels.
 
void setDirect ()
 Sets the event to be immediately delivered, not queued/scheduled. More...
 
void scheduleTick (const int queue, const int tick, const bool relative)
 Sets the event to be scheduled in musical time (ticks) units. More...
 
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. More...
 
void setPriority (const bool high)
 Sets the priority of the event. More...
 
unsigned char getTag () const
 Gets the tag of the event. More...
 
void setTag (const unsigned char aTag)
 Sets the event's tag. More...
 
unsigned int getRaw32 (const unsigned int n) const
 Gets an event's raw 32 bits parameter. More...
 
void setRaw32 (const unsigned int n, const unsigned int value)
 Sets an event's raw 32 bits parameter. More...
 
unsigned char getRaw8 (const unsigned int n) const
 Gets an event's raw 8 bits parameter. More...
 
void setRaw8 (const unsigned int n, const unsigned char value)
 Sets an event's raw 8 bits parameter. More...
 
snd_seq_event_t * getHandle ()
 Gets the handle of the event. More...
 
int getEncodedLength ()
 Gets the encoded length of the event record. More...
 

Static Public Member Functions

static bool isSubscription (const SequencerEvent *event)
 Checks if the event's type is a subscription. More...
 
static bool isPort (const SequencerEvent *event)
 Checks if the event's type is of type port. More...
 
static bool isClient (const SequencerEvent *event)
 Checks if the event's type is of type client. More...
 
static bool isConnectionChange (const SequencerEvent *event)
 Checks if the event's type is of type connection change. More...
 
static bool isChannel (const SequencerEvent *event)
 Checks if the event's type is a Channel Voice message. More...
 

Protected Member Functions

Q_DECL_DEPRECATED void free ()
 Releases the event record. More...
 

Protected Attributes

snd_seq_event_t m_event
 ALSA sequencer event record. More...
 

Detailed Description

Class representing a note event with duration.

Note events are converted into two MIDI events, a note-on and a note-off over the wire.

Examples
drumgrid.cpp, and metronome.cpp.

Definition at line 231 of file alsaevent.h.

Constructor & Destructor Documentation

◆ NoteEvent() [1/2]

NoteEvent ( const snd_seq_event_t *  event)
inlineexplicit

Constructor from an ALSA event record.

Parameters
eventan ALSA event record

Definition at line 240 of file alsaevent.h.

◆ NoteEvent() [2/2]

NoteEvent ( const int  ch,
const int  key,
const int  vel,
const int  dur 
)

Constructor.

Constructor using proper attribute values.

Parameters
chMIDI Channel.
keyMIDI note.
velNote velocity.
durNote duration.

Definition at line 419 of file alsaevent.cpp.

References SequencerEvent::m_event.

Member Function Documentation

◆ clone()

NoteEvent * clone ( ) const
overridevirtual

Clone this object returning a pointer to the new object.

Returns
pointer to the new object

Reimplemented from KeyEvent.

Definition at line 428 of file alsaevent.cpp.

References SequencerEvent::m_event, and NoteEvent::NoteEvent().

◆ free()

void free ( )
protectedinherited

Releases the event record.

Deprecated:
the event record is not allocated, so you don't have to call this function

Definition at line 371 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ getChannel()

int getChannel ( ) const
inlineinherited

Gets the event's channel.

Returns
The event's channel
See also
setChannel()
Examples
dumpmid.cpp.

Definition at line 179 of file alsaevent.h.

◆ getDuration()

ulong getDuration ( ) const
inline

Gets the note's duration.

Returns
The duration of the event
See also
setDuration()

Definition at line 250 of file alsaevent.h.

◆ getEncodedLength()

int getEncodedLength ( )
inherited

Gets the encoded length of the event record.

Returns
The encoded length.

Definition at line 380 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ getHandle()

snd_seq_event_t * getHandle ( )
inlineinherited

◆ getKey()

int getKey ( ) const
inlineinherited

Gets the MIDI note of this event.

Returns
The event's MIDI note.
See also
setKey()
Examples
dumpmid.cpp.

Definition at line 202 of file alsaevent.h.

◆ getRaw32()

unsigned int getRaw32 ( const unsigned int  n) const
inherited

Gets an event's raw 32 bits parameter.

Parameters
nThe parameter index, between 0 and 2.
Returns
The parameter's value.
See also
setRaw32()

Definition at line 329 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ getRaw8()

unsigned char getRaw8 ( const unsigned int  n) const
inherited

Gets an event's raw 8 bits parameter.

Parameters
nThe parameter index, between 0 and 11.
Returns
The parameter's value.
See also
setRaw8()

Definition at line 351 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ getRealTimeNanos()

unsigned int getRealTimeNanos ( ) const
inlineinherited

Gets the nanoseconds of the event's real time.

Returns
The nanoseconds of the time.
See also
scheduleReal(), getRealTimeSecs()

Definition at line 113 of file alsaevent.h.

◆ getRealTimeSecs()

unsigned int getRealTimeSecs ( ) const
inlineinherited

Gets the seconds of the event's real time.

Returns
The seconds of the time.
See also
scheduleReal(), getRealTimeNanos()

Definition at line 107 of file alsaevent.h.

◆ getSequencerType()

snd_seq_event_type_t getSequencerType ( ) const
inlineinherited

Gets the sequencer event type.

Returns
The sequencer event type.
See also
setSequencerType()
Examples
drumgrid.cpp, dumpmid.cpp, and metronome.cpp.

Definition at line 81 of file alsaevent.h.

◆ getSourceClient()

unsigned char getSourceClient ( ) const
inlineinherited

Gets the source client id.

Returns
The source client id.
See also
setSource()
Examples
dumpmid.cpp.

Definition at line 89 of file alsaevent.h.

◆ getSourcePort()

unsigned char getSourcePort ( ) const
inlineinherited

Gets the source port id.

Returns
The source port id.
See also
setSource()
Examples
dumpmid.cpp.

Definition at line 95 of file alsaevent.h.

◆ getTag()

unsigned char getTag ( ) const
inlineinherited

Gets the tag of the event.

Returns
The event's tag
See also
setTag()

Definition at line 125 of file alsaevent.h.

◆ getTick()

snd_seq_tick_time_t getTick ( ) const
inlineinherited

Gets the tick time of the event.

Returns
The tick time.
See also
scheduleTick()
Examples
drumgrid.cpp, dumpmid.cpp, and metronome.cpp.

Definition at line 101 of file alsaevent.h.

◆ getVelocity()

int getVelocity ( ) const
inlineinherited

Gets the note velocity of this event.

Returns
The event's note velocity.
See also
setVelocity()
Examples
dumpmid.cpp.

Definition at line 214 of file alsaevent.h.

◆ isChannel()

bool isChannel ( const SequencerEvent event)
staticinherited

Checks if the event's type is a Channel Voice message.

Parameters
eventA SequencerEvent object pointer
Returns
True if the event is a channel voice message.
Since
0.2.0

Definition at line 203 of file alsaevent.cpp.

◆ isClient()

bool isClient ( const SequencerEvent event)
staticinherited

Checks if the event's type is of type client.

Parameters
eventA SequencerEvent object pointer
Returns
True if the event has a client start/exit/change type.

Definition at line 169 of file alsaevent.cpp.

◆ isConnectionChange()

bool isConnectionChange ( const SequencerEvent event)
staticinherited

Checks if the event's type is of type connection change.

Parameters
eventA SequencerEvent object pointer
Returns
True if the event has a client/port/subscription type.

Definition at line 183 of file alsaevent.cpp.

Referenced by SequencerOutputThread::run().

◆ isPort()

bool isPort ( const SequencerEvent event)
staticinherited

Checks if the event's type is of type port.

Parameters
eventA SequencerEvent object pointer
Returns
True if the event has a port start/exit/change type.

Definition at line 155 of file alsaevent.cpp.

◆ isSubscription()

bool isSubscription ( const SequencerEvent event)
staticinherited

Checks if the event's type is a subscription.

Parameters
eventA SequencerEvent object pointer
Returns
True if the event has a subscribe/unsubscribe type.

Definition at line 142 of file alsaevent.cpp.

◆ scheduleReal()

void scheduleReal ( const int  queue,
const ulong  secs,
const ulong  nanos,
const bool  relative 
)
inherited

Sets the event to be scheduled in real (clock) time units.

Parameters
queueThe queue number to be used.
secsThe time in whole seconds.
nanosThe nanoseconds to be added.
relativeUse relative (to the current) time instead of absolute time.

Definition at line 290 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ scheduleTick()

void scheduleTick ( const int  queue,
const int  tick,
const bool  relative 
)
inherited

Sets the event to be scheduled in musical time (ticks) units.

Parameters
queueThe queue number to be used.
tickThe time in ticks.
relativeUse relative (to the current) time instead of absolute time.
Examples
drumgrid.cpp, and metronome.cpp.

Definition at line 278 of file alsaevent.cpp.

References SequencerEvent::m_event.

Referenced by SequencerOutputThread::sendEchoEvent().

◆ setChannel()

void setChannel ( const MidiByte  c)
inlineinherited

Sets the channel of the event.

Parameters
cA channel, between 0 and 15.
See also
getChannel()

Definition at line 173 of file alsaevent.h.

◆ setDestination()

void setDestination ( const unsigned char  client,
const unsigned char  port 
)
inherited

Sets the client:port destination of the event.

Parameters
clientThe destination's client ID
portThe destination port ID
See also
setSubscribers()
Examples
drumgrid.cpp, and metronome.cpp.

Definition at line 232 of file alsaevent.cpp.

References SequencerEvent::m_event.

Referenced by SequencerOutputThread::sendEchoEvent().

◆ setDirect()

void setDirect ( )
inherited

Sets the event to be immediately delivered, not queued/scheduled.

See also
scheduleTick(), scheduleReal()
Examples
drumgrid.cpp, and metronome.cpp.

Definition at line 267 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ setDuration()

void setDuration ( const ulong  d)
inline

Sets the note's duration.

Parameters
dThe duration of the event
See also
getDuration()

Definition at line 256 of file alsaevent.h.

◆ setKey()

void setKey ( const MidiByte  b)
inlineinherited

Sets the MIDI note of this event.

Parameters
bA MIDI note, between 0 and 127.
See also
getKey()

Definition at line 208 of file alsaevent.h.

◆ setPriority()

void setPriority ( const bool  high)
inherited

Sets the priority of the event.

This is used in case of several events share the same scheduling time.

Parameters
highMark the event as a high priority one.

Definition at line 304 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ setRaw32()

void setRaw32 ( const unsigned int  n,
const unsigned int  value 
)
inherited

Sets an event's raw 32 bits parameter.

Parameters
nThe parameter index, between 0 and 2.
valueThe parameter's value.

Definition at line 340 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ setRaw8()

void setRaw8 ( const unsigned int  n,
const unsigned char  value 
)
inherited

Sets an event's raw 8 bits parameter.

Parameters
nThe parameter index, between 0 and 11.
valueThe parameter's value.

Definition at line 362 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ setSequencerType()

void setSequencerType ( const snd_seq_event_type_t  eventType)
inherited

Sets the event's ALSA sequencer type.

Parameters
eventTypeThe ALSA sequencer type

Definition at line 221 of file alsaevent.cpp.

References SequencerEvent::m_event.

Referenced by TextEvent::operator=(), SystemEvent::SystemEvent(), TextEvent::TextEvent(), and ValueEvent::ValueEvent().

◆ setSource()

void setSource ( const unsigned char  port)
inherited

Sets the event's source port ID.

Parameters
portThe source port ID
See also
getSourceClient(), getSourcePort()
Examples
drumgrid.cpp, and metronome.cpp.

Definition at line 242 of file alsaevent.cpp.

References SequencerEvent::m_event.

Referenced by SequencerOutputThread::sendEchoEvent().

◆ setTag()

void setTag ( const unsigned char  aTag)
inherited

Sets the event's tag.

This attribute is any arbitrary number, not used by the ALSA library. Range limited to 0 thru 255.

Parameters
aTagA tag number.

Definition at line 314 of file alsaevent.cpp.

References SequencerEvent::m_event.

◆ setVelocity()

void setVelocity ( const MidiByte  b)
inlineinherited

Sets the note velocity of this event.

Parameters
bA velocity value, between 0 and 127.
See also
getVelocity()

Definition at line 220 of file alsaevent.h.

Member Data Documentation

◆ m_event

snd_seq_event_t m_event
protectedinherited

ALSA sequencer event record.

See also
https://www.alsa-project.org/alsa-doc/alsa-lib/structsnd__seq__event.html

Definition at line 152 of file alsaevent.h.

Referenced by ChanPressEvent::ChanPressEvent(), SequencerEvent::clone(), ChannelEvent::clone(), KeyEvent::clone(), NoteEvent::clone(), NoteOnEvent::clone(), NoteOffEvent::clone(), KeyPressEvent::clone(), ControllerEvent::clone(), ProgramChangeEvent::clone(), PitchBendEvent::clone(), ChanPressEvent::clone(), VariableEvent::clone(), SysExEvent::clone(), TextEvent::clone(), SystemEvent::clone(), QueueControlEvent::clone(), ValueEvent::clone(), TempoEvent::clone(), SubscriptionEvent::clone(), ClientEvent::clone(), PortEvent::clone(), ControllerEvent::ControllerEvent(), SequencerEvent::free(), SequencerEvent::getEncodedLength(), SequencerEvent::getRaw32(), SequencerEvent::getRaw8(), KeyPressEvent::KeyPressEvent(), NoteEvent::NoteEvent(), NoteOffEvent::NoteOffEvent(), NoteOnEvent::NoteOnEvent(), SequencerEvent::operator=(), SysExEvent::operator=(), TextEvent::operator=(), VariableEvent::operator=(), PitchBendEvent::PitchBendEvent(), ProgramChangeEvent::ProgramChangeEvent(), QueueControlEvent::QueueControlEvent(), SequencerEvent::scheduleReal(), SequencerEvent::scheduleTick(), SequencerEvent::SequencerEvent(), SequencerEvent::setBroadcast(), SequencerEvent::setDestination(), SequencerEvent::setDirect(), SequencerEvent::setPriority(), SequencerEvent::setRaw32(), SequencerEvent::setRaw8(), SequencerEvent::setSequencerType(), SequencerEvent::setSource(), SequencerEvent::setSubscribers(), SequencerEvent::setTag(), SysExEvent::SysExEvent(), SystemEvent::SystemEvent(), TempoEvent::TempoEvent(), ValueEvent::ValueEvent(), and VariableEvent::VariableEvent().


The documentation for this class was generated from the following files: