Contains information about the tempo change.
More...
|
| MPTKTempo (int index, long fromTick=0, long toTick=long.MaxValue, double fromTime=0d, double pulse=0d, int microsecondsPerQuarterNote=0) |
| Create a tempo segment with default value More...
|
|
double | MPTK_CalculateTime (long tick) |
|
override string | ToString () |
|
Contains information about the tempo change.
- Version
- Maestro 2.9.0
- Note
- The tempo map is automaticalled build when a MIDI file is loaded from the MIDI DB, from an external MIDI or from a MIDI Writer instance.
- The tempo map must be run by script on your MIDI events when created with MidiFileWriter2 with:
#MPTK_CalculateTempoMap
- Each segments defined the tick start/end and the start real time of the segment and the pulse (duration in millisecond of a MIDI tick) wich is constant all along the segment.
◆ MPTKTempo()
MidiPlayerTK.MPTKTempo.MPTKTempo |
( |
int |
index, |
|
|
long |
fromTick = 0 , |
|
|
long |
toTick = long.MaxValue , |
|
|
double |
fromTime = 0d , |
|
|
double |
pulse = 0d , |
|
|
int |
microsecondsPerQuarterNote = 0 |
|
) |
| |
Create a tempo segment with default value
- Parameters
-
index | |
fromTick | default 0 |
toTick | default ong.MaxValue |
fromTime | default 0 |
pulse | default 0 |
microsecondsPerQuarterNote | default 0 |
◆ MPTK_CalculateMap()
static void MidiPlayerTK.MPTKTempo.MPTK_CalculateMap |
( |
int |
deltaTicksPerQuarterNote, |
|
|
List< MPTKEvent > |
mptkEvents, |
|
|
List< MPTKTempo > |
temposMap |
|
) |
| |
|
static |
Create a tempo map from a MIDI events list with tempo change.
An allocated tempo map must be defined in parameter but the content will be cleared.
- Note
- A default tempo segment will be added at tick 0 with BPM = 120
- Version
- 2.10.0
mfw.MPTK_StableSortEvents();
mfw.MPTK_CalculateTiming(logDebug: true, logPerf: true);
mfw.MPTK_Debug();
- Parameters
-
deltaTicksPerQuarterNote | |
mptkEvents | |
temposMap | |
◆ MPTK_CalculateTime()
double MidiPlayerTK.MPTKTempo.MPTK_CalculateTime |
( |
long |
tick | ) |
|
Realtime in milliseconds for this tick in this segment
- Parameters
-
- Returns
◆ MPTK_FindSegment() [1/2]
static int MidiPlayerTK.MPTKTempo.MPTK_FindSegment |
( |
List< MPTKTempo > |
tempoMap, |
|
|
float |
timeSearch, |
|
|
int |
fromIndex = 0 |
|
) |
| |
|
static |
Find a tempo change from a time position in millisecond in the tempo map.
- Parameters
-
tempoMap | List of tempo map build with MPTK_CalculateTempoMap |
timeSearch | search from this time in millisecond |
fromIndex | search from this index position in the list (for optimazation) |
- Returns
- index of the segment
◆ MPTK_FindSegment() [2/2]
static int MidiPlayerTK.MPTKTempo.MPTK_FindSegment |
( |
List< MPTKTempo > |
tempoMap, |
|
|
long |
tickSearch, |
|
|
int |
fromIndex = 0 |
|
) |
| |
|
static |
Find a tempo change from a tick position in the tempo map.
- Parameters
-
tempoMap | List of tempo map build with MPTK_CalculateTempoMap |
tickSearch | search from this tick value |
fromIndex | search from this index position in the list (for optimazation) |
- Returns
- index of the segment
◆ ToString()
override string MidiPlayerTK.MPTKTempo.ToString |
( |
| ) |
|
String description of this segment
- Returns
◆ DeltaTicksPerQuarterNote
int MidiPlayerTK.MPTKTempo.DeltaTicksPerQuarterNote |
|
static |
This information is mandatory to calculate start/end measure and beat.
◆ FromTick
long MidiPlayerTK.MPTKTempo.FromTick |
Tick start of this segment
◆ FromTime
double MidiPlayerTK.MPTKTempo.FromTime |
Exact time in milliseconds to reach this tempo or signature change
◆ Index
int MidiPlayerTK.MPTKTempo.Index |
Index of this segment if added to a list of tempo map with #MPTK_CalculateTempoMap
◆ MicrosecondsPerQuarterNote
int MidiPlayerTK.MPTKTempo.MicrosecondsPerQuarterNote |
BPM = 60000000 / MicrosecondsPerQuarterNote
◆ Pulse
double MidiPlayerTK.MPTKTempo.Pulse |
Duration in millisecond of a MIDI tick in this segment. The pulse length is the minimum time in millisecond between two MIDI events.
- Note
- Depends on the current tempo, the #MPTK_DeltaTicksPerQuarterNote (but not the Speed).
- Formula: Pulse = (60000000 / MPTK_CurrentTempo) / MPTK_DeltaTicksPerQuarterNote / 1000
◆ ToTick
long MidiPlayerTK.MPTKTempo.ToTick |