@coderline/alphatab 1.6.0-alpha.1408 → 1.6.0-alpha.1415

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.
@@ -324,7 +324,6 @@ declare class AlphaSynthWebWorkerApi implements IAlphaSynth {
324
324
  stop(): void;
325
325
  playOneTimeMidiFile(midi: MidiFile): void;
326
326
  loadSoundFont(data: Uint8Array, append: boolean): void;
327
- loadSoundFontFromUrl(url: string, append: boolean, progress: (e: ProgressEventArgs) => void): void;
328
327
  resetSoundFonts(): void;
329
328
  loadMidiFile(midi: MidiFile): void;
330
329
  applyTranspositionPitches(transpositionPitches: Map<number, number>): void;
@@ -471,6 +470,8 @@ export declare class AlphaTabApiBase<TSettings> {
471
470
  private _score;
472
471
  private _tracks;
473
472
  private _actualPlayerMode;
473
+ private _player;
474
+ private _renderer;
474
475
  /**
475
476
  * The actual player mode which is currently active (e.g. allows determining whether a backing track or the synthesizer is active).
476
477
  */
@@ -516,7 +517,7 @@ export declare class AlphaTabApiBase<TSettings> {
516
517
  * @category Properties - Core
517
518
  * @since 0.9.4
518
519
  */
519
- readonly renderer: IScoreRenderer;
520
+ get renderer(): IScoreRenderer;
520
521
  /**
521
522
  * The score holding all information about the song being rendered
522
523
  * @category Properties - Core
@@ -611,6 +612,7 @@ export declare class AlphaTabApiBase<TSettings> {
611
612
  * @param settings The UI settings object to use for loading the settings.
612
613
  */
613
614
  constructor(uiFacade: IUiFacade<TSettings>, settings: TSettings);
615
+ private setupPlayerWrapper;
614
616
  /**
615
617
  * Destroys the alphaTab control and restores the initial state of the UI.
616
618
  * @remarks
@@ -681,6 +683,7 @@ export declare class AlphaTabApiBase<TSettings> {
681
683
  * ```
682
684
  */
683
685
  updateSettings(): void;
686
+ private updateRenderer;
684
687
  /**
685
688
  * Initiates a load of the score using the given data.
686
689
  * @returns true if the data object is supported and a load was initiated, otherwise false
@@ -1022,7 +1025,7 @@ export declare class AlphaTabApiBase<TSettings> {
1022
1025
  * setupPlayerEvents(api.player)
1023
1026
  * ```
1024
1027
  */
1025
- player: IAlphaSynth | null;
1028
+ get player(): IAlphaSynth | null;
1026
1029
  /**
1027
1030
  * Whether the player is ready for starting the playback.
1028
1031
  * @remarks
@@ -1375,8 +1378,19 @@ export declare class AlphaTabApiBase<TSettings> {
1375
1378
  get isLooping(): boolean;
1376
1379
  set isLooping(value: boolean);
1377
1380
  private destroyPlayer;
1378
- private setupPlayer;
1379
- private loadMidiForScore;
1381
+ /**
1382
+ *
1383
+ * @returns true if a new player was created, false if no player was created (includes destroy & reuse of the current one)
1384
+ */
1385
+ private setupOrDestroyPlayer;
1386
+ /**
1387
+ * Re-creates the midi for the current score and loads it.
1388
+ * @remarks
1389
+ * This will result in the player to stop playback. Some setting changes require re-genration of the midi song.
1390
+ * @category Methods - Player
1391
+ * @since 1.6.0
1392
+ */
1393
+ loadMidiForScore(): void;
1380
1394
  /**
1381
1395
  * Changes the volume of the given tracks.
1382
1396
  * @param tracks The tracks for which the volume should be changed.
@@ -1700,15 +1714,14 @@ export declare class AlphaTabApiBase<TSettings> {
1700
1714
  private _beatCursor;
1701
1715
  private _selectionWrapper;
1702
1716
  private _previousTick;
1703
- private _playerState;
1704
1717
  private _currentBeat;
1705
- private _currentBarBounds;
1718
+ private _currentBeatBounds;
1719
+ private _isInitialBeatCursorUpdate;
1706
1720
  private _previousStateForCursor;
1707
1721
  private _previousCursorCache;
1708
1722
  private _lastScroll;
1709
1723
  private destroyCursors;
1710
1724
  private updateCursors;
1711
- private setupPlayerEvents;
1712
1725
  /**
1713
1726
  * updates the cursors to highlight the beat at the specified tick position
1714
1727
  * @param tick
@@ -2350,7 +2363,7 @@ export declare class AlphaTabApiBase<TSettings> {
2350
2363
  * }
2351
2364
  * ```
2352
2365
  */
2353
- playerReady: IEventEmitter;
2366
+ get playerReady(): IEventEmitter;
2354
2367
  private onPlayerReady;
2355
2368
  /**
2356
2369
  * This event is fired when the playback of the whole song finished.
@@ -2402,7 +2415,7 @@ export declare class AlphaTabApiBase<TSettings> {
2402
2415
  * ```
2403
2416
  *
2404
2417
  */
2405
- playerFinished: IEventEmitter;
2418
+ get playerFinished(): IEventEmitter;
2406
2419
  private onPlayerFinished;
2407
2420
  /**
2408
2421
  * This event is fired when the SoundFont needed for playback was loaded.
@@ -2440,7 +2453,7 @@ export declare class AlphaTabApiBase<TSettings> {
2440
2453
  * ```
2441
2454
  *
2442
2455
  */
2443
- soundFontLoaded: IEventEmitter;
2456
+ get soundFontLoaded(): IEventEmitter;
2444
2457
  private onSoundFontLoaded;
2445
2458
  /**
2446
2459
  * This event is fired when a Midi file is being loaded.
@@ -2567,7 +2580,7 @@ export declare class AlphaTabApiBase<TSettings> {
2567
2580
  * ```
2568
2581
  *
2569
2582
  */
2570
- playerStateChanged: IEventEmitterOfT<PlayerStateChangedEventArgs>;
2583
+ get playerStateChanged(): IEventEmitterOfT<PlayerStateChangedEventArgs>;
2571
2584
  private onPlayerStateChanged;
2572
2585
  /**
2573
2586
  * This event is fired when the current playback position of the song changed.
@@ -2605,7 +2618,7 @@ export declare class AlphaTabApiBase<TSettings> {
2605
2618
  * ```
2606
2619
  *
2607
2620
  */
2608
- playerPositionChanged: IEventEmitterOfT<PositionChangedEventArgs>;
2621
+ get playerPositionChanged(): IEventEmitterOfT<PositionChangedEventArgs>;
2609
2622
  private onPlayerPositionChanged;
2610
2623
  /**
2611
2624
  * This event is fired when the synthesizer played certain midi events.
@@ -2686,7 +2699,7 @@ export declare class AlphaTabApiBase<TSettings> {
2686
2699
  * @see {@link SystemCommonEvent}
2687
2700
  * @see {@link SystemExclusiveEvent}
2688
2701
  */
2689
- midiEventsPlayed: IEventEmitterOfT<MidiEventsPlayedEventArgs>;
2702
+ get midiEventsPlayed(): IEventEmitterOfT<MidiEventsPlayedEventArgs>;
2690
2703
  private onMidiEventsPlayed;
2691
2704
  /**
2692
2705
  * This event is fired when the playback range changed.
@@ -2740,9 +2753,45 @@ export declare class AlphaTabApiBase<TSettings> {
2740
2753
  * ```
2741
2754
  *
2742
2755
  */
2743
- playbackRangeChanged: IEventEmitterOfT<PlaybackRangeChangedEventArgs>;
2756
+ get playbackRangeChanged(): IEventEmitterOfT<PlaybackRangeChangedEventArgs>;
2744
2757
  private onPlaybackRangeChanged;
2745
- /* Excluded from this release type: settingsUpdated */
2758
+ /**
2759
+ * This event is fired when a settings update was requested.
2760
+ *
2761
+ * @eventProperty
2762
+ * @category Events - Core
2763
+ * @since 1.6.0
2764
+ *
2765
+ * @example
2766
+ * JavaScript
2767
+ * ```js
2768
+ * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
2769
+ * api.settingsUpdated.on(() => {
2770
+ * updateSettingsUI(api.settings);
2771
+ * });
2772
+ * ```
2773
+ *
2774
+ * @example
2775
+ * C#
2776
+ * ```cs
2777
+ * var api = new AlphaTabApi<MyControl>(...);
2778
+ * api.SettingsUpdated.On(() =>
2779
+ * {
2780
+ * UpdateSettingsUI(api.settings);
2781
+ * });
2782
+ * ```
2783
+ *
2784
+ * @example
2785
+ * Android
2786
+ * ```kotlin
2787
+ * val api = AlphaTabApi<MyControl>(...)
2788
+ * api.SettingsUpdated.on {
2789
+ * updateSettingsUI(api.settings)
2790
+ * }
2791
+ * ```
2792
+ *
2793
+ */
2794
+ settingsUpdated: IEventEmitter;
2746
2795
  private onSettingsUpdated;
2747
2796
  /**
2748
2797
  * Loads and lists the available output devices which can be used by the player.
@@ -7295,16 +7344,42 @@ declare interface IContainer {
7295
7344
  mouseUp: IEventEmitterOfT<IMouseEventArgs>;
7296
7345
  }
7297
7346
 
7347
+ /**
7348
+ * An emitter for an event without any value passed to the listeners.
7349
+ */
7298
7350
  export declare interface IEventEmitter {
7299
- on(value: () => void): void;
7351
+ /**
7352
+ * Registers to the event with the given handler
7353
+ * @param value The function to call when the event occurs.
7354
+ * @returns A function which can be called to unregister the registered handler.
7355
+ * This is usedful if the original function passed to this is not stored somewhere but
7356
+ * unregistering of the event needs to be done.
7357
+ */
7358
+ on(value: () => void): () => void;
7359
+ /**
7360
+ * Unregisters the given handler from this event.
7361
+ * @param value The value originally passed into {@link on}, NOT the function returned by it.
7362
+ */
7300
7363
  off(value: () => void): void;
7301
7364
  }
7302
7365
 
7303
7366
  /**
7367
+ * An emitter for an event with a single parameter passed to the listeners.
7304
7368
  * @partial
7305
7369
  */
7306
7370
  export declare interface IEventEmitterOfT<T> {
7307
- on(value: (arg: T) => void): void;
7371
+ /**
7372
+ * Registers to the event with the given handler
7373
+ * @param value The function to call when the event occurs.
7374
+ * @returns A function which can be called to unregister the registered handler.
7375
+ * This is usedful if the original function passed to this is not stored somewhere but
7376
+ * unregistering of the event needs to be done.
7377
+ */
7378
+ on(value: (arg: T) => void): () => void;
7379
+ /**
7380
+ * Unregisters the given handler from this event.
7381
+ * @param value The value originally passed into {@link on}, NOT the function returned by it.
7382
+ */
7308
7383
  off(value: (arg: T) => void): void;
7309
7384
  }
7310
7385
 
@@ -9151,13 +9226,12 @@ declare class MidiFileSequencer {
9151
9226
  fillMidiEventQueueToEndTime(endTime: number): boolean;
9152
9227
  private fillMidiEventQueueLimited;
9153
9228
  mainTickPositionToTimePosition(tickPosition: number): number;
9154
- mainTimePositionToTickPosition(timePosition: number): number;
9155
9229
  mainUpdateSyncPoints(syncPoints: BackingTrackSyncPoint[]): void;
9156
9230
  currentTimePositionToTickPosition(timePosition: number): number;
9231
+ private updateCurrentTempo;
9157
9232
  mainTimePositionFromBackingTrack(timePosition: number, backingTrackLength: number): number;
9158
9233
  mainTimePositionToBackingTrack(timePosition: number, backingTrackLength: number): number;
9159
9234
  private tickPositionToTimePositionWithSpeed;
9160
- private timePositionToTickPositionWithSpeed;
9161
9235
  private get internalEndTime();
9162
9236
  get isFinished(): boolean;
9163
9237
  stop(): void;