hydrogen 1.2.6
MidiMessage Class Reference

#include <MidiCommon.h>

Public Types

enum class  Event {
  Null , Note , CC , PC ,
  MmcStop , MmcPlay , MmcPause , MmcDeferredPlay ,
  MmcFastForward , MmcRewind , MmcRecordStrobe , MmcRecordExit ,
  MmcRecordReady
}
 Subset of incoming MIDI events that will be handled by Hydrogen. More...
 
enum  MidiMessageType {
  UNKNOWN , SYSEX , NOTE_ON , NOTE_OFF ,
  POLYPHONIC_KEY_PRESSURE , CONTROL_CHANGE , PROGRAM_CHANGE , CHANNEL_PRESSURE ,
  PITCH_WHEEL , START , CONTINUE , STOP ,
  SONG_POS , QUARTER_FRAME , SONG_SELECT , TUNE_REQUEST ,
  TIMING_CLOCK , ACTIVE_SENSING , RESET
}
 All possible types of incoming MIDI messages. More...
 

Public Member Functions

 MidiMessage ()
 
void clear ()
 Reset message.
 
void setType (int nStatusByte)
 Derives and set m_type (and if applicable m_nChannel) using the statusByte of an incoming MIDI message.
 
QString toQString (const QString &sPrefix="", bool bShort=true) const
 Formatted string version for debugging purposes.
 

Static Public Member Functions

static QString EventToQString (Event event)
 
static QStringList getEventList ()
 Retrieve the string representation for all available Event.
 
static Event QStringToEvent (const QString &sEvent)
 
static QString TypeToQString (MidiMessageType type)
 

Data Fields

int m_nChannel
 
int m_nData1
 
int m_nData2
 
std::vector< unsigned char > m_sysexData
 
MidiMessageType m_type
 

Static Public Attributes

static constexpr int instrumentOffset = 36
 When recording notes using MIDI NOTE_ON events this offset will be applied to the provided pitch in order to map it to an instrument number in the current drmmkit.
 

Detailed Description

Definition at line 37 of file MidiCommon.h.

Member Enumeration Documentation

◆ Event

enum class Event
strong

Subset of incoming MIDI events that will be handled by Hydrogen.

Enumerator
Null 
Note 
CC 
PC 
MmcStop 
MmcPlay 
MmcPause 
MmcDeferredPlay 
MmcFastForward 
MmcRewind 
MmcRecordStrobe 
MmcRecordExit 
MmcRecordReady 

Definition at line 66 of file MidiCommon.h.

◆ MidiMessageType

All possible types of incoming MIDI messages.

Enumerator
UNKNOWN 
SYSEX 
NOTE_ON 
NOTE_OFF 
POLYPHONIC_KEY_PRESSURE 
CONTROL_CHANGE 
PROGRAM_CHANGE 
CHANNEL_PRESSURE 
PITCH_WHEEL 
START 
CONTINUE 
STOP 
SONG_POS 
QUARTER_FRAME 
SONG_SELECT 
TUNE_REQUEST 
TIMING_CLOCK 
ACTIVE_SENSING 
RESET 

Definition at line 41 of file MidiCommon.h.

Constructor & Destructor Documentation

◆ MidiMessage()

MidiMessage ( )
inline

Definition at line 99 of file MidiCommon.h.

Member Function Documentation

◆ clear()

void clear ( )

Reset message.

Definition at line 27 of file MidiCommon.cpp.

◆ EventToQString()

QString EventToQString ( Event event)
static

Definition at line 222 of file MidiCommon.cpp.

◆ getEventList()

QStringList getEventList ( )
static

Retrieve the string representation for all available Event.

Definition at line 312 of file MidiCommon.cpp.

◆ QStringToEvent()

MidiMessage::Event QStringToEvent ( const QString & sEvent)
static

Definition at line 270 of file MidiCommon.cpp.

◆ setType()

void setType ( int nStatusByte)

Derives and set m_type (and if applicable m_nChannel) using the statusByte of an incoming MIDI message.

The particular values are defined by the MIDI standard and do not dependent on the individual drivers.

Definition at line 35 of file MidiCommon.cpp.

◆ toQString()

QString toQString ( const QString & sPrefix = "",
bool bShort = true ) const

Formatted string version for debugging purposes.

Parameters
sPrefixString prefix which will be added in front of every new line
bShortInstead of the whole content of all classes stored as members just a single unique identifier will be displayed without line breaks.
Returns
String presentation of current object.

Definition at line 107 of file MidiCommon.cpp.

◆ TypeToQString()

QString TypeToQString ( MidiMessageType type)
static

Definition at line 157 of file MidiCommon.cpp.

Field Documentation

◆ instrumentOffset

int instrumentOffset = 36
staticconstexpr

When recording notes using MIDI NOTE_ON events this offset will be applied to the provided pitch in order to map it to an instrument number in the current drmmkit.

It corresponds to the electric bass drum in the General MIDI notation.

Definition at line 91 of file MidiCommon.h.

◆ m_nChannel

int m_nChannel

Definition at line 96 of file MidiCommon.h.

◆ m_nData1

int m_nData1

Definition at line 94 of file MidiCommon.h.

◆ m_nData2

int m_nData2

Definition at line 95 of file MidiCommon.h.

◆ m_sysexData

std::vector<unsigned char> m_sysexData

Definition at line 97 of file MidiCommon.h.

◆ m_type

Definition at line 93 of file MidiCommon.h.