NAP
Public Types | Public Member Functions | Static Public Attributes | List of all members
MidiEvent Class Reference

#include <midievent.h>

Public Types

enum  Type {
  noteOff = 0x80, noteOn = 0x90, afterTouch = 0xA0, controlChange = 0xB0,
  programChange = 0xC0, channelPressure = 0xD0, pitchBend = 0xE0
}
 

Public Member Functions

 MidiEvent ()=default
 
 MidiEvent (Type aType, MidiValue number=MIDI_NUMBER_OMNI, MidiValue value=MIDI_VALUE_OMNI, MidiValue channel=MIDI_CHANNEL_OMNI, const std::string &port="")
 
 MidiEvent (const std::vector< unsigned char > &data, const std::string &port)
 
virtual ~MidiEvent ()=default
 
bool corresponds (const MidiEvent &b) const
 
bool operator== (const MidiEvent &rhs) const
 
bool operator> (const MidiEvent &rhs) const
 
bool operator< (const MidiEvent &rhs) const
 
float getPitchBendValue () const
 
std::string toString () const
 
std::vector< unsigned char > getData () const
 
- Public Member Functions inherited from Event
virtual ~Event ()=default
 
 Event ()=default
 
 Event (const Event &)=delete
 
Eventoperator= (const Event &)=delete
 

Static Public Attributes

static constexpr MidiValue MIDI_MAX_VALUE = 127
 
static constexpr MidiValue MIDI_CONTROLLER_SUSTAIN = 64
 
static constexpr MidiValue MIDI_VALUE_OMNI = -1
 
static constexpr MidiValue MIDI_NUMBER_OMNI = MIDI_VALUE_OMNI
 
static constexpr MidiValue MIDI_CHANNEL_OMNI = MIDI_VALUE_OMNI
 
static constexpr MidiValue MIDI_NUMBER_NONE = 0
 

Description

Event representation of a midi message Storing a readable representation of the raw midi message and optionally the port number through which it is sent.

Inheritance diagram for MidiEvent:
[legend]
Collaboration diagram for MidiEvent:
[legend]

Member Enumeration Documentation

◆ Type

enum Type
strong

Different kinds of midi events

Enumerator
noteOff 

Note off message.

noteOn 

Note on message.

afterTouch 

After touch message.

controlChange 

Control change message.

programChange 

Program change message.

channelPressure 

Channel pressure message.

pitchBend 

Pitch band change.

Constructor & Destructor Documentation

◆ MidiEvent() [1/3]

MidiEvent ( )
default

◆ MidiEvent() [2/3]

MidiEvent ( Type  aType,
MidiValue  number = MIDI_NUMBER_OMNI,
MidiValue  value = MIDI_VALUE_OMNI,
MidiValue  channel = MIDI_CHANNEL_OMNI,
const std::string &  port = "" 
)

Constructor passing in values

◆ MidiEvent() [3/3]

MidiEvent ( const std::vector< unsigned char > &  data,
const std::string &  port 
)

Construct event from raw message data

◆ ~MidiEvent()

virtual ~MidiEvent ( )
virtualdefault

Member Function Documentation

◆ corresponds()

bool corresponds ( const MidiEvent b) const

this method checks if the messages described with b correspond to this message (using the OMNI wildcards)

◆ getData()

std::vector<unsigned char> getData ( ) const

Returns a raw data midi message that corresponds to the event and can be sent through midi output port.

◆ getPitchBendValue()

float getPitchBendValue ( ) const

If a pitch bend event, this returns the pitchbend amount between -1 and 1.

◆ operator<()

bool operator< ( const MidiEvent rhs) const

◆ operator==()

bool operator== ( const MidiEvent rhs) const

◆ operator>()

bool operator> ( const MidiEvent rhs) const

◆ toString()

std::string toString ( ) const

Returns the contents of the event as a formatted text string for logging

Member Data Documentation

◆ MIDI_CHANNEL_OMNI

constexpr MidiValue MIDI_CHANNEL_OMNI = MIDI_VALUE_OMNI
staticconstexpr

Wildcard value for midi channels

◆ MIDI_CONTROLLER_SUSTAIN

constexpr MidiValue MIDI_CONTROLLER_SUSTAIN = 64
staticconstexpr

CC number for sustain pedal

◆ MIDI_MAX_VALUE

constexpr MidiValue MIDI_MAX_VALUE = 127
staticconstexpr

Maximum value of a midi byte

◆ MIDI_NUMBER_NONE

constexpr MidiValue MIDI_NUMBER_NONE = 0
staticconstexpr

◆ MIDI_NUMBER_OMNI

constexpr MidiValue MIDI_NUMBER_OMNI = MIDI_VALUE_OMNI
staticconstexpr

Wildcard value for midi numbers

◆ MIDI_VALUE_OMNI

constexpr MidiValue MIDI_VALUE_OMNI = -1
staticconstexpr

Wildcard value for midi values