@coderline/alphatab 1.3.0-alpha.874 → 1.3.0-alpha.876
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.d.ts +24 -2
- package/dist/alphaTab.js +83 -50
- package/dist/alphaTab.min.js +1 -1
- package/dist/alphaTab.min.mjs +1 -1
- package/dist/alphaTab.mjs +83 -50
- package/package.json +1 -1
package/dist/alphaTab.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* alphaTab v1.3.0-alpha.
|
|
2
|
+
* alphaTab v1.3.0-alpha.876 (develop, build 876)
|
|
3
3
|
*
|
|
4
|
-
* Copyright ©
|
|
4
|
+
* Copyright © 2024, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
5
|
*
|
|
6
6
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
7
7
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -16803,6 +16803,16 @@ class Queue {
|
|
|
16803
16803
|
}
|
|
16804
16804
|
}
|
|
16805
16805
|
|
|
16806
|
+
/**
|
|
16807
|
+
* Represents a beat and when it is actually played according to the generated audio.
|
|
16808
|
+
*/
|
|
16809
|
+
class BeatTickLookupItem {
|
|
16810
|
+
constructor(beat, playbackStart, playbackDuration) {
|
|
16811
|
+
this.beat = beat;
|
|
16812
|
+
this.playbackStart = playbackStart;
|
|
16813
|
+
this.playbackDuration = playbackDuration;
|
|
16814
|
+
}
|
|
16815
|
+
}
|
|
16806
16816
|
/**
|
|
16807
16817
|
* Represents the time period, for which one or multiple {@link Beat}s are played
|
|
16808
16818
|
*/
|
|
@@ -16838,13 +16848,13 @@ class BeatTickLookup {
|
|
|
16838
16848
|
* Marks the given beat as highlighed as part of this lookup.
|
|
16839
16849
|
* @param beat The beat to add.
|
|
16840
16850
|
*/
|
|
16841
|
-
highlightBeat(beat) {
|
|
16851
|
+
highlightBeat(beat, playbackStart, playbackDuration) {
|
|
16842
16852
|
if (beat.isEmpty) {
|
|
16843
16853
|
return;
|
|
16844
16854
|
}
|
|
16845
16855
|
if (!this._highlightedBeats.has(beat.id)) {
|
|
16846
16856
|
this._highlightedBeats.set(beat.id, true);
|
|
16847
|
-
this.highlightedBeats.push(beat);
|
|
16857
|
+
this.highlightedBeats.push(new BeatTickLookupItem(beat, playbackStart, playbackDuration));
|
|
16848
16858
|
}
|
|
16849
16859
|
}
|
|
16850
16860
|
/**
|
|
@@ -16854,8 +16864,8 @@ class BeatTickLookup {
|
|
|
16854
16864
|
*/
|
|
16855
16865
|
getVisibleBeatAtStart(visibleTracks) {
|
|
16856
16866
|
for (const b of this.highlightedBeats) {
|
|
16857
|
-
if (b.playbackStart == this.start && visibleTracks.has(b.voice.bar.staff.track.index)) {
|
|
16858
|
-
return b;
|
|
16867
|
+
if (b.playbackStart == this.start && visibleTracks.has(b.beat.voice.bar.staff.track.index)) {
|
|
16868
|
+
return b.beat;
|
|
16859
16869
|
}
|
|
16860
16870
|
}
|
|
16861
16871
|
return null;
|
|
@@ -16885,6 +16895,10 @@ class MasterBarTickLookup {
|
|
|
16885
16895
|
* Gets or sets the {@link MasterBarTickLookup} of the next masterbar in the {@link Score}
|
|
16886
16896
|
*/
|
|
16887
16897
|
this.nextMasterBar = null;
|
|
16898
|
+
/**
|
|
16899
|
+
* Gets or sets the {@link MasterBarTickLookup} of the previous masterbar in the {@link Score}
|
|
16900
|
+
*/
|
|
16901
|
+
this.previousMasterBar = null;
|
|
16888
16902
|
}
|
|
16889
16903
|
/**
|
|
16890
16904
|
* Inserts `newNextBeat` after `currentBeat` in the linked list of items and updates.
|
|
@@ -17032,7 +17046,7 @@ class MasterBarTickLookup {
|
|
|
17032
17046
|
// Variant A
|
|
17033
17047
|
if (this.firstBeat == null) {
|
|
17034
17048
|
const n1 = new BeatTickLookup(start, end);
|
|
17035
|
-
n1.highlightBeat(beat);
|
|
17049
|
+
n1.highlightBeat(beat, start, duration);
|
|
17036
17050
|
this.insertAfter(this.firstBeat, n1);
|
|
17037
17051
|
}
|
|
17038
17052
|
// Variant B
|
|
@@ -17040,7 +17054,7 @@ class MasterBarTickLookup {
|
|
|
17040
17054
|
else if (start >= this.lastBeat.end) {
|
|
17041
17055
|
// using the end here allows merge of B & C
|
|
17042
17056
|
const n1 = new BeatTickLookup(this.lastBeat.end, end);
|
|
17043
|
-
n1.highlightBeat(beat);
|
|
17057
|
+
n1.highlightBeat(beat, start, duration);
|
|
17044
17058
|
this.insertAfter(this.lastBeat, n1);
|
|
17045
17059
|
}
|
|
17046
17060
|
else {
|
|
@@ -17071,34 +17085,34 @@ class MasterBarTickLookup {
|
|
|
17071
17085
|
if (end == l1.start) {
|
|
17072
17086
|
// using firstBeat.start here allows merge of D & E
|
|
17073
17087
|
const n1 = new BeatTickLookup(start, l1.start);
|
|
17074
|
-
n1.highlightBeat(beat);
|
|
17088
|
+
n1.highlightBeat(beat, start, duration);
|
|
17075
17089
|
this.insertBefore(this.firstBeat, n1);
|
|
17076
17090
|
}
|
|
17077
17091
|
// Variant F
|
|
17078
17092
|
else if (end < l1.end) {
|
|
17079
17093
|
const n1 = new BeatTickLookup(start, l1.start);
|
|
17080
|
-
n1.highlightBeat(beat);
|
|
17094
|
+
n1.highlightBeat(beat, start, duration);
|
|
17081
17095
|
this.insertBefore(l1, n1);
|
|
17082
17096
|
const n2 = new BeatTickLookup(l1.start, end);
|
|
17083
17097
|
for (const b of l1.highlightedBeats) {
|
|
17084
|
-
n2.highlightBeat(b);
|
|
17098
|
+
n2.highlightBeat(b.beat, b.playbackStart, b.playbackDuration);
|
|
17085
17099
|
}
|
|
17086
|
-
n2.highlightBeat(beat);
|
|
17100
|
+
n2.highlightBeat(beat, start, duration);
|
|
17087
17101
|
this.insertBefore(l1, n2);
|
|
17088
17102
|
l1.start = end;
|
|
17089
17103
|
}
|
|
17090
17104
|
// Variant G
|
|
17091
17105
|
else if (end == l1.end) {
|
|
17092
17106
|
const n1 = new BeatTickLookup(start, l1.start);
|
|
17093
|
-
n1.highlightBeat(beat);
|
|
17094
|
-
l1.highlightBeat(beat);
|
|
17107
|
+
n1.highlightBeat(beat, start, duration);
|
|
17108
|
+
l1.highlightBeat(beat, start, duration);
|
|
17095
17109
|
this.insertBefore(l1, n1);
|
|
17096
17110
|
}
|
|
17097
17111
|
// Variant H
|
|
17098
17112
|
else /* end > this.firstBeat.end */ {
|
|
17099
17113
|
const n1 = new BeatTickLookup(start, l1.start);
|
|
17100
|
-
n1.highlightBeat(beat);
|
|
17101
|
-
l1.highlightBeat(beat);
|
|
17114
|
+
n1.highlightBeat(beat, start, duration);
|
|
17115
|
+
l1.highlightBeat(beat, start, duration);
|
|
17102
17116
|
this.insertBefore(l1, n1);
|
|
17103
17117
|
this.addBeat(beat, l1.end, end - l1.end);
|
|
17104
17118
|
}
|
|
@@ -17108,10 +17122,10 @@ class MasterBarTickLookup {
|
|
|
17108
17122
|
if (end == l1.end) {
|
|
17109
17123
|
const n1 = new BeatTickLookup(l1.start, start);
|
|
17110
17124
|
for (const b of l1.highlightedBeats) {
|
|
17111
|
-
n1.highlightBeat(b);
|
|
17125
|
+
n1.highlightBeat(b.beat, b.playbackStart, b.playbackDuration);
|
|
17112
17126
|
}
|
|
17113
17127
|
l1.start = start;
|
|
17114
|
-
l1.highlightBeat(beat);
|
|
17128
|
+
l1.highlightBeat(beat, start, duration);
|
|
17115
17129
|
this.insertBefore(l1, n1);
|
|
17116
17130
|
}
|
|
17117
17131
|
// Variant J
|
|
@@ -17121,20 +17135,20 @@ class MasterBarTickLookup {
|
|
|
17121
17135
|
const n2 = new BeatTickLookup(start, end);
|
|
17122
17136
|
this.insertBefore(l1, n2);
|
|
17123
17137
|
for (const b of l1.highlightedBeats) {
|
|
17124
|
-
n1.highlightBeat(b);
|
|
17125
|
-
n2.highlightBeat(b);
|
|
17138
|
+
n1.highlightBeat(b.beat, b.playbackStart, b.playbackDuration);
|
|
17139
|
+
n2.highlightBeat(b.beat, b.playbackStart, b.playbackDuration);
|
|
17126
17140
|
}
|
|
17127
|
-
n2.highlightBeat(beat);
|
|
17141
|
+
n2.highlightBeat(beat, start, duration);
|
|
17128
17142
|
l1.start = end;
|
|
17129
17143
|
}
|
|
17130
17144
|
// Variant K
|
|
17131
17145
|
else /* end > l1.end */ {
|
|
17132
17146
|
const n1 = new BeatTickLookup(l1.start, start);
|
|
17133
17147
|
for (const b of l1.highlightedBeats) {
|
|
17134
|
-
n1.highlightBeat(b);
|
|
17148
|
+
n1.highlightBeat(b.beat, b.playbackStart, b.playbackDuration);
|
|
17135
17149
|
}
|
|
17136
17150
|
l1.start = start;
|
|
17137
|
-
l1.highlightBeat(beat);
|
|
17151
|
+
l1.highlightBeat(beat, start, duration);
|
|
17138
17152
|
this.insertBefore(l1, n1);
|
|
17139
17153
|
this.addBeat(beat, l1.end, end - l1.end);
|
|
17140
17154
|
}
|
|
@@ -17142,21 +17156,21 @@ class MasterBarTickLookup {
|
|
|
17142
17156
|
else /* start == l1.start */ {
|
|
17143
17157
|
// Variant L
|
|
17144
17158
|
if (end === l1.end) {
|
|
17145
|
-
l1.highlightBeat(beat);
|
|
17159
|
+
l1.highlightBeat(beat, start, end);
|
|
17146
17160
|
}
|
|
17147
17161
|
// Variant M
|
|
17148
17162
|
else if (end < l1.end) {
|
|
17149
17163
|
const n1 = new BeatTickLookup(l1.start, end);
|
|
17150
17164
|
for (const b of l1.highlightedBeats) {
|
|
17151
|
-
n1.highlightBeat(b);
|
|
17165
|
+
n1.highlightBeat(b.beat, b.playbackStart, b.playbackDuration);
|
|
17152
17166
|
}
|
|
17153
|
-
n1.highlightBeat(beat);
|
|
17167
|
+
n1.highlightBeat(beat, start, duration);
|
|
17154
17168
|
l1.start = end;
|
|
17155
17169
|
this.insertBefore(l1, n1);
|
|
17156
17170
|
}
|
|
17157
17171
|
// variant N
|
|
17158
17172
|
else /* end > l1.end */ {
|
|
17159
|
-
l1.highlightBeat(beat);
|
|
17173
|
+
l1.highlightBeat(beat, start, duration);
|
|
17160
17174
|
this.addBeat(beat, l1.end, end - l1.end);
|
|
17161
17175
|
}
|
|
17162
17176
|
}
|
|
@@ -17282,6 +17296,11 @@ class MidiTickLookup {
|
|
|
17282
17296
|
current.tickDuration = current.nextBeat.start - current.start;
|
|
17283
17297
|
current.duration = MidiUtils.ticksToMillis(current.tickDuration, current.masterBar.tempo);
|
|
17284
17298
|
}
|
|
17299
|
+
// no next beat, animate to the end of the bar (could be an incomplete bar)
|
|
17300
|
+
if (!current.nextBeat) {
|
|
17301
|
+
current.tickDuration = current.masterBar.end - current.start;
|
|
17302
|
+
current.duration = MidiUtils.ticksToMillis(current.tickDuration, current.masterBar.tempo);
|
|
17303
|
+
}
|
|
17285
17304
|
}
|
|
17286
17305
|
findBeatSlow(trackLookup, currentBeatHint, tick, isNextSearch) {
|
|
17287
17306
|
// get all beats within the masterbar
|
|
@@ -17329,7 +17348,7 @@ class MidiTickLookup {
|
|
|
17329
17348
|
* @returns
|
|
17330
17349
|
*/
|
|
17331
17350
|
findBeatInMasterBar(masterBar, currentStartLookup, tick, visibleTracks, fillNext, isNextSeach) {
|
|
17332
|
-
var _a;
|
|
17351
|
+
var _a, _b, _c;
|
|
17333
17352
|
if (!currentStartLookup) {
|
|
17334
17353
|
return null;
|
|
17335
17354
|
}
|
|
@@ -17344,23 +17363,39 @@ class MidiTickLookup {
|
|
|
17344
17363
|
// in this case scan further to the next lookup which has any visible beat
|
|
17345
17364
|
if (!startBeat) {
|
|
17346
17365
|
if (isNextSeach) {
|
|
17347
|
-
|
|
17348
|
-
|
|
17349
|
-
|
|
17350
|
-
|
|
17351
|
-
|
|
17366
|
+
let currentMasterBar = masterBar;
|
|
17367
|
+
while (currentMasterBar != null && startBeat == null) {
|
|
17368
|
+
while (currentStartLookup != null) {
|
|
17369
|
+
startBeat = currentStartLookup.getVisibleBeatAtStart(visibleTracks);
|
|
17370
|
+
if (startBeat) {
|
|
17371
|
+
startBeatLookup = currentStartLookup;
|
|
17372
|
+
masterBar = currentMasterBar;
|
|
17373
|
+
break;
|
|
17374
|
+
}
|
|
17375
|
+
currentStartLookup = currentStartLookup.nextBeat;
|
|
17376
|
+
}
|
|
17377
|
+
if (!startBeat || !startBeatLookup) {
|
|
17378
|
+
currentMasterBar = currentMasterBar.nextMasterBar;
|
|
17379
|
+
currentStartLookup = (_a = currentMasterBar === null || currentMasterBar === void 0 ? void 0 : currentMasterBar.firstBeat) !== null && _a !== void 0 ? _a : null;
|
|
17352
17380
|
}
|
|
17353
|
-
currentStartLookup = currentStartLookup.nextBeat;
|
|
17354
17381
|
}
|
|
17355
17382
|
}
|
|
17356
17383
|
else {
|
|
17357
|
-
|
|
17358
|
-
|
|
17359
|
-
|
|
17360
|
-
|
|
17361
|
-
|
|
17384
|
+
let currentMasterBar = masterBar;
|
|
17385
|
+
while (currentMasterBar != null && startBeat == null) {
|
|
17386
|
+
while (currentStartLookup != null) {
|
|
17387
|
+
startBeat = currentStartLookup.getVisibleBeatAtStart(visibleTracks);
|
|
17388
|
+
if (startBeat) {
|
|
17389
|
+
startBeatLookup = currentStartLookup;
|
|
17390
|
+
masterBar = currentMasterBar;
|
|
17391
|
+
break;
|
|
17392
|
+
}
|
|
17393
|
+
currentStartLookup = currentStartLookup.previousBeat;
|
|
17394
|
+
}
|
|
17395
|
+
if (!startBeat || !startBeatLookup) {
|
|
17396
|
+
currentMasterBar = currentMasterBar.previousMasterBar;
|
|
17397
|
+
currentStartLookup = (_b = currentMasterBar === null || currentMasterBar === void 0 ? void 0 : currentMasterBar.firstBeat) !== null && _b !== void 0 ? _b : null;
|
|
17362
17398
|
}
|
|
17363
|
-
currentStartLookup = currentStartLookup.previousBeat;
|
|
17364
17399
|
}
|
|
17365
17400
|
}
|
|
17366
17401
|
}
|
|
@@ -17368,7 +17403,7 @@ class MidiTickLookup {
|
|
|
17368
17403
|
else if (currentStartLookup.end > relativeTick) {
|
|
17369
17404
|
break;
|
|
17370
17405
|
}
|
|
17371
|
-
currentStartLookup = (
|
|
17406
|
+
currentStartLookup = (_c = currentStartLookup === null || currentStartLookup === void 0 ? void 0 : currentStartLookup.nextBeat) !== null && _c !== void 0 ? _c : null;
|
|
17372
17407
|
}
|
|
17373
17408
|
if (startBeat == null) {
|
|
17374
17409
|
return null;
|
|
@@ -17450,6 +17485,7 @@ class MidiTickLookup {
|
|
|
17450
17485
|
addMasterBar(masterBar) {
|
|
17451
17486
|
this.masterBars.push(masterBar);
|
|
17452
17487
|
if (this._currentMasterBar) {
|
|
17488
|
+
masterBar.previousMasterBar = this._currentMasterBar;
|
|
17453
17489
|
this._currentMasterBar.nextMasterBar = masterBar;
|
|
17454
17490
|
}
|
|
17455
17491
|
this._currentMasterBar = masterBar;
|
|
@@ -19513,16 +19549,13 @@ class MidiFileGenerator {
|
|
|
19513
19549
|
}
|
|
19514
19550
|
}
|
|
19515
19551
|
}
|
|
19516
|
-
const realTickOffset = !beat.nextBeat
|
|
19517
|
-
? audioDuration
|
|
19518
|
-
: beat.nextBeat.absolutePlaybackStart - beat.absolutePlaybackStart;
|
|
19519
19552
|
// in case of normal playback register playback
|
|
19520
19553
|
if (realBar === beat.voice.bar) {
|
|
19521
|
-
this.tickLookup.addBeat(beat, beatStart,
|
|
19554
|
+
this.tickLookup.addBeat(beat, beatStart, audioDuration);
|
|
19522
19555
|
}
|
|
19523
19556
|
else {
|
|
19524
19557
|
// in case of simile marks where we repeat we also register
|
|
19525
|
-
this.tickLookup.addBeat(beat, 0,
|
|
19558
|
+
this.tickLookup.addBeat(beat, 0, audioDuration);
|
|
19526
19559
|
}
|
|
19527
19560
|
const track = beat.voice.bar.staff.track;
|
|
19528
19561
|
for (const automation of beat.automations) {
|
|
@@ -26130,7 +26163,7 @@ class AlphaTabApiBase {
|
|
|
26130
26163
|
if (this._playerState === PlayerState.Playing && !stop) {
|
|
26131
26164
|
if (this.settings.player.enableElementHighlighting) {
|
|
26132
26165
|
for (let highlight of beatsToHighlight) {
|
|
26133
|
-
let className = BeatContainerGlyph.getGroupId(highlight);
|
|
26166
|
+
let className = BeatContainerGlyph.getGroupId(highlight.beat);
|
|
26134
26167
|
this.uiFacade.highlightElements(className, beat.voice.bar.index);
|
|
26135
26168
|
}
|
|
26136
26169
|
}
|
|
@@ -26164,7 +26197,7 @@ class AlphaTabApiBase {
|
|
|
26164
26197
|
// trigger an event for others to indicate which beat/bar is played
|
|
26165
26198
|
if (shouldNotifyBeatChange) {
|
|
26166
26199
|
this.onPlayedBeatChanged(beat);
|
|
26167
|
-
this.onActiveBeatsChanged(new ActiveBeatsChangedEventArgs(beatsToHighlight));
|
|
26200
|
+
this.onActiveBeatsChanged(new ActiveBeatsChangedEventArgs(beatsToHighlight.map(i => i.beat)));
|
|
26168
26201
|
}
|
|
26169
26202
|
}
|
|
26170
26203
|
onPlayedBeatChanged(beat) {
|
|
@@ -42793,8 +42826,8 @@ class CoreSettings {
|
|
|
42793
42826
|
// </auto-generated>
|
|
42794
42827
|
class VersionInfo {
|
|
42795
42828
|
}
|
|
42796
|
-
VersionInfo.version = '1.3.0-alpha.
|
|
42797
|
-
VersionInfo.date = '
|
|
42829
|
+
VersionInfo.version = '1.3.0-alpha.876';
|
|
42830
|
+
VersionInfo.date = '2024-01-01T01:36:47.681Z';
|
|
42798
42831
|
|
|
42799
42832
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
42800
42833
|
__proto__: null,
|