Skip to main content

tickCache

since 1.2.3

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​

TypeValues
MidiTickLookupFindBeatResult FindBeat(IList<Track> tracks, int tick, MidiTickLookupFindBeatResult? currentBeatHint = null).netFind the beat played at a given midi tick.
findBeat(tracks: Track[], tick: number, currentBeatHint: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResultJavaScriptFind the beat played at a given midi tick.

MidiTickLookup.findBeat Parameters​

ParametersTypeSummary
tracksJavaScriptalphaTab.model.Track[]

The tracks which should be looked at to find the beat. This allows a filtered search if needed.

tracks.netIList<AlphaTab.Model.Track>

The tracks which should be looked at to find the beat. This allows a filtered search if needed.

tickJavaScriptint

The midi tick for which the beat should be looked up.

tick.netnumber

The midi tick for which the beat should be looked up.

currentBeatHintJavaScriptAlphaTab.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.netalphaTab.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;
Not available
var api = new AlphaTabApi<MyControl>(...);
var lookupResult = api.TickCache.FindBeat(api.Tracks, 100);
var currentBeat = lookupResult?.CurrentBeat;