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
tickCacheAndroid

Types​

alphaTab.midi.MidiTickLookupJavaScript
AlphaTab.Midi.MidiTickLookup.net
alphaTab.midi.MidiTickLookupAndroid

MidiTickLookup.findBeat Signatures​

TypeValues
findBeat(trackLookup: Set<number>, tick: number, currentBeatHint: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResult | nullJavaScript

Find the beat played at a given midi tick.

MidiTickLookupFindBeatResult? FindBeat(AlphaTab.Core.EcmaScript.Set<double> trackLookup, double tick, AlphaTab.Midi.MidiTickLookupFindBeatResult? currentBeatHint = null).net

Find the beat played at a given midi tick.

MidiTickLookupFindBeatResult? findBeat(trackLookup: alphaTab.core.ecmaScript.Set<Double>, tick: Double, currentBeatHint: alphaTab.midi.MidiTickLookupFindBeatResult? = null)Android

Find the beat played at a given midi tick.

MidiTickLookup.findBeat Parameters​

ParametersTypeSummary
trackLookupJavaScriptSet<number>

The tracks indices in which to search the played beat for.

trackLookup.netAlphaTab.Core.EcmaScript.Set<double>

The tracks indices in which to search the played beat for.

trackLookupAndroidalphaTab.core.ecmaScript.Set<Double>

The tracks indices in which to search the played beat for.

tickJavaScriptdouble

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).

currentBeatHintAndroidalphaTab.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​

const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
const lookupResult = api.tickCache.findBeat(new Set([0, 1]), 100);
const currentBeat = lookupResult?.currentBeat;