@coderline/alphatab 1.3.0-alpha.285 → 1.3.0-alpha.299
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 +38 -4
- package/dist/alphaTab.js +226 -102
- package/dist/alphaTab.min.js +2 -2
- package/dist/alphaTab.min.mjs +2 -2
- package/dist/alphaTab.mjs +226 -102
- package/package.json +4 -4
package/dist/alphaTab.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* alphaTab v1.3.0-alpha.
|
|
2
|
+
* alphaTab v1.3.0-alpha.299 (develop, build 299)
|
|
3
3
|
*
|
|
4
4
|
* Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
5
|
*
|
|
@@ -4389,9 +4389,7 @@
|
|
|
4389
4389
|
let duration = 0;
|
|
4390
4390
|
for (let track of this.score.tracks) {
|
|
4391
4391
|
for (let staff of track.staves) {
|
|
4392
|
-
let barDuration = this.index < staff.bars.length
|
|
4393
|
-
? staff.bars[this.index].calculateDuration()
|
|
4394
|
-
: 0;
|
|
4392
|
+
let barDuration = this.index < staff.bars.length ? staff.bars[this.index].calculateDuration() : 0;
|
|
4395
4393
|
if (barDuration > duration) {
|
|
4396
4394
|
duration = barDuration;
|
|
4397
4395
|
}
|
|
@@ -4457,39 +4455,39 @@
|
|
|
4457
4455
|
*/
|
|
4458
4456
|
this.masterBars = [];
|
|
4459
4457
|
/**
|
|
4460
|
-
*
|
|
4458
|
+
* the masterbars which opens the group.
|
|
4461
4459
|
*/
|
|
4462
|
-
this.
|
|
4460
|
+
this.opening = null;
|
|
4463
4461
|
/**
|
|
4464
4462
|
* a list of masterbars which close the group.
|
|
4465
4463
|
*/
|
|
4466
4464
|
this.closings = [];
|
|
4467
|
-
/**
|
|
4468
|
-
* true if the repeat group was opened well
|
|
4469
|
-
*/
|
|
4470
|
-
this.isOpened = false;
|
|
4471
4465
|
/**
|
|
4472
4466
|
* true if the repeat group was closed well
|
|
4473
4467
|
*/
|
|
4474
4468
|
this.isClosed = false;
|
|
4475
4469
|
}
|
|
4470
|
+
/**
|
|
4471
|
+
* a list of masterbars which open the group.
|
|
4472
|
+
* @deprecated There can only be one opening, use the opening property instead
|
|
4473
|
+
*/
|
|
4474
|
+
get openings() {
|
|
4475
|
+
const opening = this.opening;
|
|
4476
|
+
return opening ? [opening] : [];
|
|
4477
|
+
}
|
|
4478
|
+
/**
|
|
4479
|
+
* Gets whether this repeat group is really opened as a repeat.
|
|
4480
|
+
*/
|
|
4481
|
+
get isOpened() { var _a; return ((_a = this.opening) === null || _a === void 0 ? void 0 : _a.isRepeatStart) === true; }
|
|
4476
4482
|
addMasterBar(masterBar) {
|
|
4477
|
-
if (this.
|
|
4478
|
-
this.
|
|
4483
|
+
if (this.opening === null) {
|
|
4484
|
+
this.opening = masterBar;
|
|
4479
4485
|
}
|
|
4480
4486
|
this.masterBars.push(masterBar);
|
|
4481
4487
|
masterBar.repeatGroup = this;
|
|
4482
4488
|
if (masterBar.isRepeatEnd) {
|
|
4483
4489
|
this.closings.push(masterBar);
|
|
4484
4490
|
this.isClosed = true;
|
|
4485
|
-
if (!this.isOpened) {
|
|
4486
|
-
this.masterBars[0].isRepeatStart = true;
|
|
4487
|
-
this.isOpened = true;
|
|
4488
|
-
}
|
|
4489
|
-
}
|
|
4490
|
-
else if (this.isClosed) {
|
|
4491
|
-
this.isClosed = false;
|
|
4492
|
-
this.openings.push(masterBar);
|
|
4493
4491
|
}
|
|
4494
4492
|
}
|
|
4495
4493
|
}
|
|
@@ -4503,7 +4501,9 @@
|
|
|
4503
4501
|
*/
|
|
4504
4502
|
class Score {
|
|
4505
4503
|
constructor() {
|
|
4506
|
-
this._currentRepeatGroup =
|
|
4504
|
+
this._currentRepeatGroup = null;
|
|
4505
|
+
this._openedRepeatGroups = [];
|
|
4506
|
+
this._properlyOpenedRepeatGroups = 0;
|
|
4507
4507
|
/**
|
|
4508
4508
|
* The album of this song.
|
|
4509
4509
|
*/
|
|
@@ -4568,15 +4568,11 @@
|
|
|
4568
4568
|
this.stylesheet = new RenderStylesheet();
|
|
4569
4569
|
}
|
|
4570
4570
|
rebuildRepeatGroups() {
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
if (bar.isRepeatStart || (this._currentRepeatGroup.isClosed && bar.alternateEndings <= 0)) {
|
|
4577
|
-
currentGroup = new RepeatGroup();
|
|
4578
|
-
}
|
|
4579
|
-
currentGroup.addMasterBar(bar);
|
|
4571
|
+
this._currentRepeatGroup = null;
|
|
4572
|
+
this._openedRepeatGroups = [];
|
|
4573
|
+
this._properlyOpenedRepeatGroups = 0;
|
|
4574
|
+
for (const bar of this.masterBars) {
|
|
4575
|
+
this.addMasterBarToRepeatGroups(bar);
|
|
4580
4576
|
}
|
|
4581
4577
|
}
|
|
4582
4578
|
addMasterBar(bar) {
|
|
@@ -4592,14 +4588,54 @@
|
|
|
4592
4588
|
bar.previousMasterBar.start +
|
|
4593
4589
|
(bar.previousMasterBar.isAnacrusis ? 0 : bar.previousMasterBar.calculateDuration());
|
|
4594
4590
|
}
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4591
|
+
this.addMasterBarToRepeatGroups(bar);
|
|
4592
|
+
this.masterBars.push(bar);
|
|
4593
|
+
}
|
|
4594
|
+
/**
|
|
4595
|
+
* Adds the given bar correctly into the current repeat group setup.
|
|
4596
|
+
* @param bar
|
|
4597
|
+
*/
|
|
4598
|
+
addMasterBarToRepeatGroups(bar) {
|
|
4599
|
+
// handling the repeats is quite tricky due to many invalid combinations a user might define
|
|
4600
|
+
// there are also some complexities due to nested repeats and repeats with multiple endings but only one opening.
|
|
4601
|
+
// all scenarios are handled below.
|
|
4602
|
+
var _a;
|
|
4603
|
+
// NOTE: In all paths we need to ensure that the bar is added to some repeat group
|
|
4604
|
+
// start a new repeat group if really a repeat is started
|
|
4605
|
+
// or we don't have a group.
|
|
4606
|
+
if (bar.isRepeatStart) {
|
|
4607
|
+
// if the current group was already closed (this opening doesn't cause nesting)
|
|
4608
|
+
// we consider the group as completed
|
|
4609
|
+
if ((_a = this._currentRepeatGroup) === null || _a === void 0 ? void 0 : _a.isClosed) {
|
|
4610
|
+
this._openedRepeatGroups.pop();
|
|
4611
|
+
this._properlyOpenedRepeatGroups--;
|
|
4612
|
+
}
|
|
4613
|
+
this._currentRepeatGroup = new RepeatGroup();
|
|
4614
|
+
this._openedRepeatGroups.push(this._currentRepeatGroup);
|
|
4615
|
+
this._properlyOpenedRepeatGroups++;
|
|
4616
|
+
}
|
|
4617
|
+
else if (!this._currentRepeatGroup) {
|
|
4599
4618
|
this._currentRepeatGroup = new RepeatGroup();
|
|
4619
|
+
this._openedRepeatGroups.push(this._currentRepeatGroup);
|
|
4600
4620
|
}
|
|
4621
|
+
// close current group if there was one started
|
|
4601
4622
|
this._currentRepeatGroup.addMasterBar(bar);
|
|
4602
|
-
|
|
4623
|
+
// handle repeat ends
|
|
4624
|
+
if (bar.isRepeatEnd) {
|
|
4625
|
+
// if we have nested repeat groups a repeat end
|
|
4626
|
+
// will treat the group as completed
|
|
4627
|
+
if (this._properlyOpenedRepeatGroups > 1) {
|
|
4628
|
+
this._openedRepeatGroups.pop();
|
|
4629
|
+
this._properlyOpenedRepeatGroups--;
|
|
4630
|
+
// restore outer group in cases like "open open close close"
|
|
4631
|
+
this._currentRepeatGroup =
|
|
4632
|
+
this._openedRepeatGroups.length > 0
|
|
4633
|
+
? this._openedRepeatGroups[this._openedRepeatGroups.length - 1]
|
|
4634
|
+
: null;
|
|
4635
|
+
}
|
|
4636
|
+
// else: if only one group is opened, this group stays active for
|
|
4637
|
+
// scenarios like open close bar close
|
|
4638
|
+
}
|
|
4603
4639
|
}
|
|
4604
4640
|
addTrack(track) {
|
|
4605
4641
|
track.score = this;
|
|
@@ -12894,7 +12930,6 @@
|
|
|
12894
12930
|
this.mergePartGroups();
|
|
12895
12931
|
}
|
|
12896
12932
|
this._score.finish(this.settings);
|
|
12897
|
-
// the structure of MusicXML does not allow live creation of the groups,
|
|
12898
12933
|
this._score.rebuildRepeatGroups();
|
|
12899
12934
|
return this._score;
|
|
12900
12935
|
}
|
|
@@ -13622,6 +13657,11 @@
|
|
|
13622
13657
|
if (!slurNumber) {
|
|
13623
13658
|
slurNumber = '1';
|
|
13624
13659
|
}
|
|
13660
|
+
// slur numbers are unique in the way that they have the same ID across
|
|
13661
|
+
// staffs/tracks etc. as long they represent the logically same slur.
|
|
13662
|
+
// but in our case it must be globally unique to link the correct notes.
|
|
13663
|
+
// adding the staff ID should be enough to achieve this
|
|
13664
|
+
slurNumber = beat.voice.bar.staff.index + '_' + slurNumber;
|
|
13625
13665
|
switch (c.getAttribute('type')) {
|
|
13626
13666
|
case 'start':
|
|
13627
13667
|
this._slurStarts.set(slurNumber, note);
|
|
@@ -13631,7 +13671,7 @@
|
|
|
13631
13671
|
note.isSlurDestination = true;
|
|
13632
13672
|
let slurStart = this._slurStarts.get(slurNumber);
|
|
13633
13673
|
slurStart.slurDestination = note;
|
|
13634
|
-
note.slurOrigin =
|
|
13674
|
+
note.slurOrigin = slurStart;
|
|
13635
13675
|
}
|
|
13636
13676
|
break;
|
|
13637
13677
|
}
|
|
@@ -22383,11 +22423,24 @@
|
|
|
22383
22423
|
//PolyMode = 0x7F
|
|
22384
22424
|
})(ControllerType || (ControllerType = {}));
|
|
22385
22425
|
|
|
22426
|
+
/**
|
|
22427
|
+
* Helper container to handle repeats correctly
|
|
22428
|
+
*/
|
|
22429
|
+
class Repeat {
|
|
22430
|
+
constructor(group, opening) {
|
|
22431
|
+
this.closingIndex = 0;
|
|
22432
|
+
this.group = group;
|
|
22433
|
+
this.opening = opening;
|
|
22434
|
+
// sort ascending according to index
|
|
22435
|
+
group.closings = group.closings.sort((a, b) => a.index - b.index);
|
|
22436
|
+
this.iterations = group.closings.map(_ => 0);
|
|
22437
|
+
}
|
|
22438
|
+
}
|
|
22386
22439
|
class MidiPlaybackController {
|
|
22387
22440
|
constructor(score) {
|
|
22388
|
-
this.
|
|
22389
|
-
this.
|
|
22390
|
-
this.
|
|
22441
|
+
this._repeatStack = [];
|
|
22442
|
+
this._groupsOnStack = new Set();
|
|
22443
|
+
this._previousAlternateEndings = 0;
|
|
22391
22444
|
this.shouldPlay = true;
|
|
22392
22445
|
this.index = 0;
|
|
22393
22446
|
this.currentTick = 0;
|
|
@@ -22398,25 +22451,32 @@
|
|
|
22398
22451
|
}
|
|
22399
22452
|
processCurrent() {
|
|
22400
22453
|
const masterBar = this._score.masterBars[this.index];
|
|
22401
|
-
|
|
22402
|
-
// if
|
|
22403
|
-
//
|
|
22404
|
-
if (
|
|
22405
|
-
|
|
22406
|
-
|
|
22407
|
-
|
|
22408
|
-
|
|
22409
|
-
|
|
22410
|
-
this.
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22454
|
+
let masterBarAlternateEndings = masterBar.alternateEndings;
|
|
22455
|
+
// if there are no alternate endings set on this bar. take the ones
|
|
22456
|
+
// from the previously played bar which had alternate endings
|
|
22457
|
+
if (masterBarAlternateEndings === 0) {
|
|
22458
|
+
masterBarAlternateEndings = this._previousAlternateEndings;
|
|
22459
|
+
}
|
|
22460
|
+
// Repeat start (only properly closed ones)
|
|
22461
|
+
if (masterBar === masterBar.repeatGroup.opening && masterBar.repeatGroup.isClosed) {
|
|
22462
|
+
// first encounter of the repeat group? -> initialize repeats accordingly
|
|
22463
|
+
if (!this._groupsOnStack.has(masterBar.repeatGroup)) {
|
|
22464
|
+
const repeat = new Repeat(masterBar.repeatGroup, masterBar);
|
|
22465
|
+
this._repeatStack.push(repeat);
|
|
22466
|
+
this._groupsOnStack.add(masterBar.repeatGroup);
|
|
22467
|
+
this._previousAlternateEndings = 0;
|
|
22468
|
+
}
|
|
22469
|
+
}
|
|
22470
|
+
// if we're not within repeats or not alternative endings set -> simply play
|
|
22471
|
+
if (this._repeatStack.length === 0 || masterBarAlternateEndings === 0) {
|
|
22414
22472
|
this.shouldPlay = true;
|
|
22415
22473
|
}
|
|
22416
|
-
|
|
22417
|
-
|
|
22474
|
+
else {
|
|
22475
|
+
const repeat = this._repeatStack[this._repeatStack.length - 1];
|
|
22476
|
+
const iteration = repeat.iterations[repeat.closingIndex];
|
|
22477
|
+
this._previousAlternateEndings = masterBarAlternateEndings;
|
|
22418
22478
|
// do we need to skip this section?
|
|
22419
|
-
if ((masterBarAlternateEndings & (1 <<
|
|
22479
|
+
if ((masterBarAlternateEndings & (1 << iteration)) === 0) {
|
|
22420
22480
|
this.shouldPlay = false;
|
|
22421
22481
|
}
|
|
22422
22482
|
else {
|
|
@@ -22430,23 +22490,42 @@
|
|
|
22430
22490
|
moveNext() {
|
|
22431
22491
|
const masterBar = this._score.masterBars[this.index];
|
|
22432
22492
|
const masterBarRepeatCount = masterBar.repeatCount - 1;
|
|
22433
|
-
// if we encounter a repeat end
|
|
22434
|
-
if (this.
|
|
22435
|
-
// more repeats required?
|
|
22436
|
-
|
|
22493
|
+
// if we encounter a repeat end...
|
|
22494
|
+
if (this._repeatStack.length > 0 && masterBarRepeatCount > 0) {
|
|
22495
|
+
// ...more repeats required?
|
|
22496
|
+
const repeat = this._repeatStack[this._repeatStack.length - 1];
|
|
22497
|
+
const iteration = repeat.iterations[repeat.closingIndex];
|
|
22498
|
+
// -> if yes, increase the iteration and jump back to start
|
|
22499
|
+
if (iteration < masterBarRepeatCount) {
|
|
22437
22500
|
// jump to start
|
|
22438
|
-
this.index =
|
|
22439
|
-
|
|
22501
|
+
this.index = repeat.opening.index;
|
|
22502
|
+
repeat.iterations[repeat.closingIndex]++;
|
|
22503
|
+
// clear iterations for previous closings and start over all repeats
|
|
22504
|
+
// this ensures on scenarios like "open, bar, close, bar, close"
|
|
22505
|
+
// that the second close will repeat again the first repeat.
|
|
22506
|
+
for (let i = 0; i < repeat.closingIndex; i++) {
|
|
22507
|
+
repeat.iterations[i] = 0;
|
|
22508
|
+
}
|
|
22509
|
+
repeat.closingIndex = 0;
|
|
22510
|
+
this._previousAlternateEndings = 0;
|
|
22440
22511
|
}
|
|
22441
22512
|
else {
|
|
22442
|
-
//
|
|
22443
|
-
|
|
22444
|
-
|
|
22445
|
-
|
|
22446
|
-
|
|
22513
|
+
// if we don't have further iterations left but we have additional closings in this group
|
|
22514
|
+
// proceed heading to the next close but keep the repeat group active
|
|
22515
|
+
if (repeat.closingIndex < repeat.group.closings.length - 1) {
|
|
22516
|
+
repeat.closingIndex++;
|
|
22517
|
+
this.index++; // go to next bar after current close
|
|
22518
|
+
}
|
|
22519
|
+
else {
|
|
22520
|
+
// if there are no further closings in the current group, we consider the current repeat done and handled
|
|
22521
|
+
this._repeatStack.pop();
|
|
22522
|
+
this._groupsOnStack.delete(repeat.group);
|
|
22523
|
+
this.index++; // go to next bar after current close
|
|
22524
|
+
}
|
|
22447
22525
|
}
|
|
22448
22526
|
}
|
|
22449
22527
|
else {
|
|
22528
|
+
// we have no started repeat, just proceed to next bar
|
|
22450
22529
|
this.index++;
|
|
22451
22530
|
}
|
|
22452
22531
|
}
|
|
@@ -24124,6 +24203,15 @@
|
|
|
24124
24203
|
}
|
|
24125
24204
|
}
|
|
24126
24205
|
|
|
24206
|
+
/**
|
|
24207
|
+
* Represents the information related to the beats actively being played now.
|
|
24208
|
+
*/
|
|
24209
|
+
class ActiveBeatsChangedEventArgs {
|
|
24210
|
+
constructor(activeBeats) {
|
|
24211
|
+
this.activeBeats = activeBeats;
|
|
24212
|
+
}
|
|
24213
|
+
}
|
|
24214
|
+
|
|
24127
24215
|
class SelectionInfo {
|
|
24128
24216
|
constructor(beat) {
|
|
24129
24217
|
this.bounds = null;
|
|
@@ -24171,6 +24259,7 @@
|
|
|
24171
24259
|
this._previousCursorCache = null;
|
|
24172
24260
|
this._lastScroll = 0;
|
|
24173
24261
|
this.playedBeatChanged = new EventEmitterOfT();
|
|
24262
|
+
this.activeBeatsChanged = new EventEmitterOfT();
|
|
24174
24263
|
this._beatMouseDown = false;
|
|
24175
24264
|
this._noteMouseDown = false;
|
|
24176
24265
|
this._selectionStart = null;
|
|
@@ -24196,6 +24285,10 @@
|
|
|
24196
24285
|
this.playerPositionChanged = new EventEmitterOfT();
|
|
24197
24286
|
this.midiEventsPlayed = new EventEmitterOfT();
|
|
24198
24287
|
this.playbackRangeChanged = new EventEmitterOfT();
|
|
24288
|
+
/**
|
|
24289
|
+
* @internal
|
|
24290
|
+
*/
|
|
24291
|
+
this.settingsUpdated = new EventEmitter();
|
|
24199
24292
|
this.uiFacade = uiFacade;
|
|
24200
24293
|
this.container = uiFacade.rootContainer;
|
|
24201
24294
|
uiFacade.initialize(this, settings);
|
|
@@ -24274,6 +24367,7 @@
|
|
|
24274
24367
|
else {
|
|
24275
24368
|
this.destroyPlayer();
|
|
24276
24369
|
}
|
|
24370
|
+
this.onSettingsUpdated();
|
|
24277
24371
|
}
|
|
24278
24372
|
/**
|
|
24279
24373
|
* Attempts a load of the score represented by the given data object.
|
|
@@ -24585,9 +24679,12 @@
|
|
|
24585
24679
|
}
|
|
24586
24680
|
this.player.destroy();
|
|
24587
24681
|
this.player = null;
|
|
24682
|
+
this._previousTick = 0;
|
|
24683
|
+
this._playerState = PlayerState.Paused;
|
|
24588
24684
|
this.destroyCursors();
|
|
24589
24685
|
}
|
|
24590
24686
|
setupPlayer() {
|
|
24687
|
+
this.updateCursors();
|
|
24591
24688
|
if (this.player) {
|
|
24592
24689
|
return;
|
|
24593
24690
|
}
|
|
@@ -24621,12 +24718,7 @@
|
|
|
24621
24718
|
this.player.midiEventsPlayed.on(this.onMidiEventsPlayed.bind(this));
|
|
24622
24719
|
this.player.playbackRangeChanged.on(this.onPlaybackRangeChanged.bind(this));
|
|
24623
24720
|
this.player.finished.on(this.onPlayerFinished.bind(this));
|
|
24624
|
-
|
|
24625
|
-
this.setupCursors();
|
|
24626
|
-
}
|
|
24627
|
-
else {
|
|
24628
|
-
this.destroyCursors();
|
|
24629
|
-
}
|
|
24721
|
+
this.setupPlayerEvents();
|
|
24630
24722
|
}
|
|
24631
24723
|
loadMidiForScore() {
|
|
24632
24724
|
if (!this.player || !this.score || !this.player.isReady) {
|
|
@@ -24760,21 +24852,28 @@
|
|
|
24760
24852
|
this._barCursor = null;
|
|
24761
24853
|
this._beatCursor = null;
|
|
24762
24854
|
this._selectionWrapper = null;
|
|
24763
|
-
this._previousTick = 0;
|
|
24764
|
-
this._playerState = PlayerState.Paused;
|
|
24765
24855
|
}
|
|
24766
|
-
|
|
24767
|
-
|
|
24768
|
-
|
|
24769
|
-
|
|
24770
|
-
|
|
24771
|
-
|
|
24856
|
+
updateCursors() {
|
|
24857
|
+
if (this.settings.player.enableCursor && !this._cursorWrapper) {
|
|
24858
|
+
//
|
|
24859
|
+
// Create cursors
|
|
24860
|
+
let cursors = this.uiFacade.createCursors();
|
|
24861
|
+
if (cursors) {
|
|
24862
|
+
// store options and created elements for fast access
|
|
24863
|
+
this._cursorWrapper = cursors.cursorWrapper;
|
|
24864
|
+
this._barCursor = cursors.barCursor;
|
|
24865
|
+
this._beatCursor = cursors.beatCursor;
|
|
24866
|
+
this._selectionWrapper = cursors.selectionWrapper;
|
|
24867
|
+
}
|
|
24868
|
+
if (this._currentBeat !== null) {
|
|
24869
|
+
this.cursorUpdateBeat(this._currentBeat, false, this._previousTick > 10, true);
|
|
24870
|
+
}
|
|
24871
|
+
}
|
|
24872
|
+
else if (!this.settings.player.enableCursor && this._cursorWrapper) {
|
|
24873
|
+
this.destroyCursors();
|
|
24772
24874
|
}
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
this._barCursor = cursors.barCursor;
|
|
24776
|
-
this._beatCursor = cursors.beatCursor;
|
|
24777
|
-
this._selectionWrapper = cursors.selectionWrapper;
|
|
24875
|
+
}
|
|
24876
|
+
setupPlayerEvents() {
|
|
24778
24877
|
//
|
|
24779
24878
|
// Hook into events
|
|
24780
24879
|
this._previousTick = 0;
|
|
@@ -24825,7 +24924,7 @@
|
|
|
24825
24924
|
/**
|
|
24826
24925
|
* updates the cursors to highlight the specified beat
|
|
24827
24926
|
*/
|
|
24828
|
-
cursorUpdateBeat(lookupResult, stop, shouldScroll) {
|
|
24927
|
+
cursorUpdateBeat(lookupResult, stop, shouldScroll, forceUpdate = false) {
|
|
24829
24928
|
const beat = lookupResult.currentBeat;
|
|
24830
24929
|
const nextBeat = lookupResult.nextBeat;
|
|
24831
24930
|
const duration = lookupResult.duration;
|
|
@@ -24840,7 +24939,10 @@
|
|
|
24840
24939
|
let previousBeat = this._currentBeat;
|
|
24841
24940
|
let previousCache = this._previousCursorCache;
|
|
24842
24941
|
let previousState = this._previousStateForCursor;
|
|
24843
|
-
if (
|
|
24942
|
+
if (!forceUpdate &&
|
|
24943
|
+
beat === (previousBeat === null || previousBeat === void 0 ? void 0 : previousBeat.currentBeat) &&
|
|
24944
|
+
cache === previousCache &&
|
|
24945
|
+
previousState === this._playerState) {
|
|
24844
24946
|
return;
|
|
24845
24947
|
}
|
|
24846
24948
|
let beatBoundings = cache.findBeat(beat);
|
|
@@ -24917,17 +25019,21 @@
|
|
|
24917
25019
|
}
|
|
24918
25020
|
}
|
|
24919
25021
|
internalCursorUpdateBeat(beat, nextBeat, duration, stop, beatsToHighlight, cache, beatBoundings, shouldScroll) {
|
|
24920
|
-
|
|
24921
|
-
|
|
25022
|
+
const barCursor = this._barCursor;
|
|
25023
|
+
const beatCursor = this._beatCursor;
|
|
24922
25024
|
let barBoundings = beatBoundings.barBounds.masterBarBounds;
|
|
24923
25025
|
let barBounds = barBoundings.visualBounds;
|
|
24924
25026
|
this._currentBarBounds = barBoundings;
|
|
24925
|
-
barCursor
|
|
24926
|
-
|
|
24927
|
-
|
|
24928
|
-
|
|
25027
|
+
if (barCursor) {
|
|
25028
|
+
barCursor.setBounds(barBounds.x, barBounds.y, barBounds.w, barBounds.h);
|
|
25029
|
+
}
|
|
25030
|
+
if (beatCursor) {
|
|
25031
|
+
// move beat to start position immediately
|
|
25032
|
+
if (this.settings.player.enableAnimatedBeatCursor) {
|
|
25033
|
+
beatCursor.stopAnimation();
|
|
25034
|
+
}
|
|
25035
|
+
beatCursor.setBounds(beatBoundings.visualBounds.x, barBounds.y, 1, barBounds.h);
|
|
24929
25036
|
}
|
|
24930
|
-
beatCursor.setBounds(beatBoundings.visualBounds.x, barBounds.y, 1, barBounds.h);
|
|
24931
25037
|
// if playing, animate the cursor to the next beat
|
|
24932
25038
|
if (this.settings.player.enableElementHighlighting) {
|
|
24933
25039
|
this.uiFacade.removeHighlights();
|
|
@@ -24935,7 +25041,7 @@
|
|
|
24935
25041
|
// actively playing? -> animate cursor and highlight items
|
|
24936
25042
|
let shouldNotifyBeatChange = false;
|
|
24937
25043
|
if (this._playerState === PlayerState.Playing && !stop) {
|
|
24938
|
-
if (this.settings.player.enableElementHighlighting
|
|
25044
|
+
if (this.settings.player.enableElementHighlighting) {
|
|
24939
25045
|
for (let highlight of beatsToHighlight) {
|
|
24940
25046
|
let className = BeatContainerGlyph.getGroupId(highlight);
|
|
24941
25047
|
this.uiFacade.highlightElements(className, beat.voice.bar.index);
|
|
@@ -24960,7 +25066,9 @@
|
|
|
24960
25066
|
// we need to put the transition to an own animation frame
|
|
24961
25067
|
// otherwise the stop animation above is not applied.
|
|
24962
25068
|
this.uiFacade.beginInvoke(() => {
|
|
24963
|
-
beatCursor
|
|
25069
|
+
if (beatCursor) {
|
|
25070
|
+
beatCursor.transitionToX(duration / this.playbackSpeed, nextBeatX);
|
|
25071
|
+
}
|
|
24964
25072
|
});
|
|
24965
25073
|
}
|
|
24966
25074
|
shouldScroll = !stop;
|
|
@@ -24972,6 +25080,7 @@
|
|
|
24972
25080
|
// trigger an event for others to indicate which beat/bar is played
|
|
24973
25081
|
if (shouldNotifyBeatChange) {
|
|
24974
25082
|
this.onPlayedBeatChanged(beat);
|
|
25083
|
+
this.onActiveBeatsChanged(new ActiveBeatsChangedEventArgs(beatsToHighlight));
|
|
24975
25084
|
}
|
|
24976
25085
|
}
|
|
24977
25086
|
onPlayedBeatChanged(beat) {
|
|
@@ -24981,6 +25090,13 @@
|
|
|
24981
25090
|
this.playedBeatChanged.trigger(beat);
|
|
24982
25091
|
this.uiFacade.triggerEvent(this.container, 'playedBeatChanged', beat);
|
|
24983
25092
|
}
|
|
25093
|
+
onActiveBeatsChanged(e) {
|
|
25094
|
+
if (this._isDestroyed) {
|
|
25095
|
+
return;
|
|
25096
|
+
}
|
|
25097
|
+
this.activeBeatsChanged.trigger(e);
|
|
25098
|
+
this.uiFacade.triggerEvent(this.container, 'activeBeatsChanged', e);
|
|
25099
|
+
}
|
|
24984
25100
|
onBeatMouseDown(originalEvent, beat) {
|
|
24985
25101
|
if (this._isDestroyed) {
|
|
24986
25102
|
return;
|
|
@@ -25340,6 +25456,13 @@
|
|
|
25340
25456
|
this.playbackRangeChanged.trigger(e);
|
|
25341
25457
|
this.uiFacade.triggerEvent(this.container, 'playbackRangeChanged', e);
|
|
25342
25458
|
}
|
|
25459
|
+
onSettingsUpdated() {
|
|
25460
|
+
if (this._isDestroyed) {
|
|
25461
|
+
return;
|
|
25462
|
+
}
|
|
25463
|
+
this.settingsUpdated.trigger();
|
|
25464
|
+
this.uiFacade.triggerEvent(this.container, 'settingsUpdated', null);
|
|
25465
|
+
}
|
|
25343
25466
|
}
|
|
25344
25467
|
|
|
25345
25468
|
/**
|
|
@@ -37405,13 +37528,13 @@
|
|
|
37405
37528
|
offsetClef = 1;
|
|
37406
37529
|
break;
|
|
37407
37530
|
case Clef.F4:
|
|
37408
|
-
offsetClef =
|
|
37531
|
+
offsetClef = 3;
|
|
37409
37532
|
break;
|
|
37410
37533
|
case Clef.C3:
|
|
37411
|
-
offsetClef =
|
|
37534
|
+
offsetClef = 2;
|
|
37412
37535
|
break;
|
|
37413
37536
|
case Clef.C4:
|
|
37414
|
-
offsetClef =
|
|
37537
|
+
offsetClef = 0;
|
|
37415
37538
|
break;
|
|
37416
37539
|
}
|
|
37417
37540
|
let newLines = new Map();
|
|
@@ -40861,8 +40984,8 @@
|
|
|
40861
40984
|
// </auto-generated>
|
|
40862
40985
|
class VersionInfo {
|
|
40863
40986
|
}
|
|
40864
|
-
VersionInfo.version = '1.3.0-alpha.
|
|
40865
|
-
VersionInfo.date = '2022-
|
|
40987
|
+
VersionInfo.version = '1.3.0-alpha.299';
|
|
40988
|
+
VersionInfo.date = '2022-06-14T00:55:03.699Z';
|
|
40866
40989
|
|
|
40867
40990
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
40868
40991
|
__proto__: null,
|
|
@@ -43931,6 +44054,7 @@
|
|
|
43931
44054
|
PlayerStateChangedEventArgs: PlayerStateChangedEventArgs,
|
|
43932
44055
|
PlaybackRangeChangedEventArgs: PlaybackRangeChangedEventArgs,
|
|
43933
44056
|
PositionChangedEventArgs: PositionChangedEventArgs,
|
|
44057
|
+
ActiveBeatsChangedEventArgs: ActiveBeatsChangedEventArgs,
|
|
43934
44058
|
AlphaSynthWebWorkerApi: AlphaSynthWebWorkerApi
|
|
43935
44059
|
});
|
|
43936
44060
|
|