134 |
public: |
public: |
135 |
Event(){} |
Event(){} |
136 |
enum type_t { |
enum type_t { |
137 |
type_note_on, |
type_note_on, ///< (real) MIDI note-on event |
138 |
type_note_off, |
type_note_off, ///< (real) MIDI note-off event |
139 |
type_pitchbend, |
type_pitchbend, ///< MIDI pitch bend wheel change event |
140 |
type_control_change, |
type_control_change, ///< MIDI CC event |
141 |
type_sysex, ///< MIDI system exclusive message |
type_sysex, ///< MIDI system exclusive message |
142 |
type_cancel_release, ///< transformed either from a note-on or sustain-pedal-down event |
type_cancel_release_key, ///< transformed either from a (real) MIDI note-on or sustain-pedal-down event |
143 |
type_release, ///< transformed either from a note-off or sustain-pedal-up event |
type_release_key, ///< transformed either from a (real) MIDI note-off or sustain-pedal-up event |
144 |
|
type_release_note, ///< transformed from a type_stop_note event |
145 |
type_channel_pressure, ///< a.k.a. aftertouch |
type_channel_pressure, ///< a.k.a. aftertouch |
146 |
type_note_pressure, ///< polyphonic key pressure (aftertouch) |
type_note_pressure, ///< polyphonic key pressure (aftertouch) |
147 |
|
type_play_note, ///< caused by a call to built-in instrument script function play_note() |
148 |
|
type_stop_note, ///< caused by a call to built-in instrument script function note_off() |
149 |
|
type_note_synth_param, ///< change a note's synthesis parameters (upon real-time instrument script function calls, i.e. change_vol(), change_tune(), change_pan(), etc.) |
150 |
} Type; |
} Type; |
151 |
|
enum synth_param_t { |
152 |
|
synth_param_volume, |
153 |
|
synth_param_pitch, |
154 |
|
synth_param_pan, |
155 |
|
synth_param_cutoff, |
156 |
|
synth_param_resonance, |
157 |
|
}; |
158 |
union { |
union { |
159 |
/// Note-on and note-off event specifics |
/// Note-on and note-off event specifics |
160 |
struct _Note { |
struct _Note { |
163 |
uint8_t Velocity; ///< Trigger or release velocity of note-on / note-off event. |
uint8_t Velocity; ///< Trigger or release velocity of note-on / note-off event. |
164 |
int8_t Layer; ///< Layer index (usually only used if a note-on event has to be postponed, e.g. due to shortage of free voices). |
int8_t Layer; ///< Layer index (usually only used if a note-on event has to be postponed, e.g. due to shortage of free voices). |
165 |
int8_t ReleaseTrigger; ///< If new voice should be a release triggered voice (actually boolean field and usually only used if a note-on event has to be postponed, e.g. due to shortage of free voices). |
int8_t ReleaseTrigger; ///< If new voice should be a release triggered voice (actually boolean field and usually only used if a note-on event has to be postponed, e.g. due to shortage of free voices). |
166 |
note_id_t ID; ///< Unique numeric ID of the @c Note object associated with this note (on) event. |
note_id_t ID; ///< Unique numeric ID of the @c Note object associated with this note event. |
167 |
note_id_t ParentNoteID; ///< If not zero: Unique numeric ID of the parent @c Note object that shall become parent of resulting new Note object of this Event. So this is used to associate a new note with a previous note, i.e. to release the new note once the parent note was released. |
note_id_t ParentNoteID; ///< If not zero: Unique numeric ID of the parent @c Note object that shall become parent of resulting new Note object of this Event. So this is used to associate a new note with a previous note, i.e. to release the new note once the parent note was released. |
168 |
void* pRegion; ///< Engine specific pointer to instrument region |
void* pRegion; ///< Engine specific pointer to instrument region |
169 |
} Note; |
} Note; |
194 |
uint8_t Key; ///< MIDI note number where key pressure (polyphonic aftertouch) changed. |
uint8_t Key; ///< MIDI note number where key pressure (polyphonic aftertouch) changed. |
195 |
uint8_t Value; ///< New pressure value for note. |
uint8_t Value; ///< New pressure value for note. |
196 |
} NotePressure; |
} NotePressure; |
197 |
|
///< Note synthesis parameter change event's specifics (used for real-time instrument script built-in functions which may alter synthesis parameters on note level). |
198 |
|
struct _NoteSynthParam { |
199 |
|
note_id_t NoteID; ///< ID of Note whose voices shall be modified. |
200 |
|
synth_param_t Type; ///< Synthesis parameter which is to be changed. |
201 |
|
float Delta; ///< The value change that should be applied against the note's current synthesis parameter value. |
202 |
|
bool Relative; ///< Whether @c Delta should be applied relatively against the note's current synthesis parameter value (false means the paramter's current value is simply replaced by Delta). |
203 |
|
float AbsValue; ///< New current absolute value of synthesis parameter (that is after @c Delta being applied). |
204 |
|
} NoteSynthParam; |
205 |
} Param; |
} Param; |
206 |
EngineChannel* pEngineChannel; ///< Pointer to the EngineChannel where this event occured on, NULL means Engine global event (e.g. SysEx message). |
EngineChannel* pEngineChannel; ///< Pointer to the EngineChannel where this event occured on, NULL means Engine global event (e.g. SysEx message). |
207 |
MidiInputPort* pMidiInputPort; ///< Pointer to the MIDI input port on which this event occured (NOTE: currently only for global events, that is SysEx messages) |
MidiInputPort* pMidiInputPort; ///< Pointer to the MIDI input port on which this event occured (NOTE: currently only for global events, that is SysEx messages) |
209 |
inline void Init() { |
inline void Init() { |
210 |
Param.Note.ID = 0; |
Param.Note.ID = 0; |
211 |
Param.Note.ParentNoteID = 0; |
Param.Note.ParentNoteID = 0; |
212 |
|
Param.NoteSynthParam.NoteID = 0; |
213 |
} |
} |
214 |
inline int32_t FragmentPos() { |
inline int32_t FragmentPos() { |
215 |
if (iFragmentPos >= 0) return iFragmentPos; |
if (iFragmentPos >= 0) return iFragmentPos; |