tickCache
Description​
Gets the tick cache allowing lookup of midi ticks to beats. If the player is enabled, a midi file will be generated
for the loaded alphaTab.model.Score
for later playback. During this generation this tick cache is filled with the
exact midi ticks when beats are played.
The MidiTickLookup.findBeat
method allows a lookup of the beat related to a given input midi tick.
tickCacheJavaScript |
alphaTab('tickCache')jQuery |
TickCache.net |
Types​
AlphaTab.Midi.MidiTickLookup.net |
alphaTab.midi.MidiTickLookupJavaScript |
MidiTickLookup.findBeat Signatures​
Type | Values |
---|---|
MidiTickLookupFindBeatResult FindBeat(IList<Track> tracks, int tick, MidiTickLookupFindBeatResult? currentBeatHint = null).net | Find the beat played at a given midi tick. |
findBeat(tracks: Track[], tick: number, currentBeatHint: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResultJavaScript | Find the beat played at a given midi tick. |
MidiTickLookup.findBeat Parameters​
Parameters | Type | Summary |
---|---|---|
tracksJavaScript | alphaTab.model.Track[] | The tracks which should be looked at to find the beat. This allows a filtered search if needed. |
tracks.net | IList<AlphaTab.Model.Track> | The tracks which should be looked at to find the beat. This allows a filtered search if needed. |
tickJavaScript | int | The midi tick for which the beat should be looked up. |
tick.net | number | The midi tick for which the beat should be looked up. |
currentBeatHintJavaScript | AlphaTab.Midi.MidiTickLookupFindBeatResult | Used for optimized lookup during playback. By passing in a previous result lookup of the next one can be optimized using heuristics. (optional). |
currentBeatHint.net | alphaTab.midi.MidiTickLookupFindBeatResult | Used for optimized lookup during playback. By passing in a previous result lookup of the next one can be optimized using heuristics. (optional). |
Examples​
var api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
var lookupResult = api.tickCache.findBeat(api.tracks, 100);
var currentBeat = lookupResult?.currentBeat;
var api = new AlphaTabApi<MyControl>(...);
var lookupResult = api.TickCache.FindBeat(api.Tracks, 100);
var currentBeat = lookupResult?.CurrentBeat;