| 160 | * @public |
| 161 | */ |
| 162 | export class AlphaTabApiBase<TSettings> { |
| 163 | private _startTime: number = 0; |
| 164 | private _trackIndexes: number[] | null = null; |
| 165 | private _trackIndexLookup: Set<number> | null = null; |
| 166 | private readonly _beatVisibilityChecker = new BoundsLookupVisibilityChecker(); |
| 167 | private _isDestroyed: boolean = false; |
| 168 | private _score: Score | null = null; |
| 169 | private _tracks: Track[] = []; |
| 170 | private _actualPlayerMode: PlayerMode = PlayerMode.Disabled; |
| 171 | private _player!: AlphaSynthWrapper; |
| 172 | private _renderer: ScoreRendererWrapper; |
| 173 | |
| 174 | private _defaultScrollHandler?: IScrollHandler; |
| 175 | private _defaultCursorHandler?: ICursorHandler; |
| 176 | private _customCursorHandler?: ICursorHandler; |
| 177 | |
| 178 | /** |
| 179 | * An indicator by how many midi-ticks the song contents are shifted. |
| 180 | * Grace beats at start might require a shift for the first beat to start at 0. |
| 181 | * This information can be used to translate back the player time axis to the music notation. |
| 182 | */ |
| 183 | public get midiTickShift() { |
| 184 | return this._player.midiTickShift; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * The actual player mode which is currently active. |
| 189 | * @remarks |
| 190 | * Allows determining whether a backing track or the synthesizer is active in case automatic detection is enabled. |
| 191 | * @category Properties - Player |
| 192 | * @since 1.6.0 |
| 193 | */ |
| 194 | public get actualPlayerMode(): PlayerMode { |
| 195 | return this._actualPlayerMode; |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * The UI facade used for interacting with the user interface (like the browser). |
| 200 | * @remarks |
| 201 | * The implementation depends on the platform alphaTab is running in (e.g. the web version in the browser, WPF in .net etc.) |
| 202 | * @category Properties - Core |
| 203 | * @since 0.9.4 |
| 204 | */ |
| 205 | public readonly uiFacade: IUiFacade<TSettings>; |
| 206 | |
| 207 | /** |
| 208 | * The UI container that holds the whole alphaTab control. |
| 209 | * @remarks |
| 210 | * Gets the UI container that represents the element on which alphaTab was initialized. Note that this is not the raw instance, but a UI framework specific wrapper for alphaTab. |
| 211 | * @category Properties - Core |
| 212 | * @since 0.9.4 |
| 213 | * @example |
| 214 | * JavaScript |
| 215 | * ```js |
| 216 | * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab')); |
| 217 | * const container = api.container; |
| 218 | * ``` |
| 219 | * |