@coderline/alphatab 1.3.0-alpha.870 → 1.3.0-alpha.873

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.
@@ -5614,80 +5614,97 @@ declare class Environment {
5614
5614
  }
5615
5615
 
5616
5616
  /**
5617
- * Represents the time period, for which all bars of a {@link MasterBar} are played.
5617
+ * Represents the time period, for which one or multiple {@link Beat}s are played
5618
5618
  */
5619
- declare class MasterBarTickLookup {
5619
+ declare class BeatTickLookup {
5620
+ private _highlightedBeats;
5620
5621
  /**
5621
- * Gets or sets the start time in midi ticks at which the MasterBar is played.
5622
+ * Gets or sets the start time in midi ticks at which the given beat is played.
5622
5623
  */
5623
5624
  start: number;
5624
5625
  /**
5625
- * Gets or sets the end time in midi ticks at which the MasterBar is played.
5626
+ * Gets or sets the end time in midi ticks at which the given beat is played.
5626
5627
  */
5627
5628
  end: number;
5628
5629
  /**
5629
- * Gets or sets the current tempo when the MasterBar is played.
5630
+ * Gets or sets a list of all beats that should be highlighted when
5631
+ * the beat of this lookup starts playing. This might not mean
5632
+ * the beats start at this position.
5630
5633
  */
5631
- tempo: number;
5634
+ highlightedBeats: Beat[];
5632
5635
  /**
5633
- * Gets or sets the MasterBar which is played.
5636
+ * Gets the next BeatTickLookup which comes after this one and is in the same
5637
+ * MasterBarTickLookup.
5634
5638
  */
5635
- masterBar: MasterBar;
5639
+ nextBeat: BeatTickLookup | null;
5636
5640
  /**
5637
- * Gets or sets the list of {@link BeatTickLookup} object which define the durations
5638
- * for all {@link Beats} played within the period of this MasterBar.
5641
+ * Gets the preivous BeatTickLookup which comes before this one and is in the same
5642
+ * MasterBarTickLookup.
5639
5643
  */
5640
- beats: BeatTickLookup[];
5644
+ previousBeat: BeatTickLookup | null;
5641
5645
  /**
5642
- * Gets or sets the {@link MasterBarTickLookup} of the next masterbar in the {@link Score}
5646
+ * Gets the tick duration of this lookup.
5643
5647
  */
5644
- nextMasterBar: MasterBarTickLookup | null;
5648
+ get duration(): number;
5649
+ constructor(start: number, end: number);
5645
5650
  /**
5646
- * Performs the neccessary finalization steps after all information was written.
5651
+ * Marks the given beat as highlighed as part of this lookup.
5652
+ * @param beat The beat to add.
5647
5653
  */
5648
- finish(): void;
5654
+ highlightBeat(beat: Beat): void;
5649
5655
  /**
5650
- * Adds a new {@link BeatTickLookup} to the list of played beats during this MasterBar period.
5651
- * @param beat
5656
+ * Looks for the first visible beat which starts at this lookup so it can be used for cursor placement.
5657
+ * @param visibleTracks The visible tracks.
5658
+ * @returns The first beat which is visible according to the given tracks or null.
5652
5659
  */
5653
- addBeat(beat: BeatTickLookup): void;
5660
+ getVisibleBeatAtStart(visibleTracks: Set<number>): Beat | null;
5654
5661
  }
5655
5662
 
5656
5663
  /**
5657
- * Represents the time period, for which a {@link Beat} is played.
5664
+ * Represents the time period, for which all bars of a {@link MasterBar} are played.
5658
5665
  */
5659
- declare class BeatTickLookup {
5660
- private _highlightedBeats;
5666
+ declare class MasterBarTickLookup {
5661
5667
  /**
5662
- * Gets or sets the index of the lookup within the parent MasterBarTickLookup.
5668
+ * Gets or sets the start time in midi ticks at which the MasterBar is played.
5663
5669
  */
5664
- index: number;
5670
+ start: number;
5665
5671
  /**
5666
- * Gets or sets the parent MasterBarTickLookup to which this beat lookup belongs to.
5672
+ * Gets or sets the end time in midi ticks at which the MasterBar is played.
5667
5673
  */
5668
- masterBar: MasterBarTickLookup;
5674
+ end: number;
5669
5675
  /**
5670
- * Gets or sets the start time in midi ticks at which the given beat is played.
5676
+ * Gets or sets the current tempo when the MasterBar is played.
5671
5677
  */
5672
- start: number;
5678
+ tempo: number;
5673
5679
  /**
5674
- * Gets or sets the end time in midi ticks at which the given beat is played.
5680
+ * Gets or sets the MasterBar which is played.
5675
5681
  */
5676
- end: number;
5682
+ masterBar: MasterBar;
5683
+ firstBeat: BeatTickLookup | null;
5684
+ lastBeat: BeatTickLookup | null;
5677
5685
  /**
5678
- * Gets or sets the beat which is played.
5686
+ * Inserts `newNextBeat` after `currentBeat` in the linked list of items and updates.
5687
+ * the `firstBeat` and `lastBeat` respectively too.
5688
+ * @param currentBeat The item in which to insert the new item afterwards
5689
+ * @param newBeat The new item to insert
5679
5690
  */
5680
- beat: Beat;
5691
+ private insertAfter;
5681
5692
  /**
5682
- * Gets or sets whether the beat is the placeholder beat for an empty bar.
5693
+ * Inserts `newNextBeat` before `currentBeat` in the linked list of items and updates.
5694
+ * the `firstBeat` and `lastBeat` respectively too.
5695
+ * @param currentBeat The item in which to insert the new item afterwards
5696
+ * @param newBeat The new item to insert
5697
+ */
5698
+ private insertBefore;
5699
+ /**
5700
+ * Gets or sets the {@link MasterBarTickLookup} of the next masterbar in the {@link Score}
5683
5701
  */
5684
- isEmptyBar: boolean;
5702
+ nextMasterBar: MasterBarTickLookup | null;
5685
5703
  /**
5686
- * Gets or sets a list of all beats that should be highlighted when
5687
- * the beat of this lookup starts playing.
5704
+ * Adds a new beat to this masterbar following the slicing logic required by the MidiTickLookup.
5705
+ * @returns The first item of the chain which was affected.
5688
5706
  */
5689
- beatsToHighlight: Beat[];
5690
- highlightBeat(beat: Beat): void;
5707
+ addBeat(beat: Beat, start: number, duration: number): void;
5691
5708
  }
5692
5709
 
5693
5710
  /**
@@ -5696,38 +5713,66 @@ declare class BeatTickLookup {
5696
5713
  */
5697
5714
  declare class MidiTickLookupFindBeatResult {
5698
5715
  /**
5699
- * Gets or sets the beat that is currently played.
5700
- */
5701
- get currentBeat(): Beat;
5702
- /**
5703
- * Gets or sets the beat that will be played next.
5716
+ * Gets or sets the beat that is currently played and used for the start
5717
+ * position of the cursor animation.
5704
5718
  */
5705
- get nextBeat(): Beat | null;
5719
+ beat: Beat;
5706
5720
  /**
5707
- * Gets or sets the duration in milliseconds how long this beat is playing.
5721
+ * Gets or sets the parent MasterBarTickLookup to which this beat lookup belongs to.
5708
5722
  */
5709
- duration: number;
5723
+ masterBar: MasterBarTickLookup;
5710
5724
  /**
5711
- * Gets or sets the duration in midi ticks for how long this tick lookup is valid
5712
- * starting at the `currentBeatLookup.start`
5725
+ * Gets or sets the related beat tick lookup.
5713
5726
  */
5714
- tickDuration: number;
5727
+ beatLookup: BeatTickLookup;
5715
5728
  /**
5716
- * Gets or sets the beats ot highlight along the current beat.
5729
+ * Gets or sets the beat that will be played next.
5717
5730
  */
5718
- beatsToHighlight: Beat[];
5731
+ nextBeat: MidiTickLookupFindBeatResult | null;
5719
5732
  /**
5720
- * Gets or sets the underlying beat lookup which
5721
- * was used for building this MidiTickLookupFindBeatResult.
5733
+ * Gets or sets the duration in midi ticks how long this lookup is valid.
5722
5734
  */
5723
- currentBeatLookup: BeatTickLookup;
5735
+ tickDuration: number;
5724
5736
  /**
5725
- * Gets or sets the beat lookup for the next beat.
5737
+ * Gets or sets the duration in milliseconds how long this lookup is valid.
5726
5738
  */
5727
- nextBeatLookup: BeatTickLookup | null;
5739
+ duration: number;
5740
+ get start(): number;
5741
+ get end(): number;
5742
+ constructor(masterBar: MasterBarTickLookup);
5728
5743
  }
5729
5744
  /**
5730
5745
  * This class holds all information about when {@link MasterBar}s and {@link Beat}s are played.
5746
+ *
5747
+ * On top level it is organized into {@link MasterBarTickLookup} objects indicating the
5748
+ * master bar start and end times. This information is used to highlight the currently played bars
5749
+ * and it gives access to the played beats in this masterbar and their times.
5750
+ *
5751
+ * The {@link BeatTickLookup} are then the slices into which the masterbar is separated by the voices and beats
5752
+ * of all tracks. An example how things are organized:
5753
+ *
5754
+ * Time (eighths): | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
5755
+ *
5756
+ * Track 1: | B1 | B2 | B3 | B4 | B5 | B6 |
5757
+ * Track 2: | B7 | B7 | B9 | B10| B11| B12|
5758
+ * Track 3: | B13 |
5759
+ *
5760
+ * Lookup: | L1 | L2 | L3 | L4 | L5 | L6 | L7 | L8 |
5761
+ * Active Beats:
5762
+ * - L1 B1,B7,B13
5763
+ * - L2 B2,B7,B13
5764
+ * - L3 B3,B7,B13
5765
+ * - L4 B4,B7,B13
5766
+ * - L5 B5,B9,B13
5767
+ * - L6 B5,B10,B13
5768
+ * - L7 B6,B11,B13
5769
+ * - L8 B6,B12,B13
5770
+ *
5771
+ * Then during playback we build out of this list {@link MidiTickLookupFindBeatResult} objects which are sepcific
5772
+ * to the visible tracks displayed. This is required because if only Track 2 is displayed we cannot use the the
5773
+ * Lookup L1 alone to determine the start and end of the beat cursor. In this case we will derive a
5774
+ * MidiTickLookupFindBeatResult which holds for Time 01 the lookup L1 as start and L3 as end. This will be used
5775
+ * both for the cursor and beat highlighting.
5731
5776
  */
5732
5777
  declare class MidiTickLookup {
5733
5778
  private _currentMasterBar;
@@ -5742,22 +5787,27 @@ declare class MidiTickLookup {
5742
5787
  * @internal
5743
5788
  */
5744
5789
  readonly masterBars: MasterBarTickLookup[];
5745
- /**
5746
- * Performs the neccessary finalization steps after all information was written.
5747
- * @internal
5748
- */
5749
- finish(): void;
5750
5790
  /**
5751
5791
  * Finds the currently played beat given a list of tracks and the current time.
5752
- * @param tracks The tracks in which to search the played beat for.
5792
+ * @param trackLookup The tracks indices in which to search the played beat for.
5753
5793
  * @param tick The current time in midi ticks.
5754
5794
  * @returns The information about the current beat or null if no beat could be found.
5755
5795
  */
5756
- findBeat(tracks: Track[], tick: number, currentBeatHint?: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResult | null;
5796
+ findBeat(trackLookup: Set<number>, tick: number, currentBeatHint?: MidiTickLookupFindBeatResult | null): MidiTickLookupFindBeatResult | null;
5757
5797
  private findBeatFast;
5798
+ private fillNextBeat;
5758
5799
  private findBeatSlow;
5800
+ /**
5801
+ * Finds the beat at a given tick position within the known master bar.
5802
+ * @param masterBar
5803
+ * @param currentStartLookup
5804
+ * @param tick
5805
+ * @param visibleTracks
5806
+ * @param fillNext
5807
+ * @returns
5808
+ */
5809
+ private findBeatInMasterBar;
5759
5810
  private createResult;
5760
- private findNextBeat;
5761
5811
  private findMasterBar;
5762
5812
  /**
5763
5813
  * Gets the {@link MasterBarTickLookup} for a given masterbar at which the masterbar is played the first time.
@@ -5782,11 +5832,7 @@ declare class MidiTickLookup {
5782
5832
  * @param masterBar The item to add.
5783
5833
  */
5784
5834
  addMasterBar(masterBar: MasterBarTickLookup): void;
5785
- /**
5786
- * Adds the given {@link BeatTickLookup} to the current {@link MidiTickLookup}.
5787
- * @param beat The lookup to add.
5788
- */
5789
- addBeat(beat: BeatTickLookup): void;
5835
+ addBeat(beat: Beat, start: number, duration: number): void;
5790
5836
  }
5791
5837
 
5792
5838
  /**
@@ -6369,6 +6415,7 @@ declare class ActiveBeatsChangedEventArgs {
6369
6415
  declare class AlphaTabApiBase<TSettings> {
6370
6416
  private _startTime;
6371
6417
  private _trackIndexes;
6418
+ private _trackIndexLookup;
6372
6419
  private _isDestroyed;
6373
6420
  /**
6374
6421
  * Gets the UI facade to use for interacting with the user interface.
@@ -6823,7 +6870,6 @@ declare class MidiFileGenerator {
6823
6870
  private _settings;
6824
6871
  private _handler;
6825
6872
  private _currentTempo;
6826
- private _currentBarRepeatLookup;
6827
6873
  private _programsPerChannel;
6828
6874
  /**
6829
6875
  * Gets a lookup object which can be used to quickly find beats and bars