@coderline/alphatab 1.6.0-alpha.1416 → 1.6.0-alpha.1420

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.
@@ -192,7 +192,8 @@ declare class AlphaSynthBase implements IAlphaSynth {
192
192
  readonly playbackRangeChanged: IEventEmitterOfT<PlaybackRangeChangedEventArgs>;
193
193
  /* Excluded from this release type: hasSamplesForProgram */
194
194
  /* Excluded from this release type: hasSamplesForPercussion */
195
- loadBackingTrack(_score: Score, _syncPoints: BackingTrackSyncPoint[]): void;
195
+ loadBackingTrack(_score: Score): void;
196
+ updateSyncPoints(_syncPoints: BackingTrackSyncPoint[]): void;
196
197
  }
197
198
 
198
199
  /**
@@ -350,6 +351,7 @@ declare class AlphaSynthWebWorkerApi implements IAlphaSynth {
350
351
  onOutputSamplesPlayed(samples: number): void;
351
352
  private onOutputReady;
352
353
  loadBackingTrack(_score: Score): void;
354
+ updateSyncPoints(_syncPoints: BackingTrackSyncPoint[]): void;
353
355
  }
354
356
 
355
357
  /**
@@ -1399,6 +1401,12 @@ export declare class AlphaTabApiBase<TSettings> {
1399
1401
  * @since 1.6.0
1400
1402
  */
1401
1403
  loadMidiForScore(): void;
1404
+ /**
1405
+ * Triggers an update of the sync points for the current score after modification within the data model
1406
+ * @category Methods - Player
1407
+ * @since 1.6.0
1408
+ */
1409
+ updateSyncPoints(): void;
1402
1410
  /**
1403
1411
  * Changes the volume of the given tracks.
1404
1412
  * @param tracks The tracks for which the volume should be changed.
@@ -3078,11 +3086,6 @@ declare class BackingTrack {
3078
3086
  * @json_ignore
3079
3087
  */
3080
3088
  rawAudioFile: Uint8Array | undefined;
3081
- /**
3082
- * The number of milliseconds the audio should be shifted to align with the song.
3083
- * (e.g. negative values allow skipping potential silent parts at the start of the file and directly start with the first note).
3084
- */
3085
- padding: number;
3086
3089
  }
3087
3090
 
3088
3091
  /**
@@ -3094,9 +3097,12 @@ declare class BackingTrackSyncPoint {
3094
3097
  constructor(tick: number, data: SyncPointData);
3095
3098
  }
3096
3099
 
3097
- declare class BackingTrackSyncPointWithTime extends BackingTrackSyncPoint {
3098
- time: number;
3099
- constructor(tick: number, data: SyncPointData, time: number);
3100
+ declare class BackingTrackSyncPointWithTime {
3101
+ alphaTabTick: number;
3102
+ alphaTabTime: number;
3103
+ modifiedTempo: number;
3104
+ millisecondOffset: number;
3105
+ constructor(tick: number, time: number, modifiedTempo: number, millisecondOffset: number);
3100
3106
  }
3101
3107
 
3102
3108
  /**
@@ -4975,12 +4981,34 @@ export declare class CoreSettings {
4975
4981
  * where the Web Font files of [Bravura](https://github.com/steinbergmedia/bravura) are. Normally alphaTab expects
4976
4982
  * them to be in a `font` subfolder beside the script file. If this is not the case, this setting must be used to configure the path.
4977
4983
  * Alternatively also a global variable `ALPHATAB_FONT` can be set on the page before initializing alphaTab.
4984
+ *
4985
+ * Use {@link smuflFontSources} for more flexible font configuration.
4978
4986
  * @defaultValue `"${AlphaTabScriptFolder}/font/"`
4979
4987
  * @category Core - JavaScript Specific
4980
4988
  * @target web
4981
4989
  * @since 0.9.6
4982
4990
  */
4983
4991
  fontDirectory: string | null;
4992
+ /**
4993
+ * Defines the URLs from which to load the SMuFL compliant font files.
4994
+ * @remarks
4995
+ * These sources will be used to load and register the webfonts on the page so
4996
+ * they are available for rendering the music sheet. The sources can be set to any
4997
+ * CSS compatible URL which can be passed into `url()`.
4998
+ * See https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#url
4999
+ * @defaultValue Bravura files located at {@link fontDirectory} .
5000
+ * @category Core - JavaScript Specific
5001
+ * @target web
5002
+ * @since 1.6.0
5003
+ */
5004
+ smuflFontSources: Map<FontFileFormat, string> | null;
5005
+ /**
5006
+ * Builds the default SMuFL font sources for the usage with alphaTab in cases
5007
+ * where no custom {@link smuflFontSources} are provided.
5008
+ * @param fontDirectory The {@link fontDirectory} configured.
5009
+ * @target web
5010
+ */
5011
+ static buildDefaultSmuflFontSources(fontDirectory: string | null): Map<FontFileFormat, string>;
4984
5012
  /**
4985
5013
  * The full URL to the input file to be loaded.
4986
5014
  * @remarks
@@ -5129,12 +5157,27 @@ declare interface CoreSettingsJson {
5129
5157
  * where the Web Font files of [Bravura](https://github.com/steinbergmedia/bravura) are. Normally alphaTab expects
5130
5158
  * them to be in a `font` subfolder beside the script file. If this is not the case, this setting must be used to configure the path.
5131
5159
  * Alternatively also a global variable `ALPHATAB_FONT` can be set on the page before initializing alphaTab.
5160
+ *
5161
+ * Use {@link smuflFontSources} for more flexible font configuration.
5132
5162
  * @defaultValue `"${AlphaTabScriptFolder}/font/"`
5133
5163
  * @category Core - JavaScript Specific
5134
5164
  * @target web
5135
5165
  * @since 0.9.6
5136
5166
  */
5137
5167
  fontDirectory?: string | null;
5168
+ /**
5169
+ * Defines the URLs from which to load the SMuFL compliant font files.
5170
+ * @remarks
5171
+ * These sources will be used to load and register the webfonts on the page so
5172
+ * they are available for rendering the music sheet. The sources can be set to any
5173
+ * CSS compatible URL which can be passed into `url()`.
5174
+ * See https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#url
5175
+ * @defaultValue Bravura files located at {@link fontDirectory} .
5176
+ * @category Core - JavaScript Specific
5177
+ * @target web
5178
+ * @since 1.6.0
5179
+ */
5180
+ smuflFontSources?: Map<FontFileFormat | keyof typeof FontFileFormat | Lowercase<keyof typeof FontFileFormat>, string>;
5138
5181
  /**
5139
5182
  * The full URL to the input file to be loaded.
5140
5183
  * @remarks
@@ -6177,7 +6220,6 @@ export declare class Environment {
6177
6220
  private static readonly StaffIdBeforeEndAlways;
6178
6221
  /* Excluded from this release type: MusicFontSize */
6179
6222
  /* Excluded from this release type: HighDpiFactor */
6180
- /* Excluded from this release type: createStyleElement */
6181
6223
  /**
6182
6224
  * @target web
6183
6225
  */
@@ -6203,7 +6245,6 @@ export declare class Environment {
6203
6245
  * @target web
6204
6246
  */
6205
6247
  static readonly fontDirectory: string | null;
6206
- /* Excluded from this release type: bravuraFontChecker */
6207
6248
  /**
6208
6249
  * @target web
6209
6250
  */
@@ -6506,8 +6547,39 @@ declare class Font {
6506
6547
  */
6507
6548
  static withFamilyList(families: string[], size: number, style?: FontStyle, weight?: FontWeight): Font;
6508
6549
  toCssString(scale?: number): string;
6509
- static fromJson(v: unknown): Font | null;
6510
- static toJson(font: Font): Map<string, unknown>;
6550
+ static fromJson(v: unknown): Font | undefined;
6551
+ static toJson(font: Font | undefined): Map<string, unknown> | undefined;
6552
+ }
6553
+
6554
+ /**
6555
+ * Lists the known file formats for font files.
6556
+ * @target web
6557
+ */
6558
+ export declare enum FontFileFormat {
6559
+ /**
6560
+ * .eot
6561
+ */
6562
+ EmbeddedOpenType = 0,
6563
+ /**
6564
+ * .woff
6565
+ */
6566
+ Woff = 1,
6567
+ /**
6568
+ * .woff2
6569
+ */
6570
+ Woff2 = 2,
6571
+ /**
6572
+ * .otf
6573
+ */
6574
+ OpenType = 3,
6575
+ /**
6576
+ * .ttf
6577
+ */
6578
+ TrueType = 4,
6579
+ /**
6580
+ * .svg
6581
+ */
6582
+ Svg = 5
6511
6583
  }
6512
6584
 
6513
6585
  /**
@@ -6522,21 +6594,6 @@ declare type FontJson = Font | string | {
6522
6594
  weight: FontWeight | keyof typeof FontWeight;
6523
6595
  };
6524
6596
 
6525
- /**
6526
- * This small utility helps to detect whether a particular font is already loaded.
6527
- * @target web
6528
- */
6529
- declare class FontLoadingChecker {
6530
- private _originalFamilies;
6531
- private _families;
6532
- private _isStarted;
6533
- isFontLoaded: boolean;
6534
- fontLoaded: IEventEmitterOfT<string>;
6535
- constructor(families: string[]);
6536
- checkForFontAvailability(): void;
6537
- private isFontAvailable;
6538
- }
6539
-
6540
6597
  /**
6541
6598
  * Describes the sizes of a font for measuring purposes.
6542
6599
  */
@@ -6987,7 +7044,12 @@ declare interface IAlphaSynth {
6987
7044
  * Loads the synchronization information from the given score (used for backing tracks and external media).
6988
7045
  * @param score
6989
7046
  */
6990
- loadBackingTrack(score: Score, syncPoints: BackingTrackSyncPoint[]): void;
7047
+ loadBackingTrack(score: Score): void;
7048
+ /**
7049
+ * Updates the points used to synchronize the backing track with the synthesized audio for correct cursor placement.
7050
+ * @param syncPoints
7051
+ */
7052
+ updateSyncPoints(syncPoints: BackingTrackSyncPoint[]): void;
6991
7053
  /**
6992
7054
  * Applies the given transposition pitches to be used during playback.
6993
7055
  * @param transpositionPitches a map defining the transposition pitches for midi channel.
@@ -8758,7 +8820,13 @@ declare class MasterBarTickLookup {
8758
8820
  * Gets or sets the MasterBar which is played.
8759
8821
  */
8760
8822
  masterBar: MasterBar;
8823
+ /**
8824
+ * The first beat in the bar.
8825
+ */
8761
8826
  firstBeat: BeatTickLookup | null;
8827
+ /**
8828
+ * The last beat in the bar.
8829
+ */
8762
8830
  lastBeat: BeatTickLookup | null;
8763
8831
  /**
8764
8832
  * Inserts `newNextBeat` after `currentBeat` in the linked list of items and updates.
@@ -9117,6 +9185,17 @@ declare class MidiFileGenerator {
9117
9185
  private addProgramChange;
9118
9186
  static buildTranspositionPitches(score: Score, settings: Settings): Map<number, number>;
9119
9187
  private generateChannel;
9188
+ /**
9189
+ * Generates the sync points for the given score without re-generating the midi itself.
9190
+ * @remarks
9191
+ * Use this method if a re-generation of the sync points after modification is required.
9192
+ * It correctly handles repeats and places sync points accoridng to their absolute midi tick when they
9193
+ * need to be considered for synchronization.
9194
+ * @param score The song for which to regenerate the sync points.
9195
+ * @returns The generated sync points for usage in the backing track playback.
9196
+ */
9197
+ static generateSyncPoints(score: Score): BackingTrackSyncPoint[];
9198
+ private static playThroughSong;
9120
9199
  private static toChannelShort;
9121
9200
  private generateMasterBar;
9122
9201
  private generateBar;
@@ -9314,7 +9393,10 @@ declare class MidiSequencerState {
9314
9393
  declare class MidiTickLookup {
9315
9394
  private _currentMasterBar;
9316
9395
  /* Excluded from this release type: masterBarLookup */
9317
- /* Excluded from this release type: masterBars */
9396
+ /**
9397
+ * A list of all {@link MasterBarTickLookup} sorted by time.
9398
+ */
9399
+ readonly masterBars: MasterBarTickLookup[];
9318
9400
  /**
9319
9401
  * The information about which bars are displayed via multi-bar rests.
9320
9402
  * The key is the start bar, and the value is the additional bars in sequential order.
@@ -12066,6 +12148,7 @@ export declare namespace rendering {
12066
12148
  export declare class RenderingResources {
12067
12149
  private static sansFont;
12068
12150
  private static serifFont;
12151
+ /* Excluded from this release type: smuflFont */
12069
12152
  /**
12070
12153
  * The font to use for displaying the songs copyright information in the header of the music sheet.
12071
12154
  * @defaultValue `bold 12px Arial, sans-serif`
@@ -12208,6 +12291,7 @@ export declare class RenderingResources {
12208
12291
  * @target web
12209
12292
  */
12210
12293
  declare interface RenderingResourcesJson {
12294
+ /* Excluded from this release type: smuflFont */
12211
12295
  /**
12212
12296
  * The font to use for displaying the songs copyright information in the header of the music sheet.
12213
12297
  * @defaultValue `bold 12px Arial, sans-serif`