@coderline/alphatab 1.6.0-alpha.1426 → 1.6.0-alpha.1430

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.
@@ -3092,17 +3092,48 @@ declare class BackingTrack {
3092
3092
  * Rerpresents a point to sync the alphaTab time axis with an external backing track.
3093
3093
  */
3094
3094
  declare class BackingTrackSyncPoint {
3095
- tick: number;
3096
- data: SyncPointData;
3097
- constructor(tick: number, data: SyncPointData);
3098
- }
3099
-
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);
3095
+ /**
3096
+ * The index of the masterbar to which this sync point belongs to.
3097
+ * @remarks
3098
+ * This property is purely informative for external use like in editors.
3099
+ * It has no impact to the synchronization itself.
3100
+ */
3101
+ masterBarIndex: number;
3102
+ /**
3103
+ * The occurence of the masterbar to which this sync point belongs to. The occurence
3104
+ * is 0-based and increases with every repeated play of a masterbar (e.g. on repeats or jumps).
3105
+ * @remarks
3106
+ * This property is purely informative for external use like in editors.
3107
+ * It has no impact to the synchronization itself.
3108
+ */
3109
+ masterBarOccurence: number;
3110
+ /**
3111
+ * The BPM the synthesizer has at the exact tick position of this sync point.
3112
+ */
3113
+ synthBpm: number;
3114
+ /**
3115
+ * The millisecond time position of the synthesizer when this sync point is reached.
3116
+ */
3117
+ synthTime: number;
3118
+ /**
3119
+ * The midi tick position of the synthesizer when this sync point is reached.
3120
+ */
3121
+ synthTick: number;
3122
+ /**
3123
+ * The millisecond time in the external media marking the synchronization point.
3124
+ */
3125
+ syncTime: number;
3126
+ /**
3127
+ * The BPM the song will have virtually after this sync point to align the external media time axis
3128
+ * with the one from the synthesizer.
3129
+ */
3130
+ syncBpm: number;
3131
+ /**
3132
+ * Updates the synchronization BPM that will apply after this sync point.
3133
+ * @param nextSyncPointSynthTime The synthesizer time of the next sync point after this one.
3134
+ * @param nextSyncPointSyncTime The synchronization time of the next sync point after this one.
3135
+ */
3136
+ updateSyncBpm(nextSyncPointSynthTime: number, nextSyncPointSyncTime: number): void;
3106
3137
  }
3107
3138
 
3108
3139
  /**
@@ -6474,6 +6505,30 @@ declare enum Fingers {
6474
6505
  LittleFinger = 4
6475
6506
  }
6476
6507
 
6508
+ /**
6509
+ * A simple flat sync point for easy persistence separate to the main data model.
6510
+ * @record
6511
+ */
6512
+ declare interface FlatSyncPoint {
6513
+ /**
6514
+ * Indicates index of the masterbar for which this sync point is valid.
6515
+ */
6516
+ barIndex: number;
6517
+ /**
6518
+ * Indicates relative position (0-1) of the sync point in within the masterbar.
6519
+ */
6520
+ barPosition: number;
6521
+ /**
6522
+ * Indicates for which repeat occurence this sync point is valid (e.g. 0 on the first time played, 1 on the second time played)
6523
+ */
6524
+ barOccurence: number;
6525
+ /**
6526
+ * The audio offset marking the position within the audio track in milliseconds.
6527
+ * This information is used to regularly sync (or on seeking) to match a given external audio time axis with the internal time axis.
6528
+ */
6529
+ millisecondOffset: number;
6530
+ }
6531
+
6477
6532
  /**
6478
6533
  * @json_immutable
6479
6534
  */
@@ -6706,7 +6761,7 @@ declare enum GolpeType {
6706
6761
  }
6707
6762
 
6708
6763
  /**
6709
- * This ScoreExporter can write Guitar Pro 7 (gp) files.
6764
+ * This ScoreExporter can write Guitar Pro 7+ (gp) files.
6710
6765
  */
6711
6766
  declare class Gp7Exporter extends ScoreExporter {
6712
6767
  get name(): string;
@@ -7453,6 +7508,52 @@ export declare interface IEventEmitterOfT<T> {
7453
7508
  off(value: (arg: T) => void): void;
7454
7509
  }
7455
7510
 
7511
+ /**
7512
+ * A custom handler for integrating alphaTab with an external media source.
7513
+ */
7514
+ declare interface IExternalMediaHandler {
7515
+ /**
7516
+ * The total duration of the backing track in milliseconds.
7517
+ */
7518
+ readonly backingTrackDuration: number;
7519
+ /**
7520
+ * The playback rate at which the output should playback.
7521
+ */
7522
+ playbackRate: number;
7523
+ /**
7524
+ * The volume at which the output should play (0-1)
7525
+ */
7526
+ masterVolume: number;
7527
+ /**
7528
+ * Instructs the output to seek to the given time position.
7529
+ * @param time The absolute time in milliseconds.
7530
+ */
7531
+ seekTo(time: number): void;
7532
+ /**
7533
+ * Instructs the external media to start the playback.
7534
+ */
7535
+ play(): void;
7536
+ /**
7537
+ * Instructs the external media to pause the playback.
7538
+ */
7539
+ pause(): void;
7540
+ }
7541
+
7542
+ /**
7543
+ * A output handling the playback via an external media.
7544
+ */
7545
+ declare interface IExternalMediaSynthOutput extends IBackingTrackSynthOutput {
7546
+ /**
7547
+ * The handler to which the media control will be delegated.
7548
+ */
7549
+ handler: IExternalMediaHandler | undefined;
7550
+ /**
7551
+ * Updates the playback position from the external media source.
7552
+ * @param currentTime The current time in the external media.
7553
+ */
7554
+ updatePosition(currentTime: number): void;
7555
+ }
7556
+
7456
7557
  export declare interface ILogger {
7457
7558
  debug(category: string, msg: string, ...details: unknown[]): void;
7458
7559
  warning(category: string, msg: string, ...details: unknown[]): void;
@@ -9195,7 +9296,11 @@ declare class MidiFileGenerator {
9195
9296
  * @returns The generated sync points for usage in the backing track playback.
9196
9297
  */
9197
9298
  static generateSyncPoints(score: Score): BackingTrackSyncPoint[];
9299
+ /* Excluded from this release type: buildModifiedTempoLookup */
9198
9300
  private static playThroughSong;
9301
+ private static processBarTime;
9302
+ private static processBarTimeWithSyncPoints;
9303
+ private static processBarTimeNoSyncPoints;
9199
9304
  private static toChannelShort;
9200
9305
  private generateMasterBar;
9201
9306
  private generateBar;
@@ -9339,7 +9444,7 @@ declare class MidiFileSequencerTempoChange {
9339
9444
  declare class MidiSequencerState {
9340
9445
  tempoChanges: MidiFileSequencerTempoChange[];
9341
9446
  tempoChangeIndex: number;
9342
- syncPoints: BackingTrackSyncPointWithTime[];
9447
+ syncPoints: BackingTrackSyncPoint[];
9343
9448
  firstProgramEventPerChannel: Map<number, SynthEvent>;
9344
9449
  firstTimeSignatureNumerator: number;
9345
9450
  firstTimeSignatureDenominator: number;
@@ -9539,6 +9644,7 @@ export declare namespace model {
9539
9644
  AutomationType,
9540
9645
  Automation,
9541
9646
  SyncPointData,
9647
+ FlatSyncPoint,
9542
9648
  Bar,
9543
9649
  SustainPedalMarkerType,
9544
9650
  SustainPedalMarker,
@@ -12740,6 +12846,17 @@ declare class Score {
12740
12846
  private addMasterBarToRepeatGroups;
12741
12847
  addTrack(track: Track): void;
12742
12848
  finish(settings: Settings): void;
12849
+ /**
12850
+ * Applies the given list of {@link FlatSyncPoint} to this song.
12851
+ * @param syncPoints The list of sync points to apply.
12852
+ * @since 1.6.0
12853
+ */
12854
+ applyFlatSyncPoints(syncPoints: FlatSyncPoint[]): void;
12855
+ /**
12856
+ * Exports all sync points in this song to a {@link FlatSyncPoint} list.
12857
+ * @since 1.6.0
12858
+ */
12859
+ exportFlatSyncPoints(): FlatSyncPoint[];
12743
12860
  }
12744
12861
 
12745
12862
  /**
@@ -13569,13 +13686,7 @@ declare class SyncPointData {
13569
13686
  */
13570
13687
  barOccurence: number;
13571
13688
  /**
13572
- * The modified tempo at which the cursor should move (aka. the tempo played within the external audio track).
13573
- * This information is used together with normal tempo changes to calculate how much faster/slower the
13574
- * cursor playback is performed to align with the audio track.
13575
- */
13576
- modifiedTempo: number;
13577
- /**
13578
- * The uadio offset marking the position within the audio track in milliseconds.
13689
+ * The audio offset marking the position within the audio track in milliseconds.
13579
13690
  * This information is used to regularly sync (or on seeking) to match a given external audio time axis with the internal time axis.
13580
13691
  */
13581
13692
  millisecondOffset: number;
@@ -13602,7 +13713,9 @@ export declare namespace synth {
13602
13713
  AlphaSynthWebAudioOutputBase,
13603
13714
  AlphaSynthScriptProcessorOutput,
13604
13715
  AlphaSynthAudioWorkletOutput,
13605
- IAudioElementBackingTrackSynthOutput
13716
+ IAudioElementBackingTrackSynthOutput,
13717
+ IExternalMediaHandler,
13718
+ IExternalMediaSynthOutput
13606
13719
  }
13607
13720
  }
13608
13721