@coderline/alphatab 1.8.0-alpha.1647 → 1.8.0-alpha.1651
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alphaTab.core.min.mjs +2 -2
- package/dist/alphaTab.core.mjs +940 -270
- package/dist/alphaTab.d.ts +147 -4
- package/dist/alphaTab.js +940 -270
- package/dist/alphaTab.min.js +2 -2
- package/dist/alphaTab.min.mjs +1 -1
- package/dist/alphaTab.mjs +1 -1
- package/dist/alphaTab.worker.min.mjs +1 -1
- package/dist/alphaTab.worker.mjs +1 -1
- package/dist/alphaTab.worklet.min.mjs +1 -1
- package/dist/alphaTab.worklet.mjs +1 -1
- package/package.json +1 -1
package/dist/alphaTab.d.ts
CHANGED
|
@@ -357,12 +357,14 @@ export declare class AlphaTabApiBase<TSettings> {
|
|
|
357
357
|
private _startTime;
|
|
358
358
|
private _trackIndexes;
|
|
359
359
|
private _trackIndexLookup;
|
|
360
|
+
private readonly _beatVisibilityChecker;
|
|
360
361
|
private _isDestroyed;
|
|
361
362
|
private _score;
|
|
362
363
|
private _tracks;
|
|
363
364
|
private _actualPlayerMode;
|
|
364
365
|
private _player;
|
|
365
366
|
private _renderer;
|
|
367
|
+
private _defaultScrollHandler?;
|
|
366
368
|
/**
|
|
367
369
|
* An indicator by how many midi-ticks the song contents are shifted.
|
|
368
370
|
* Grace beats at start might require a shift for the first beat to start at 0.
|
|
@@ -835,6 +837,42 @@ export declare class AlphaTabApiBase<TSettings> {
|
|
|
835
837
|
*/
|
|
836
838
|
render(): void;
|
|
837
839
|
private _tickCache;
|
|
840
|
+
/**
|
|
841
|
+
* A custom scroll handler which will be used to handle scrolling operations during playback.
|
|
842
|
+
*
|
|
843
|
+
* @category Properties - Player
|
|
844
|
+
* @since 1.8.0
|
|
845
|
+
* @example
|
|
846
|
+
* JavaScript
|
|
847
|
+
* ```js
|
|
848
|
+
* const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
|
|
849
|
+
* api.customScrollHandler = {
|
|
850
|
+
* forceScrollTo(currentBeatBounds) {
|
|
851
|
+
* const scroll = api.uiFacade.getScrollElement();
|
|
852
|
+
* api.uiFacade.scrollToY(scroll, currentBeatBounds.barBounds.masterBarBounds.realBounds.y, 0);
|
|
853
|
+
* },
|
|
854
|
+
* onBeatCursorUpdating(startBeat, endBeat, cursorMode, relativePosition, actualBeatCursorStartX, actualBeatCursorEndX, actualBeatCursorTransitionDuration) {
|
|
855
|
+
* const scroll = api.uiFacade.getScrollElement();
|
|
856
|
+
* api.uiFacade.scrollToY(scroll, startBeat.barBounds.masterBarBounds.realBounds.y, 0);
|
|
857
|
+
* }
|
|
858
|
+
* }
|
|
859
|
+
* ```
|
|
860
|
+
*
|
|
861
|
+
* @example
|
|
862
|
+
* C#
|
|
863
|
+
* ```cs
|
|
864
|
+
* var api = new AlphaTabApi<MyControl>(...);
|
|
865
|
+
* api.CustomScrollHandler = new CustomScrollHandler();
|
|
866
|
+
* ```
|
|
867
|
+
*
|
|
868
|
+
* @example
|
|
869
|
+
* Android
|
|
870
|
+
* ```kotlin
|
|
871
|
+
* val api = AlphaTabApi<MyControl>(...)
|
|
872
|
+
* api.customScrollHandler = CustomScrollHandler();
|
|
873
|
+
* ```
|
|
874
|
+
*/
|
|
875
|
+
customScrollHandler?: IScrollHandler;
|
|
838
876
|
/**
|
|
839
877
|
* The tick cache allowing lookup of midi ticks to beats.
|
|
840
878
|
* @remarks
|
|
@@ -1642,9 +1680,12 @@ export declare class AlphaTabApiBase<TSettings> {
|
|
|
1642
1680
|
private _isInitialBeatCursorUpdate;
|
|
1643
1681
|
private _previousStateForCursor;
|
|
1644
1682
|
private _previousCursorCache;
|
|
1645
|
-
private _lastScroll;
|
|
1646
1683
|
private _destroyCursors;
|
|
1684
|
+
private _createCursors;
|
|
1647
1685
|
private _updateCursors;
|
|
1686
|
+
private _scrollHandlerMode;
|
|
1687
|
+
private _scrollHandlerVertical;
|
|
1688
|
+
private _updateScrollHandler;
|
|
1648
1689
|
/**
|
|
1649
1690
|
* updates the cursors to highlight the beat at the specified tick position
|
|
1650
1691
|
* @param tick
|
|
@@ -1662,7 +1703,6 @@ export declare class AlphaTabApiBase<TSettings> {
|
|
|
1662
1703
|
* @category Methods - Player
|
|
1663
1704
|
*/
|
|
1664
1705
|
scrollToCursor(): void;
|
|
1665
|
-
private _internalScrollToCursor;
|
|
1666
1706
|
private _internalCursorUpdateBeat;
|
|
1667
1707
|
/**
|
|
1668
1708
|
* This event is fired when the played beat changed.
|
|
@@ -5263,6 +5303,12 @@ declare class BeatTickLookup {
|
|
|
5263
5303
|
* @returns The first beat which is visible according to the given tracks or null.
|
|
5264
5304
|
*/
|
|
5265
5305
|
getVisibleBeatAtStart(visibleTracks: Set<number>): Beat | null;
|
|
5306
|
+
/**
|
|
5307
|
+
* Looks for the first visible beat which starts at this lookup so it can be used for cursor placement.
|
|
5308
|
+
* @param checker The custom checker to see if a beat is visible.
|
|
5309
|
+
* @returns The first beat which is visible according to the given tracks or null.
|
|
5310
|
+
*/
|
|
5311
|
+
getVisibleBeatAtStartWithChecker(checker: IBeatVisibilityChecker): Beat | null;
|
|
5266
5312
|
}
|
|
5267
5313
|
|
|
5268
5314
|
/**
|
|
@@ -9017,6 +9063,15 @@ declare interface IBackingTrackSynthOutput extends ISynthOutput {
|
|
|
9017
9063
|
loadBackingTrack(backingTrack: BackingTrack): void;
|
|
9018
9064
|
}
|
|
9019
9065
|
|
|
9066
|
+
/**
|
|
9067
|
+
* Classes implementing this interface can help in checking whether beats are currently being
|
|
9068
|
+
* displayed so that they can be considered for a tick-search.
|
|
9069
|
+
* @public
|
|
9070
|
+
*/
|
|
9071
|
+
declare interface IBeatVisibilityChecker {
|
|
9072
|
+
isVisible(beat: Beat): boolean;
|
|
9073
|
+
}
|
|
9074
|
+
|
|
9020
9075
|
/**
|
|
9021
9076
|
* This is the base public interface for canvas implementations on different plattforms.
|
|
9022
9077
|
* @public
|
|
@@ -9760,6 +9815,47 @@ declare interface IScoreRenderer {
|
|
|
9760
9815
|
readonly error: IEventEmitterOfT<Error>;
|
|
9761
9816
|
}
|
|
9762
9817
|
|
|
9818
|
+
/**
|
|
9819
|
+
* Classes implementing this interface can handle the scroll logic
|
|
9820
|
+
* as the playback in alphaTab progresses.
|
|
9821
|
+
*
|
|
9822
|
+
*
|
|
9823
|
+
* @public
|
|
9824
|
+
*/
|
|
9825
|
+
export declare interface IScrollHandler extends Disposable {
|
|
9826
|
+
/**
|
|
9827
|
+
* Requests a instant scrolling to the specified beat.
|
|
9828
|
+
* @param currentBeatBounds The bounds and information about the current beat.
|
|
9829
|
+
*/
|
|
9830
|
+
forceScrollTo(currentBeatBounds: BeatBounds): void;
|
|
9831
|
+
/**
|
|
9832
|
+
* Updates whenever the currently beat cursor is updating its start and end location
|
|
9833
|
+
* from which it starts and animates to.
|
|
9834
|
+
* @remarks
|
|
9835
|
+
* This method is tightly coupled to how alphaTab internally handles the beat cursor display.
|
|
9836
|
+
* alphaTab looks up the current and next beat to which the beat cursor needs to transition
|
|
9837
|
+
* in a specific amount of time.
|
|
9838
|
+
*
|
|
9839
|
+
* In some occations the cursor will transition to the end of the bar instead of the next beat.
|
|
9840
|
+
*
|
|
9841
|
+
* @param startBeat the information about the beat where the cursor is starting its animation.
|
|
9842
|
+
* @param endBeat the information about the beat where the cursor is ending its animation.
|
|
9843
|
+
* @param cursorMode how the cursor is transitioning (e.g. to end of bar or to the location of the next beat)
|
|
9844
|
+
* @param actualBeatCursorStartX the exact start position of the beat cursor animation.
|
|
9845
|
+
* Depending on the exact time of the player, this position might be relatively adjusted.
|
|
9846
|
+
* @param actualBeatCursorEndX the exact end position of the beat cursor animation.
|
|
9847
|
+
* Depending on the exact time of the player and cursor mode,
|
|
9848
|
+
* this might be beyond the expected bounds.
|
|
9849
|
+
* To ensure a smooth cursor experience (no jumping/flicking back and forth), alphaTab
|
|
9850
|
+
* optimizes the used end position and animation durations.
|
|
9851
|
+
* @param actualBeatCursorTransitionDuration The duration of the beat cursor transition in milliseconds.
|
|
9852
|
+
* Similar to the start and end positions, this duration is adjusted accordingly to ensure
|
|
9853
|
+
* that the beat cursor remains smoothly at the expected position for the currently played time.
|
|
9854
|
+
*
|
|
9855
|
+
*/
|
|
9856
|
+
onBeatCursorUpdating(startBeat: BeatBounds, endBeat: BeatBounds | undefined, cursorMode: MidiTickLookupFindBeatResultCursorMode, actualBeatCursorStartX: number, actualBeatCursorEndX: number, actualBeatCursorTransitionDuration: number): void;
|
|
9857
|
+
}
|
|
9858
|
+
|
|
9763
9859
|
/**
|
|
9764
9860
|
* This is the base interface for output devices which can
|
|
9765
9861
|
* request and playback audio samples.
|
|
@@ -9991,6 +10087,11 @@ declare interface IUiFacade<TSettings> {
|
|
|
9991
10087
|
* @param speed How fast the scrolling from the current offset to the given one should happen in milliseconds.
|
|
9992
10088
|
*/
|
|
9993
10089
|
scrollToX(scrollElement: IContainer, offset: number, speed: number): void;
|
|
10090
|
+
/**
|
|
10091
|
+
* Stops any ongoing scrolling of the given element.
|
|
10092
|
+
* @param scrollElement The element which might be scrolling dynamically.
|
|
10093
|
+
*/
|
|
10094
|
+
stopScrolling(scrollElement: IContainer): void;
|
|
9994
10095
|
/**
|
|
9995
10096
|
* Attempts a load of the score represented by the given data object.
|
|
9996
10097
|
* @param data The data object to decode
|
|
@@ -10006,6 +10107,17 @@ declare interface IUiFacade<TSettings> {
|
|
|
10006
10107
|
* @returns true if the data object is supported and a load was initiated, otherwise false
|
|
10007
10108
|
*/
|
|
10008
10109
|
loadSoundFont(data: unknown, append: boolean): boolean;
|
|
10110
|
+
/**
|
|
10111
|
+
* Updates the overflows needed to ensure the smooth scrolling
|
|
10112
|
+
* can reach the "end" at the desired position.
|
|
10113
|
+
* @param canvasElement The canvas element.
|
|
10114
|
+
* @param offset The offset we need
|
|
10115
|
+
* @param isVertical Whether we have a vertical or horizontal overflow
|
|
10116
|
+
* @remarks
|
|
10117
|
+
* Without these overflows we might not have enough scroll space
|
|
10118
|
+
* and we cannot reach a "sticky cursor" behavior.
|
|
10119
|
+
*/
|
|
10120
|
+
setCanvasOverflow(canvasElement: IContainer, overflow: number, isVertical: boolean): void;
|
|
10009
10121
|
/**
|
|
10010
10122
|
* This events is fired when the {@link canRender} property changes.
|
|
10011
10123
|
*/
|
|
@@ -10498,7 +10610,7 @@ declare class MasterBar {
|
|
|
10498
10610
|
*/
|
|
10499
10611
|
declare class MasterBarBounds {
|
|
10500
10612
|
/**
|
|
10501
|
-
*
|
|
10613
|
+
* The MasterBar index within the data model represented by these bounds.
|
|
10502
10614
|
*/
|
|
10503
10615
|
index: number;
|
|
10504
10616
|
/**
|
|
@@ -11106,6 +11218,14 @@ declare class MidiTickLookup {
|
|
|
11106
11218
|
* @returns The information about the current beat or null if no beat could be found.
|
|
11107
11219
|
*/
|
|
11108
11220
|
findBeat(trackLookup: Set<number>, tick: number, currentBeatHint?: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResult | null;
|
|
11221
|
+
/**
|
|
11222
|
+
* Finds the currently played beat given a list of tracks and the current time.
|
|
11223
|
+
* @param checker The checker to ask whether a beat is visible and should be considered for result.
|
|
11224
|
+
* @param tick The current time in midi ticks.
|
|
11225
|
+
* @param currentBeatHint Used for optimized lookup during playback. By passing in a previous result lookup of the next one can be optimized using heuristics. (optional).
|
|
11226
|
+
* @returns The information about the current beat or null if no beat could be found.
|
|
11227
|
+
*/
|
|
11228
|
+
findBeatWithChecker(checker: IBeatVisibilityChecker, tick: number, currentBeatHint?: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResult | null;
|
|
11109
11229
|
private _findBeatFast;
|
|
11110
11230
|
private _fillNextBeatMultiBarRest;
|
|
11111
11231
|
private _fillNextBeat;
|
|
@@ -14288,6 +14408,23 @@ declare class RenderStylesheet {
|
|
|
14288
14408
|
* Whether barlines should be drawn across staves within the same system.
|
|
14289
14409
|
*/
|
|
14290
14410
|
extendBarLines: boolean;
|
|
14411
|
+
/**
|
|
14412
|
+
* Whether to hide empty staves.
|
|
14413
|
+
*/
|
|
14414
|
+
hideEmptyStaves: boolean;
|
|
14415
|
+
/**
|
|
14416
|
+
* Whether to also hide empty staves in the first system.
|
|
14417
|
+
* @remarks
|
|
14418
|
+
* Only has an effect when activating {@link hideEmptyStaves}.
|
|
14419
|
+
*/
|
|
14420
|
+
hideEmptyStavesInFirstSystem: boolean;
|
|
14421
|
+
/**
|
|
14422
|
+
* Whether to show brackets and braces across single staves.
|
|
14423
|
+
* @remarks
|
|
14424
|
+
* This allows a more consistent view for identifying staves when using
|
|
14425
|
+
* {@link hideEmptyStaves}
|
|
14426
|
+
*/
|
|
14427
|
+
showSingleStaffBrackets: boolean;
|
|
14291
14428
|
}
|
|
14292
14429
|
|
|
14293
14430
|
/**
|
|
@@ -14666,7 +14803,13 @@ export declare enum ScrollMode {
|
|
|
14666
14803
|
/**
|
|
14667
14804
|
* Scrolling happens as soon the cursors exceed the displayed range.
|
|
14668
14805
|
*/
|
|
14669
|
-
OffScreen = 2
|
|
14806
|
+
OffScreen = 2,
|
|
14807
|
+
/**
|
|
14808
|
+
* Scrolling happens constantly in a smooth fashion.
|
|
14809
|
+
* This will disable the use of any native scroll optimizations but
|
|
14810
|
+
* manually scroll the scroll container in the required speed.
|
|
14811
|
+
*/
|
|
14812
|
+
Smooth = 3
|
|
14670
14813
|
}
|
|
14671
14814
|
|
|
14672
14815
|
/**
|