Midi Event class for MPTK. This class is more simple to use that the standard Midi structure.
The main property is Command, the content and role of other properties (as Value) depend on the value of Command. Look at the Value property.
With this class, you can: play and stop a note, change instrument (preset, patch, ...), change some control as modulation (Pro) ...
Use this class in relation with these classes:
More...
Inherits ICloneable, and ICloneable.
Public Types | |
enum class | EnumLength |
Note length as https://en.wikipedia.org/wiki/Note_value More... | |
Public Member Functions | |
MPTKEvent (ulong data) | |
Create a MPTK Midi event from a midi input message More... | |
void | MTPK_ClearSynthParameter () |
[Pro] V2.88.2 Reset synth parameter to default soundfont value. More... | |
float | MTPK_GetSynthParameterDefaultValue (fluid_gen_type genType) |
[Pro] V2.88.2 Get the default soundfont value for the generator. Each generator has a specific range of value, see generators list here. Also the value returned by this method is normalized (value between 0 and 1). More... | |
bool | MTPK_ModifySynthParameter (fluid_gen_type genType, float value, MPTKModeGeneratorChange mode) |
[Pro] Apply modification on default SoundFont generator value. Can be applied independently for each notes, can be applied before the note is played and in real time when the note is playing. Each generator has a specific range of value, see generators list here. Also the value used by this method is normalized (value between 0 and 1). See here for more details. More... | |
ulong | ToData () |
Build a packet midi message from a MPTKEvent. Example: 0x00403C90 for a noton (90h, 3Ch note, 40h volume) More... | |
override string | ToString () |
Build a string description of the Midi event. V2.83 removes on each returns string More... | |
Static Public Member Functions | |
static string | MTPK_GetSynthParameterLabel (fluid_gen_type genType) |
[Pro] V2.88.2 Get the label for the generator. More... | |
static List< MPTKListItem > | MTPK_GetSynthParameterListGenerator () |
[Pro] V2.88.2 Get the list of modifiable generators. It's a list of MPTKListItem where the properties are: More... | |
Public Attributes | |
int | Channel |
Midi channel fom 0 to 15 (9 for drum) More... | |
MPTKCommand | Command |
Midi Command code. Defined the type of message. See MPTKCommand (Note On, Control Change, Patch Change...) More... | |
MPTKController | Controller |
Controller code. When the Command is ControlChange, contains the code fo the controller to change (Modulation, Pan, Bank Select ...). Value properties will contains the value of the controller. See MPTKController. More... | |
long | Delay |
Short delay before playing the note in millisecond. New with V2.82, works only in Core mode. Apply only on NoteOn event. More... | |
long | Duration |
Contains a value in relation with the Command. More... | |
GenModifier[] | GensModifier |
List of generators modifier associated to the voices being played. Null if any modifier defined. More... | |
int | IdSession |
Associate an Id with this event. When reading a Midi file with MidiFilePlayer: this Id is unique for all Midi events played for this Midi. Consequently, when switching Midi, MPTK_ClearAllSound is able to clear (note-off) only the voices associated with this Midi file. Switching between Midi playing is very quick. Could also be used for other prefab as MidiStreamPlayer for your specific need, but don't change this properties with MidiFilePlayer. More... | |
int | Index |
Event Index in the midi list (defined only when Midi events are read from a Midi stream) More... | |
string | Info |
Information hold by textual meta event when Command = MetaEvent More... | |
int | Length |
Duration of the note in Midi Tick. MidiFilePlayer.MPTK_NoteLength can be used to convert this duration. Not used for MidiStreamPlayer, length is set only when reading a Midi file. https://en.wikipedia.org/wiki/Note_value More... | |
MPTKMeta | Meta |
MetaEvent Code. When the Command is MetaEvent, contains the code of the meta event (Lyric, TimeSignature, ...). Others properties will contains the value of the meta. See MPTKMeta (TextEvent, Lyric, TimeSignature, ...). More... | |
float | RealTime |
V2.88 Real time in milliseconds of this event from the start of the midi depending the tempo change. More... | |
uint | Source |
Origin of the message. Midi ID if from Midi Input else zero. V2.83: rename source to Source et set public. More... | |
object | Tag |
V2.87 Tag information for application purpose More... | |
long | Tick |
Time in Midi Tick (part of a Beat) of the Event since the start of playing the midi file. This time is independent of the Tempo or Speed. Not used for MidiStreamPlayer. More... | |
long | TickTime |
V2.86 Time in System.DateTime when the Event is created or read from the Midi file. Not to be confused with Tick properties which is a position inside a Midi file. Sure, the name of this properties was a bad idea, could be renamed in a future version ;-) Can be read from a system thread. More... | |
long | Track |
Track index of the event in the midi. Track 0 is the first track 'MTrk' read from the midi file. More... | |
int | Value |
Contains a value in relation with the Command. More... | |
int | Velocity |
Velocity between 0 and 127. Used only if Command equal NoteOn. More... | |
List< fluid_voice > | Voices |
List of voices associated to this Event for playing a NoteOn event. More... | |
Properties | |
bool | IsOver [get] |
Check if playing of this midi event is over (all voices are OFF) More... | |
long | MPTK_DeltaTimeMillis [get] |
V2.86 Delta time in milliseconds since the creation of this event. Mainly useful to evaluate MPTK latency. Look for MidiSynth::StatSynthLatency, MidiSynth::StatSynthLatencyLAST, .... More... | |
long | MPTK_DeltaTimeTick [get] |
V2.86 Delta time in system ticks (calculated with DateTime.UtcNow.Ticks) since the creation of this event. Mainly useful to evaluate MPTK latency. One system ticks equal 100 nano second. look for MidiSynth::StatSynthLatency, MidiSynth::StatSynthLatencyLAST, .... More... | |
Midi Event class for MPTK. This class is more simple to use that the standard Midi structure.
The main property is Command, the content and role of other properties (as Value) depend on the value of Command. Look at the Value property.
With this class, you can: play and stop a note, change instrument (preset, patch, ...), change some control as modulation (Pro) ...
Use this class in relation with these classes:
MidiStreamPlayer
generate Midi Music from your own algorithm. MidiFileLoader
to read Midi events from a Midi file. MidiFilePlayer
process Midi events, thank to the class event OnEventNotesMidi when Midi events are played from the internal Midi sequencer.
|
strong |
Note length as https://en.wikipedia.org/wiki/Note_value
MidiPlayerTK.MPTKEvent.MPTKEvent | ( | ulong | data | ) |
Create a MPTK Midi event from a midi input message
data |
void MidiPlayerTK.MPTKEvent.MTPK_ClearSynthParameter | ( | ) |
[Pro] V2.88.2 Reset synth parameter to default soundfont value.
float MidiPlayerTK.MPTKEvent.MTPK_GetSynthParameterDefaultValue | ( | fluid_gen_type | genType | ) |
[Pro] V2.88.2 Get the default soundfont value for the generator.
Each generator has a specific range of value, see generators list here.
Also the value returned by this method is normalized (value between 0 and 1).
genType | see MTPK_ModifySynthParameter |
|
static |
[Pro] V2.88.2 Get the label for the generator.
genType | see MTPK_ModifySynthParameter |
|
static |
[Pro] V2.88.2 Get the list of modifiable generators.
It's a list of MPTKListItem where the properties are:
MPTKListItem::Index
: generator Id MPTKListItem::Label
: texte associated to the generator MPTKListItem::Position
: position in the list from 0genType | see MTPK_ModifySynthParameter |
bool MidiPlayerTK.MPTKEvent.MTPK_ModifySynthParameter | ( | fluid_gen_type | genType, |
float | value, | ||
MPTKModeGeneratorChange | mode | ||
) |
[Pro] Apply modification on default SoundFont generator value. Can be applied independently for each notes,
can be applied before the note is played and in real time when the note is playing.
Each generator has a specific range of value, see generators list here.
Also the value used by this method is normalized (value between 0 and 1). See here for more details.
genType | Type of generator to modify. Not all generators are authorized to real time modification.
|
value | Normalized value for the generator between 0 and 1. See here real value for each parameters.
|
mode | Define how to apply the value
|
ulong MidiPlayerTK.MPTKEvent.ToData | ( | ) |
Build a packet midi message from a MPTKEvent. Example: 0x00403C90 for a noton (90h, 3Ch note, 40h volume)
override string MidiPlayerTK.MPTKEvent.ToString | ( | ) |
Build a string description of the Midi event. V2.83 removes
on each returns string
int MidiPlayerTK.MPTKEvent.Channel |
Midi channel fom 0 to 15 (9 for drum)
MPTKCommand MidiPlayerTK.MPTKEvent.Command |
Midi Command code. Defined the type of message. See MPTKCommand (Note On, Control Change, Patch Change...)
MPTKController MidiPlayerTK.MPTKEvent.Controller |
Controller code. When the Command is ControlChange, contains the code fo the controller to change (Modulation, Pan, Bank Select ...).
Value properties will contains the value of the controller. See MPTKController.
long MidiPlayerTK.MPTKEvent.Delay |
Short delay before playing the note in millisecond. New with V2.82, works only in Core mode.
Apply only on NoteOn event.
long MidiPlayerTK.MPTKEvent.Duration |
Contains a value in relation with the Command.
GenModifier [] MidiPlayerTK.MPTKEvent.GensModifier |
List of generators modifier associated to the voices being played. Null if any modifier defined.
int MidiPlayerTK.MPTKEvent.IdSession |
Associate an Id with this event.
When reading a Midi file with MidiFilePlayer: this Id is unique for all Midi events played for this Midi.
Consequently, when switching Midi, MPTK_ClearAllSound is able to clear (note-off) only the voices associated with this Midi file.
Switching between Midi playing is very quick.
Could also be used for other prefab as MidiStreamPlayer for your specific need, but don't change this properties with MidiFilePlayer.
int MidiPlayerTK.MPTKEvent.Index |
Event Index in the midi list (defined only when Midi events are read from a Midi stream)
string MidiPlayerTK.MPTKEvent.Info |
Information hold by textual meta event when Command = MetaEvent
int MidiPlayerTK.MPTKEvent.Length |
Duration of the note in Midi Tick. MidiFilePlayer.MPTK_NoteLength can be used to convert this duration.
Not used for MidiStreamPlayer, length is set only when reading a Midi file. https://en.wikipedia.org/wiki/Note_value
MPTKMeta MidiPlayerTK.MPTKEvent.Meta |
float MidiPlayerTK.MPTKEvent.RealTime |
V2.88 Real time in milliseconds of this event from the start of the midi depending the tempo change.
uint MidiPlayerTK.MPTKEvent.Source |
Origin of the message. Midi ID if from Midi Input else zero. V2.83: rename source to Source et set public.
object MidiPlayerTK.MPTKEvent.Tag |
V2.87 Tag information for application purpose
long MidiPlayerTK.MPTKEvent.Tick |
Time in Midi Tick (part of a Beat) of the Event since the start of playing the midi file. This time is independent of the Tempo or Speed. Not used for MidiStreamPlayer.
long MidiPlayerTK.MPTKEvent.TickTime |
V2.86 Time in System.DateTime when the Event is created or read from the Midi file.
Not to be confused with Tick properties which is a position inside a Midi file. Sure, the name of this properties was a bad idea, could be renamed in a future version ;-) Can be read from a system thread.
long MidiPlayerTK.MPTKEvent.Track |
Track index of the event in the midi. Track 0 is the first track 'MTrk' read from the midi file.
int MidiPlayerTK.MPTKEvent.Value |
Contains a value in relation with the Command.
int MidiPlayerTK.MPTKEvent.Velocity |
Velocity between 0 and 127. Used only if Command equal NoteOn.
List<fluid_voice> MidiPlayerTK.MPTKEvent.Voices |
List of voices associated to this Event for playing a NoteOn event.
|
get |
Check if playing of this midi event is over (all voices are OFF)
|
get |
V2.86 Delta time in milliseconds since the creation of this event. Mainly useful to evaluate MPTK latency.
Look for MidiSynth::StatSynthLatency, MidiSynth::StatSynthLatencyLAST, ....
|
get |
V2.86 Delta time in system ticks (calculated with DateTime.UtcNow.Ticks) since the creation of this event.
Mainly useful to evaluate MPTK latency. One system ticks equal 100 nano second.
look for MidiSynth::StatSynthLatency, MidiSynth::StatSynthLatencyLAST, ....