alphaTab.midi.MidiTickLookup
This class holds all information about when MasterBar s and Beat s are played.
On top level it is organized into MasterBarTickLookup objects indicating the
master bar start and end times. This information is used to highlight the currently played bars
and it gives access to the played beats in this masterbar and their times.
The BeatTickLookup are then the slices into which the masterbar is separated by the voices and beats
of all tracks. An example how things are organized:
Time (eighths): | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
Track 1: | B1 | B2 | B3 | B4 | B5 | B6 | Track 2: | B7 | B7 | B9 | B10| B11| B12| Track 3: | B13 |
Lookup: | L1 | L2 | L3 | L4 | L5 | L6 | L7 | L8 | Active Beats:
- L1 B1,B7,B13
- L2 B2,B7,B13
- L3 B3,B7,B13
- L4 B4,B7,B13
- L5 B5,B9,B13
- L6 B5,B10,B13
- L7 B6,B11,B13
- L8 B6,B12,B13
Then during playback we build out of this list MidiTickLookupFindBeatResult objects which are sepcific
to the visible tracks displayed. This is required because if only Track 2 is displayed we cannot use the the
Lookup L1 alone to determine the start and end of the beat cursor. In this case we will derive a
MidiTickLookupFindBeatResult which holds for Time 01 the lookup L1 as start and L3 as end. This will be used
both for the cursor and beat highlighting.
class MidiTickLookupProperties​
masterBars​
A list of all MasterBarTickLookup sorted by time.
- JavaScript
- C#
- Kotlin
readonly masterBars: MasterBarTickLookup[];IList<MasterBarTickLookup> MasterBars { get; }val masterBars: alphaTab.collections.List<MasterBarTickLookup>multiBarRestInfo​
The information about which bars are displayed via multi-bar rests. The key is the start bar, and the value is the additional bars in sequential order. This info allows building the correct "next" beat and duration.
- JavaScript
- C#
- Kotlin
multiBarRestInfo: Map<number, number[]> | null;Map<double, IList<double>>? MultiBarRestInfo { get; set; }var multiBarRestInfo: alphaTab.collections.DoubleObjectMap<Double, alphaTab.collections.DoubleList>?Methods​
addBeat​
(no description)
| Parameter | Summary |
|---|---|
beatAll | (no description) |
startAll | (no description) |
durationAll | (no description) |
addMasterBar​
Adds a new MasterBarTickLookup to the lookup table.
- JavaScript
- C#
- Kotlin
addMasterBar(masterBar: MasterBarTickLookup): voidvoid AddMasterBar(MasterBarTickLookup masterBar)fun addMasterBar(masterBar: MasterBarTickLookup): Unit| Parameter | Summary |
|---|---|
masterBarAll | The item to add. |
findBeat​
Finds the currently played beat given a list of tracks and the current time.
- JavaScript
- C#
- Kotlin
findBeat(trackLookup: Set<number>, tick: number, currentBeatHint?: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResult | nullMidiTickLookupFindBeatResult? FindBeat(Set<double> trackLookup, double tick, MidiTickLookupFindBeatResult? currentBeatHint)fun findBeat(trackLookup: Set<Double>, tick: Double, currentBeatHint: MidiTickLookupFindBeatResult?): MidiTickLookupFindBeatResult?| Parameter | Summary |
|---|---|
trackLookupAll | The tracks indices in which to search the played beat for. |
tickAll | The current time in midi ticks. |
currentBeatHintAll | Used for optimized lookup during playback. By passing in a previous result lookup of the next one can be optimized using heuristics. (optional). |
Returns​
The information about the current beat or null if no beat could be found.
findBeatWithChecker​
Finds the currently played beat given a list of tracks and the current time.
- JavaScript
- C#
- Kotlin
findBeatWithChecker(checker: IBeatVisibilityChecker, tick: number, currentBeatHint?: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResult | nullMidiTickLookupFindBeatResult? FindBeatWithChecker(IBeatVisibilityChecker checker, double tick, MidiTickLookupFindBeatResult? currentBeatHint)fun findBeatWithChecker(checker: IBeatVisibilityChecker, tick: Double, currentBeatHint: MidiTickLookupFindBeatResult?): MidiTickLookupFindBeatResult?| Parameter | Summary |
|---|---|
checkerAll | The checker to ask whether a beat is visible and should be considered for result. |
tickAll | The current time in midi ticks. |
currentBeatHintAll | Used for optimized lookup during playback. By passing in a previous result lookup of the next one can be optimized using heuristics. (optional). |
Returns​
The information about the current beat or null if no beat could be found.
getBeatStart​
Gets the start time in midi ticks for a given beat at which the masterbar is played the first time.
| Parameter | Summary |
|---|---|
beatAll | The beat to find the time period for. |
Returns​
The time in midi ticks at which the beat is played the first time or 0 if the beat is not contained
getMasterBar​
Gets the MasterBarTickLookup for a given masterbar at which the masterbar is played the first time.
- JavaScript
- C#
- Kotlin
getMasterBar(bar: MasterBar): MasterBarTickLookupMasterBarTickLookup GetMasterBar(MasterBar bar)fun getMasterBar(bar: MasterBar): MasterBarTickLookup| Parameter | Summary |
|---|---|
barAll | The masterbar to find the time period for. |
Returns​
A MasterBarTickLookup containing the details about the first time the MasterBar is played.
getMasterBarStart​
Gets the start time in midi ticks for a given masterbar at which the masterbar is played the first time.
| Parameter | Summary |
|---|---|
barAll | The masterbar to find the time period for. |
Returns​
The time in midi ticks at which the masterbar is played the first time or 0 if the masterbar is not contained