alphaTab.platform.IUiFacade
This interface represents the UI abstraction between alphaTab and the corresponding UI framework being used.
interface IUiFacade<TSettings>Properties​
areWorkersSupported​
Gets a value indicating whether the UI framework supports worker based rendering.
- JavaScript
- C#
- Kotlin
readonly areWorkersSupported: boolean;bool AreWorkersSupported { get; }val areWorkersSupported: BooleancanRender​
Gets or sets whether the UI is ready to render the music notation. On some platforms where pre-loading of assets is done asynchronously, rendering might need to be deferred.
- JavaScript
- C#
- Kotlin
readonly canRender: boolean;bool CanRender { get; }val canRender: BooleancanRenderChanged​
This events is fired when the canRender property changes.
- JavaScript
- C#
- Kotlin
readonly canRenderChanged: IEventEmitter;IEventEmitter CanRenderChanged { get; }val canRenderChanged: IEventEmitterresizeThrottle​
Gets the resize throttling in milliseconds. Then the music sheet is resized, the re-rendering is deferred until this timeout is reached.
- JavaScript
- C#
- Kotlin
readonly resizeThrottle: number;double ResizeThrottle { get; }val resizeThrottle: DoublerootContainer​
Gets the root UI element that holds the whole alphaTab control.
- JavaScript
- C#
- Kotlin
rootContainerBecameVisible​
This event is fired when rootContainer became visible when it was invisible at the time rendering was initiated.
- JavaScript
- C#
- Kotlin
readonly rootContainerBecameVisible: IEventEmitter;IEventEmitter RootContainerBecameVisible { get; }val rootContainerBecameVisible: IEventEmitterMethods​
beginAppendRenderResults​
Tells the UI layer to append the given render results to the UI. At this point the partial result is not actually rendered yet, only the layouting process completed.
- JavaScript
- C#
- Kotlin
beginAppendRenderResults(renderResults: RenderFinishedEventArgs | null): voidvoid BeginAppendRenderResults(RenderFinishedEventArgs? renderResults)fun beginAppendRenderResults(renderResults: RenderFinishedEventArgs?): Unit| Parameter | Summary |
|---|---|
renderResultsAll | The rendered partial that should be added to the UI. null indicates the rendering finished. |
beginInvoke​
Tells the UI layer to invoke the given action.
- JavaScript
- C#
- Kotlin
beginInvoke(action: () => void): voidvoid BeginInvoke(() => void action)fun beginInvoke(action: () => void): Unit| Parameter | Summary |
|---|---|
actionAll | (no description) |
beginUpdateRenderResults​
Tells the UI layer to update the given render results within the UI.
- JavaScript
- C#
- Kotlin
beginUpdateRenderResults(renderResults: RenderFinishedEventArgs): voidvoid BeginUpdateRenderResults(RenderFinishedEventArgs renderResults)fun beginUpdateRenderResults(renderResults: RenderFinishedEventArgs): Unit| Parameter | Summary |
|---|---|
renderResultsAll | The rendered partial that should be updated within the UI. |
createBackingTrackPlayer​
Tells the UI layer to create a player which can play backing tracks.
- JavaScript
- C#
- Kotlin
createBackingTrackPlayer(): IAlphaSynth | nullIAlphaSynth? CreateBackingTrackPlayer()fun createBackingTrackPlayer(): IAlphaSynth?createCanvasElement​
Creates the canvas element that wraps all individually rendered partials.
- JavaScript
- C#
- Kotlin
createCanvasElement(): IContainerIContainer CreateCanvasElement()fun createCanvasElement(): IContainerReturns​
The canvas element that wraps all individually rendered partials.
createCursors​
Creates the cursor objects that are used to highlight the currently played beats and bars.
createSelectionElement​
Creates a new UI element that is used to display the selection rectangle.
- JavaScript
- C#
- Kotlin
createSelectionElement(): IContainer | nullIContainer? CreateSelectionElement()fun createSelectionElement(): IContainer?createWorkerAudioExporter​
Tells the UI layer to create a new audio exporter.
- JavaScript
- C#
- Kotlin
createWorkerAudioExporter(synth: IAlphaSynth | null): IAudioExporterWorkerIAudioExporterWorker CreateWorkerAudioExporter(IAlphaSynth? synth)fun createWorkerAudioExporter(synth: IAlphaSynth?): IAudioExporterWorker| Parameter | Summary |
|---|---|
synthAll | The currently active alphaSynth that might be used for synthesizing.
If the provided synthesizer is already an active player worker (created via |
createWorkerPlayer​
Tells the UI layer to create a player worker for the synthesizer.
- JavaScript
- C#
- Kotlin
createWorkerPlayer(): IAlphaSynth | nullIAlphaSynth? CreateWorkerPlayer()fun createWorkerPlayer(): IAlphaSynth?createWorkerRenderer​
Tells the UI layer to create the worker renderer. This method is the UI layer supports worker rendering and worker rendering is not disabled via setting.
- JavaScript
- C#
- Kotlin
createWorkerRenderer(): IScoreRendererIScoreRenderer CreateWorkerRenderer()fun createWorkerRenderer(): IScoreRendererdestroy​
Tells the UI layer to destroy the alphaTab controls and restore the initial state.
- JavaScript
- C#
- Kotlin
destroy(): voidvoid Destroy()fun destroy(): UnitdestroyCursors​
Destroys the cursor objects that are used to highlight the currently played beats and bars.
- JavaScript
- C#
- Kotlin
destroyCursors(): voidvoid DestroyCursors()fun destroyCursors(): UnitgetOffset​
Calculates the relative offset of a container to the scroll element.
- JavaScript
- C#
- Kotlin
getOffset(scrollElement: IContainer | null, container: IContainer): BoundsBounds GetOffset(IContainer? scrollElement, IContainer container)fun getOffset(scrollElement: IContainer?, container: IContainer): Bounds| Parameter | Summary |
|---|---|
scrollElementAll | The parent scroll element to which the relative position is computed. |
containerAll | The container element for which the relative position is calculated. |
getScrollContainer​
Gets the UI element that is used for scrolling during playback.
- JavaScript
- C#
- Kotlin
highlightElements​
Tells the UI layer to highlight the music notation elements with the given ID.
- JavaScript
- C#
- Kotlin
highlightElements(groupId: string, masterBarIndex: number): voidvoid HighlightElements(string groupId, double masterBarIndex)fun highlightElements(groupId: String, masterBarIndex: Double): Unit| Parameter | Summary |
|---|---|
groupIdAll | The group id that identifies the elements to be highlighted. |
masterBarIndexAll | The index of the related masterbar of the highlighted group. |
initialize​
Initializes the UI using the given alphaTab API and settings object.
- JavaScript
- C#
- Kotlin
initialize(api: AlphaTabApiBase<TSettings>, settings: TSettings): voidvoid Initialize(AlphaTabApiBase<TSettings> api, TSettings settings)fun initialize(api: AlphaTabApiBase<TSettings>, settings: TSettings): Unit| Parameter | Summary |
|---|---|
apiAll | The alphaTab API wrapper responsible for UI interaction. |
settingsAll | The settings object holding the settings from the UI layer. |
initialRender​
Tells the UI layer to do the initial rendering.
- JavaScript
- C#
- Kotlin
initialRender(): voidvoid InitialRender()fun initialRender(): Unitload​
Attempts a load of the score represented by the given data object.
- JavaScript
- C#
- Kotlin
load(data: unknown, success: (score: Score) => void, error: (error: Error) => void): booleanbool Load(object data, (score: Score) => void success, (error: Error) => void error)fun load(data: Any, success: (score: Score) => void, error: (error: Error) => void): Boolean| Parameter | Summary |
|---|---|
dataAll | The data object to decode |
successAll | The action to call if the score was loaded |
errorAll | The action to call if any error during loading ocurred. |
Returns​
true if the data object is supported and a load was initiated, otherwise false
loadSoundFont​
Attempts a load of the score represented by the given data object.
- JavaScript
- C#
- Kotlin
loadSoundFont(data: unknown, append: boolean): booleanbool LoadSoundFont(object data, bool append)fun loadSoundFont(data: Any, append: Boolean): Boolean| Parameter | Summary |
|---|---|
dataAll | The data object to decode |
appendAll | Whether to fully replace or append the data from the given soundfont. |
Returns​
true if the data object is supported and a load was initiated, otherwise false
removeHighlights​
Tells the UI layer to remove all highlights from highlighted music notation elements.
- JavaScript
- C#
- Kotlin
removeHighlights(): voidvoid RemoveHighlights()fun removeHighlights(): UnitscrollToX​
Initiates a horizontal scroll on the given element.
- JavaScript
- C#
- Kotlin
scrollToX(scrollElement: IContainer, offset: number, speed: number): voidvoid ScrollToX(IContainer scrollElement, double offset, double speed)fun scrollToX(scrollElement: IContainer, offset: Double, speed: Double): Unit| Parameter | Summary |
|---|---|
scrollElementAll | The element on which the scrolling should happen. |
offsetAll | The absolute scroll offset to which scrolling should happen. |
speedAll | How fast the scrolling from the current offset to the given one should happen in milliseconds. |
scrollToY​
Initiates a vertical scroll on the given element.
- JavaScript
- C#
- Kotlin
scrollToY(scrollElement: IContainer, offset: number, speed: number): voidvoid ScrollToY(IContainer scrollElement, double offset, double speed)fun scrollToY(scrollElement: IContainer, offset: Double, speed: Double): Unit| Parameter | Summary |
|---|---|
scrollElementAll | The element on which the scrolling should happen. |
offsetAll | The absolute scroll offset to which scrolling should happen. |
speedAll | How fast the scrolling from the current offset to the given one should happen in milliseconds. |
setCanvasOverflow​
Updates the overflows needed to ensure the smooth scrolling can reach the "end" at the desired position. Without these overflows we might not have enough scroll space and we cannot reach a "sticky cursor" behavior.
- JavaScript
- C#
- Kotlin
setCanvasOverflow(canvasElement: IContainer, overflow: number, isVertical: boolean): voidvoid SetCanvasOverflow(IContainer canvasElement, double overflow, bool isVertical)fun setCanvasOverflow(canvasElement: IContainer, overflow: Double, isVertical: Boolean): Unit| Parameter | Summary |
|---|---|
canvasElementAll | The canvas element. |
overflowAll | (no description) |
isVerticalAll | Whether we have a vertical or horizontal overflow |
stopScrolling​
Stops any ongoing scrolling of the given element.
- JavaScript
- C#
- Kotlin
stopScrolling(scrollElement: IContainer): voidvoid StopScrolling(IContainer scrollElement)fun stopScrolling(scrollElement: IContainer): Unit| Parameter | Summary |
|---|---|
scrollElementAll | The element which might be scrolling dynamically. |
triggerEvent​
Tells the UI layer to trigger an event with the given name and details.
- JavaScript
- C#
- Kotlin
triggerEvent(container: IContainer, eventName: string, details: unknown, originalEvent?: IMouseEventArgs): voidvoid TriggerEvent(IContainer container, string eventName, object details, IMouseEventArgs? originalEvent)fun triggerEvent(container: IContainer, eventName: String, details: Any, originalEvent: IMouseEventArgs?): Unit| Parameter | Summary |
|---|---|
containerAll | The element on which the event should be triggered. |
eventNameAll | The event that should be triggered. |
detailsAll | The object holding the details about the event. |
originalEventAll | The original event related to this custom event. |