@coderline/alphatab 1.6.0 → 1.6.2
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.core.min.mjs +2 -2
- package/dist/alphaTab.core.mjs +156 -206
- package/dist/alphaTab.d.ts +63 -20
- package/dist/alphaTab.js +156 -206
- package/dist/alphaTab.min.js +2 -2
- package/dist/alphaTab.min.mjs +1 -1
- package/dist/alphaTab.mjs +1 -1
- package/dist/alphaTab.vite.js +1 -1
- package/dist/alphaTab.vite.mjs +1 -1
- package/dist/alphaTab.webpack.js +1 -1
- package/dist/alphaTab.webpack.mjs +1 -1
- package/dist/alphaTab.worker.min.mjs +1 -1
- package/dist/alphaTab.worker.mjs +1 -1
- package/dist/alphaTab.worklet.min.mjs +1 -1
- package/dist/alphaTab.worklet.mjs +1 -1
- package/package.json +4 -4
package/dist/alphaTab.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* alphaTab v1.6.
|
|
2
|
+
* alphaTab v1.6.2 (, build 21)
|
|
3
3
|
*
|
|
4
4
|
* Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
5
|
*
|
|
@@ -13751,9 +13751,7 @@
|
|
|
13751
13751
|
return writer.toArray();
|
|
13752
13752
|
}
|
|
13753
13753
|
static addHeaderAndFooter(binaryStylesheet, style, prefix, name) {
|
|
13754
|
-
|
|
13755
|
-
binaryStylesheet.addValue(`${prefix}${name}`, style.template, DataType.String);
|
|
13756
|
-
}
|
|
13754
|
+
binaryStylesheet.addValue(`${prefix}${name}`, style.template, DataType.String);
|
|
13757
13755
|
binaryStylesheet.addValue(`${prefix}${name}Alignment`, style.textAlign, DataType.Integer);
|
|
13758
13756
|
if (style.isVisible !== undefined) {
|
|
13759
13757
|
binaryStylesheet.addValue(`${prefix}draw${name}`, style.isVisible, DataType.Boolean);
|
|
@@ -28326,11 +28324,15 @@
|
|
|
28326
28324
|
}
|
|
28327
28325
|
|
|
28328
28326
|
class EventEmitter {
|
|
28329
|
-
constructor() {
|
|
28327
|
+
constructor(fireOnRegister = undefined) {
|
|
28330
28328
|
this._listeners = [];
|
|
28329
|
+
this._fireOnRegister = fireOnRegister;
|
|
28331
28330
|
}
|
|
28332
28331
|
on(value) {
|
|
28333
28332
|
this._listeners.push(value);
|
|
28333
|
+
if (this._fireOnRegister?.()) {
|
|
28334
|
+
value();
|
|
28335
|
+
}
|
|
28334
28336
|
return () => {
|
|
28335
28337
|
this.off(value);
|
|
28336
28338
|
};
|
|
@@ -28348,11 +28350,18 @@
|
|
|
28348
28350
|
* @partial
|
|
28349
28351
|
*/
|
|
28350
28352
|
class EventEmitterOfT {
|
|
28351
|
-
constructor() {
|
|
28353
|
+
constructor(fireOnRegister = undefined) {
|
|
28352
28354
|
this._listeners = [];
|
|
28355
|
+
this._fireOnRegister = fireOnRegister;
|
|
28353
28356
|
}
|
|
28354
28357
|
on(value) {
|
|
28355
28358
|
this._listeners.push(value);
|
|
28359
|
+
if (this._fireOnRegister) {
|
|
28360
|
+
const arg = this._fireOnRegister();
|
|
28361
|
+
if (arg !== null) {
|
|
28362
|
+
value(arg);
|
|
28363
|
+
}
|
|
28364
|
+
}
|
|
28356
28365
|
return () => {
|
|
28357
28366
|
this.off(value);
|
|
28358
28367
|
};
|
|
@@ -28529,6 +28538,12 @@
|
|
|
28529
28538
|
this.sequencer.playbackSpeed = value;
|
|
28530
28539
|
this.timePosition = this.timePosition * (oldSpeed / value);
|
|
28531
28540
|
}
|
|
28541
|
+
get loadedMidiInfo() {
|
|
28542
|
+
return this._loadedMidiInfo;
|
|
28543
|
+
}
|
|
28544
|
+
get currentPosition() {
|
|
28545
|
+
return this._currentPosition;
|
|
28546
|
+
}
|
|
28532
28547
|
get tickPosition() {
|
|
28533
28548
|
return this._tickPosition;
|
|
28534
28549
|
}
|
|
@@ -28586,22 +28601,38 @@
|
|
|
28586
28601
|
this._midiEventsPlayedFilter = new Set();
|
|
28587
28602
|
this._notPlayedSamples = 0;
|
|
28588
28603
|
this._synthStopping = false;
|
|
28604
|
+
this._currentPosition = new PositionChangedEventArgs(0, 0, 0, 0, false, 120, 120);
|
|
28589
28605
|
this.isReady = false;
|
|
28590
28606
|
this.state = PlayerState.Paused;
|
|
28591
28607
|
this._loadedSoundFonts = [];
|
|
28592
|
-
this.ready = new EventEmitter();
|
|
28593
28608
|
this.readyForPlayback = new EventEmitter();
|
|
28594
28609
|
this.finished = new EventEmitter();
|
|
28595
28610
|
this.soundFontLoaded = new EventEmitter();
|
|
28596
28611
|
this.soundFontLoadFailed = new EventEmitterOfT();
|
|
28597
|
-
this.midiLoaded = new EventEmitterOfT();
|
|
28598
28612
|
this.midiLoadFailed = new EventEmitterOfT();
|
|
28599
|
-
this.stateChanged = new EventEmitterOfT();
|
|
28600
|
-
this.positionChanged = new EventEmitterOfT();
|
|
28601
28613
|
this.midiEventsPlayed = new EventEmitterOfT();
|
|
28602
|
-
this.playbackRangeChanged = new EventEmitterOfT();
|
|
28603
28614
|
Logger.debug('AlphaSynth', 'Initializing player');
|
|
28604
28615
|
this.state = PlayerState.Paused;
|
|
28616
|
+
this.ready = new EventEmitter(() => this.isReady);
|
|
28617
|
+
this.readyForPlayback = new EventEmitter(() => this.isReadyForPlayback);
|
|
28618
|
+
this.midiLoaded = new EventEmitterOfT(() => {
|
|
28619
|
+
if (this._loadedMidiInfo) {
|
|
28620
|
+
return this._loadedMidiInfo;
|
|
28621
|
+
}
|
|
28622
|
+
return null;
|
|
28623
|
+
});
|
|
28624
|
+
this.stateChanged = new EventEmitterOfT(() => {
|
|
28625
|
+
return new PlayerStateChangedEventArgs(this.state, false);
|
|
28626
|
+
});
|
|
28627
|
+
this.positionChanged = new EventEmitterOfT(() => {
|
|
28628
|
+
return this._currentPosition;
|
|
28629
|
+
});
|
|
28630
|
+
this.playbackRangeChanged = new EventEmitterOfT(() => {
|
|
28631
|
+
if (this.playbackRange) {
|
|
28632
|
+
return new PlaybackRangeChangedEventArgs(this.playbackRange);
|
|
28633
|
+
}
|
|
28634
|
+
return null;
|
|
28635
|
+
});
|
|
28605
28636
|
Logger.debug('AlphaSynth', 'Creating output');
|
|
28606
28637
|
this._output = output;
|
|
28607
28638
|
Logger.debug('AlphaSynth', 'Creating synthesizer');
|
|
@@ -28779,7 +28810,8 @@
|
|
|
28779
28810
|
Logger.debug('AlphaSynth', 'Loading midi from model');
|
|
28780
28811
|
this.sequencer.loadMidi(midi);
|
|
28781
28812
|
this._isMidiLoaded = true;
|
|
28782
|
-
this.
|
|
28813
|
+
this._loadedMidiInfo = new PositionChangedEventArgs(0, this.sequencer.currentEndTime, 0, this.sequencer.currentEndTick, false, this.sequencer.currentTempo, this.sequencer.modifiedTempo);
|
|
28814
|
+
this.midiLoaded.trigger(this._loadedMidiInfo);
|
|
28783
28815
|
Logger.debug('AlphaSynth', 'Midi successfully loaded');
|
|
28784
28816
|
this.checkReadyForPlayback();
|
|
28785
28817
|
this.tickPosition = 0;
|
|
@@ -28882,23 +28914,28 @@
|
|
|
28882
28914
|
this.sequencer.resetOneTimeMidi();
|
|
28883
28915
|
this.timePosition = this.sequencer.currentTime;
|
|
28884
28916
|
}
|
|
28885
|
-
|
|
28886
|
-
//
|
|
28887
|
-
let currentTime =
|
|
28888
|
-
this._timePosition = currentTime;
|
|
28917
|
+
createPositionChangedEventArgs(isSeek) {
|
|
28918
|
+
// on fade outs we can have some milliseconds longer, ensure we don't report this
|
|
28919
|
+
let currentTime = this._timePosition;
|
|
28889
28920
|
let currentTick = this.sequencer.currentTimePositionToTickPosition(currentTime);
|
|
28890
|
-
this._tickPosition = currentTick;
|
|
28891
28921
|
const endTime = this.sequencer.currentEndTime;
|
|
28892
28922
|
const endTick = this.sequencer.currentEndTick;
|
|
28893
|
-
// on fade outs we can have some milliseconds longer, ensure we don't report this
|
|
28894
28923
|
if (currentTime > endTime) {
|
|
28895
28924
|
currentTime = endTime;
|
|
28896
28925
|
currentTick = endTick;
|
|
28897
28926
|
}
|
|
28927
|
+
return new PositionChangedEventArgs(currentTime, endTime, currentTick, endTick, isSeek, this.sequencer.currentTempo, this.sequencer.modifiedTempo);
|
|
28928
|
+
}
|
|
28929
|
+
updateTimePosition(timePosition, isSeek) {
|
|
28930
|
+
// update the real positions
|
|
28931
|
+
this._timePosition = timePosition;
|
|
28932
|
+
const args = this.createPositionChangedEventArgs(isSeek);
|
|
28933
|
+
this._tickPosition = args.currentTick;
|
|
28898
28934
|
const mode = this.sequencer.isPlayingMain ? 'main' : this.sequencer.isPlayingCountIn ? 'count-in' : 'one-time';
|
|
28899
|
-
Logger.debug('AlphaSynth', `Position changed: (time: ${currentTime}/${endTime}, tick: ${currentTick}/${endTick}, Active Voices: ${this.synthesizer.activeVoiceCount} (${mode}), Tempo original: ${this.sequencer.currentTempo}, Tempo modified: ${this.sequencer.modifiedTempo})`);
|
|
28935
|
+
Logger.debug('AlphaSynth', `Position changed: (time: ${args.currentTime}/${args.endTime}, tick: ${args.currentTick}/${args.endTick}, Active Voices: ${this.synthesizer.activeVoiceCount} (${mode}), Tempo original: ${this.sequencer.currentTempo}, Tempo modified: ${this.sequencer.modifiedTempo})`);
|
|
28900
28936
|
if (this.sequencer.isPlayingMain) {
|
|
28901
|
-
this.
|
|
28937
|
+
this._currentPosition = args;
|
|
28938
|
+
this.positionChanged.trigger(args);
|
|
28902
28939
|
}
|
|
28903
28940
|
// build events which were actually played
|
|
28904
28941
|
if (isSeek) {
|
|
@@ -28906,7 +28943,7 @@
|
|
|
28906
28943
|
}
|
|
28907
28944
|
else {
|
|
28908
28945
|
const playedEvents = [];
|
|
28909
|
-
while (!this._playedEventsQueue.isEmpty && this._playedEventsQueue.peek().time < currentTime) {
|
|
28946
|
+
while (!this._playedEventsQueue.isEmpty && this._playedEventsQueue.peek().time < args.currentTime) {
|
|
28910
28947
|
const synthEvent = this._playedEventsQueue.dequeue();
|
|
28911
28948
|
playedEvents.push(synthEvent.event);
|
|
28912
28949
|
}
|
|
@@ -31452,6 +31489,15 @@
|
|
|
31452
31489
|
fillFromJson(json) {
|
|
31453
31490
|
SettingsSerializer.fromJson(this, json);
|
|
31454
31491
|
}
|
|
31492
|
+
/**
|
|
31493
|
+
* handles backwards compatibility aspects on the settings, removed in 2.0
|
|
31494
|
+
* @internal
|
|
31495
|
+
*/
|
|
31496
|
+
handleBackwardsCompatibility() {
|
|
31497
|
+
if (this.player.playerMode === exports.PlayerMode.Disabled && this.player.enablePlayer) {
|
|
31498
|
+
this.player.playerMode = exports.PlayerMode.EnabledAutomatic;
|
|
31499
|
+
}
|
|
31500
|
+
}
|
|
31455
31501
|
}
|
|
31456
31502
|
|
|
31457
31503
|
class SectionSerializer {
|
|
@@ -39134,17 +39180,29 @@
|
|
|
39134
39180
|
this._playbackSpeed = 1;
|
|
39135
39181
|
this._isLooping = false;
|
|
39136
39182
|
this._midiEventsPlayedFilter = [];
|
|
39137
|
-
this.ready = new EventEmitter();
|
|
39138
|
-
this.readyForPlayback = new EventEmitter();
|
|
39139
39183
|
this.finished = new EventEmitter();
|
|
39140
39184
|
this.soundFontLoaded = new EventEmitter();
|
|
39141
39185
|
this.soundFontLoadFailed = new EventEmitterOfT();
|
|
39142
|
-
this.midiLoaded = new EventEmitterOfT();
|
|
39143
39186
|
this.midiLoadFailed = new EventEmitterOfT();
|
|
39144
|
-
this.stateChanged = new EventEmitterOfT();
|
|
39145
|
-
this.positionChanged = new EventEmitterOfT();
|
|
39146
39187
|
this.midiEventsPlayed = new EventEmitterOfT();
|
|
39147
|
-
this.
|
|
39188
|
+
this.ready = new EventEmitter(() => this.isReady);
|
|
39189
|
+
this.readyForPlayback = new EventEmitter(() => this.isReadyForPlayback);
|
|
39190
|
+
this.midiLoaded = new EventEmitterOfT(() => {
|
|
39191
|
+
return this._instance?.loadedMidiInfo ?? null;
|
|
39192
|
+
});
|
|
39193
|
+
this.stateChanged = new EventEmitterOfT(() => {
|
|
39194
|
+
return new PlayerStateChangedEventArgs(this.state, false);
|
|
39195
|
+
});
|
|
39196
|
+
this.positionChanged = new EventEmitterOfT(() => {
|
|
39197
|
+
return this.currentPosition;
|
|
39198
|
+
});
|
|
39199
|
+
this.playbackRangeChanged = new EventEmitterOfT(() => {
|
|
39200
|
+
const range = this.playbackRange;
|
|
39201
|
+
if (range) {
|
|
39202
|
+
return new PlaybackRangeChangedEventArgs(range);
|
|
39203
|
+
}
|
|
39204
|
+
return null;
|
|
39205
|
+
});
|
|
39148
39206
|
}
|
|
39149
39207
|
get instance() {
|
|
39150
39208
|
return this._instance;
|
|
@@ -39166,10 +39224,14 @@
|
|
|
39166
39224
|
newUnregister.push(value.finished.on(() => this.finished.trigger()));
|
|
39167
39225
|
newUnregister.push(value.soundFontLoaded.on(() => this.soundFontLoaded.trigger()));
|
|
39168
39226
|
newUnregister.push(value.soundFontLoadFailed.on(e => this.soundFontLoadFailed.trigger(e)));
|
|
39169
|
-
newUnregister.push(value.midiLoaded.on(e =>
|
|
39227
|
+
newUnregister.push(value.midiLoaded.on(e => {
|
|
39228
|
+
this.midiLoaded.trigger(e);
|
|
39229
|
+
}));
|
|
39170
39230
|
newUnregister.push(value.midiLoadFailed.on(e => this.midiLoadFailed.trigger(e)));
|
|
39171
39231
|
newUnregister.push(value.stateChanged.on(e => this.stateChanged.trigger(e)));
|
|
39172
|
-
newUnregister.push(value.positionChanged.on(e =>
|
|
39232
|
+
newUnregister.push(value.positionChanged.on(e => {
|
|
39233
|
+
this.positionChanged.trigger(e);
|
|
39234
|
+
}));
|
|
39173
39235
|
newUnregister.push(value.midiEventsPlayed.on(e => this.midiEventsPlayed.trigger(e)));
|
|
39174
39236
|
newUnregister.push(value.playbackRangeChanged.on(e => this.playbackRangeChanged.trigger(e)));
|
|
39175
39237
|
this._instanceEventUnregister = newUnregister;
|
|
@@ -39248,6 +39310,14 @@
|
|
|
39248
39310
|
this._instance.playbackSpeed = value;
|
|
39249
39311
|
}
|
|
39250
39312
|
}
|
|
39313
|
+
get loadedMidiInfo() {
|
|
39314
|
+
return this._instance ? this._instance.loadedMidiInfo : undefined;
|
|
39315
|
+
}
|
|
39316
|
+
get currentPosition() {
|
|
39317
|
+
return this._instance
|
|
39318
|
+
? this._instance.currentPosition
|
|
39319
|
+
: new PositionChangedEventArgs(0, 0, 0, 0, false, 120, 120);
|
|
39320
|
+
}
|
|
39251
39321
|
get tickPosition() {
|
|
39252
39322
|
return this._instance ? this._instance.tickPosition : 0;
|
|
39253
39323
|
}
|
|
@@ -39589,83 +39659,6 @@
|
|
|
39589
39659
|
this._previousStateForCursor = PlayerState.Paused;
|
|
39590
39660
|
this._previousCursorCache = null;
|
|
39591
39661
|
this._lastScroll = 0;
|
|
39592
|
-
/**
|
|
39593
|
-
* This event is fired when the played beat changed.
|
|
39594
|
-
*
|
|
39595
|
-
* @eventProperty
|
|
39596
|
-
* @category Events - Player
|
|
39597
|
-
* @since 0.9.4
|
|
39598
|
-
*
|
|
39599
|
-
* @example
|
|
39600
|
-
* JavaScript
|
|
39601
|
-
* ```js
|
|
39602
|
-
* const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
|
|
39603
|
-
* api.playedBeatChanged.on((beat) => {
|
|
39604
|
-
* updateFretboard(beat);
|
|
39605
|
-
* });
|
|
39606
|
-
* ```
|
|
39607
|
-
*
|
|
39608
|
-
* @example
|
|
39609
|
-
* C#
|
|
39610
|
-
* ```cs
|
|
39611
|
-
* var api = new AlphaTabApi<MyControl>(...);
|
|
39612
|
-
* api.PlayedBeatChanged.On(beat =>
|
|
39613
|
-
* {
|
|
39614
|
-
* UpdateFretboard(beat);
|
|
39615
|
-
* });
|
|
39616
|
-
* ```
|
|
39617
|
-
*
|
|
39618
|
-
* @example
|
|
39619
|
-
* Android
|
|
39620
|
-
* ```kotlin
|
|
39621
|
-
* val api = AlphaTabApi<MyControl>(...)
|
|
39622
|
-
* api.playedBeatChanged.on { beat ->
|
|
39623
|
-
* updateFretboard(beat)
|
|
39624
|
-
* }
|
|
39625
|
-
* ```
|
|
39626
|
-
*
|
|
39627
|
-
*/
|
|
39628
|
-
this.playedBeatChanged = new EventEmitterOfT();
|
|
39629
|
-
/**
|
|
39630
|
-
* This event is fired when the currently active beats across all tracks change.
|
|
39631
|
-
*
|
|
39632
|
-
* @remarks
|
|
39633
|
-
* Unlike the {@link playedBeatChanged} event this event contains the beats of all tracks and voices independent of them being rendered.
|
|
39634
|
-
*
|
|
39635
|
-
* @eventProperty
|
|
39636
|
-
* @category Events - Player
|
|
39637
|
-
* @since 1.2.3
|
|
39638
|
-
*
|
|
39639
|
-
* @example
|
|
39640
|
-
* JavaScript
|
|
39641
|
-
* ```js
|
|
39642
|
-
* const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
|
|
39643
|
-
* api.activeBeatsChanged.on(args => {
|
|
39644
|
-
* updateHighlights(args.activeBeats);
|
|
39645
|
-
* });
|
|
39646
|
-
* ```
|
|
39647
|
-
*
|
|
39648
|
-
* @example
|
|
39649
|
-
* C#
|
|
39650
|
-
* ```cs
|
|
39651
|
-
* var api = new AlphaTabApi<MyControl>(...);
|
|
39652
|
-
* api.ActiveBeatsChanged.On(args =>
|
|
39653
|
-
* {
|
|
39654
|
-
* UpdateHighlights(args.ActiveBeats);
|
|
39655
|
-
* });
|
|
39656
|
-
* ```
|
|
39657
|
-
*
|
|
39658
|
-
* @example
|
|
39659
|
-
* Android
|
|
39660
|
-
* ```kotlin
|
|
39661
|
-
* val api = AlphaTabApi<MyControl>(...)
|
|
39662
|
-
* api.activeBeatsChanged.on { args ->
|
|
39663
|
-
* updateHighlights(args.activeBeats)
|
|
39664
|
-
* }
|
|
39665
|
-
* ```
|
|
39666
|
-
*
|
|
39667
|
-
*/
|
|
39668
|
-
this.activeBeatsChanged = new EventEmitterOfT();
|
|
39669
39662
|
this._beatMouseDown = false;
|
|
39670
39663
|
this._noteMouseDown = false;
|
|
39671
39664
|
this._selectionStart = null;
|
|
@@ -39904,47 +39897,6 @@
|
|
|
39904
39897
|
*
|
|
39905
39898
|
*/
|
|
39906
39899
|
this.noteMouseUp = new EventEmitterOfT();
|
|
39907
|
-
/**
|
|
39908
|
-
* This event is fired whenever a new song is loaded.
|
|
39909
|
-
* @remarks
|
|
39910
|
-
* This event is fired whenever a new song is loaded or changing due to {@link renderScore} or {@link renderTracks} calls.
|
|
39911
|
-
* It is fired after the transposition midi pitches from the settings were applied, but before any midi is generated or rendering is started.
|
|
39912
|
-
* This allows any modification of the score before further processing.
|
|
39913
|
-
*
|
|
39914
|
-
* @eventProperty
|
|
39915
|
-
* @category Events - Core
|
|
39916
|
-
* @since 0.9.4
|
|
39917
|
-
*
|
|
39918
|
-
* @example
|
|
39919
|
-
* JavaScript
|
|
39920
|
-
* ```js
|
|
39921
|
-
* const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
|
|
39922
|
-
* api.scoreLoaded.on((score) => {
|
|
39923
|
-
* updateSongInformationInUi(score);
|
|
39924
|
-
* });
|
|
39925
|
-
* ```
|
|
39926
|
-
*
|
|
39927
|
-
* @example
|
|
39928
|
-
* C#
|
|
39929
|
-
* ```cs
|
|
39930
|
-
* var api = new AlphaTabApi<MyControl>(...);
|
|
39931
|
-
* api.ScoreLoaded.On(score =>
|
|
39932
|
-
* {
|
|
39933
|
-
* UpdateSongInformationInUi(score);
|
|
39934
|
-
* });
|
|
39935
|
-
* ```
|
|
39936
|
-
*
|
|
39937
|
-
* @example
|
|
39938
|
-
* Android
|
|
39939
|
-
* ```kotlin
|
|
39940
|
-
* val api = AlphaTabApi<MyControl>(...)
|
|
39941
|
-
* api.scoreLoaded.on { score ->
|
|
39942
|
-
* updateSongInformationInUi(score)
|
|
39943
|
-
* }
|
|
39944
|
-
* ```
|
|
39945
|
-
*
|
|
39946
|
-
*/
|
|
39947
|
-
this.scoreLoaded = new EventEmitterOfT();
|
|
39948
39900
|
/**
|
|
39949
39901
|
* This event is fired when alphaTab was resized and is about to rerender the music notation.
|
|
39950
39902
|
* @remarks
|
|
@@ -40203,46 +40155,6 @@
|
|
|
40203
40155
|
*
|
|
40204
40156
|
*/
|
|
40205
40157
|
this.midiLoad = new EventEmitterOfT();
|
|
40206
|
-
/**
|
|
40207
|
-
* This event is fired when the Midi file needed for playback was loaded.
|
|
40208
|
-
*
|
|
40209
|
-
* @eventProperty
|
|
40210
|
-
* @category Events - Player
|
|
40211
|
-
* @since 0.9.4
|
|
40212
|
-
*
|
|
40213
|
-
* @example
|
|
40214
|
-
* JavaScript
|
|
40215
|
-
* ```js
|
|
40216
|
-
* const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
|
|
40217
|
-
* api.midiLoaded.on(e => {
|
|
40218
|
-
* hideGeneratingAudioIndicator();
|
|
40219
|
-
* updateSongDuration(e.endTime);
|
|
40220
|
-
* });
|
|
40221
|
-
* ```
|
|
40222
|
-
*
|
|
40223
|
-
* @example
|
|
40224
|
-
* C#
|
|
40225
|
-
* ```cs
|
|
40226
|
-
* var api = new AlphaTabApi<MyControl>(...);
|
|
40227
|
-
* api.MidiLoaded.On(e =>
|
|
40228
|
-
* {
|
|
40229
|
-
* HideGeneratingAudioIndicator();
|
|
40230
|
-
* UpdateSongDuration(e.EndTime);
|
|
40231
|
-
* });
|
|
40232
|
-
* ```
|
|
40233
|
-
*
|
|
40234
|
-
* @example
|
|
40235
|
-
* Android
|
|
40236
|
-
* ```kotlin
|
|
40237
|
-
* val api = AlphaTabApi<MyControl>(...)
|
|
40238
|
-
* api.midiLoaded.on { e ->
|
|
40239
|
-
* hideGeneratingAudioIndicator()
|
|
40240
|
-
* updateSongDuration(e.endTime)
|
|
40241
|
-
* }
|
|
40242
|
-
* ```
|
|
40243
|
-
*
|
|
40244
|
-
*/
|
|
40245
|
-
this.midiLoaded = new EventEmitterOfT();
|
|
40246
40158
|
/**
|
|
40247
40159
|
* This event is fired when a settings update was requested.
|
|
40248
40160
|
*
|
|
@@ -40282,12 +40194,30 @@
|
|
|
40282
40194
|
this.settingsUpdated = new EventEmitter();
|
|
40283
40195
|
this.uiFacade = uiFacade;
|
|
40284
40196
|
this.container = uiFacade.rootContainer;
|
|
40197
|
+
this.activeBeatsChanged = new EventEmitterOfT(() => {
|
|
40198
|
+
if (this._player.state === PlayerState.Playing && this._currentBeat) {
|
|
40199
|
+
return new ActiveBeatsChangedEventArgs(this._currentBeat.beatLookup.highlightedBeats.map(h => h.beat));
|
|
40200
|
+
}
|
|
40201
|
+
return null;
|
|
40202
|
+
});
|
|
40203
|
+
this.playedBeatChanged = new EventEmitterOfT(() => {
|
|
40204
|
+
if (this._player.state === PlayerState.Playing && this._currentBeat) {
|
|
40205
|
+
return this._currentBeat.beat;
|
|
40206
|
+
}
|
|
40207
|
+
return null;
|
|
40208
|
+
});
|
|
40209
|
+
this.scoreLoaded = new EventEmitterOfT(() => {
|
|
40210
|
+
if (this._score) {
|
|
40211
|
+
return this._score;
|
|
40212
|
+
}
|
|
40213
|
+
return null;
|
|
40214
|
+
});
|
|
40215
|
+
this.midiLoaded = new EventEmitterOfT(() => {
|
|
40216
|
+
return this._player.loadedMidiInfo ?? null;
|
|
40217
|
+
});
|
|
40285
40218
|
uiFacade.initialize(this, settings);
|
|
40286
40219
|
Logger.logLevel = this.settings.core.logLevel;
|
|
40287
|
-
|
|
40288
|
-
if (this.settings.player.playerMode === exports.PlayerMode.Disabled && this.settings.player.enablePlayer) {
|
|
40289
|
-
this.settings.player.playerMode = exports.PlayerMode.EnabledAutomatic;
|
|
40290
|
-
}
|
|
40220
|
+
this.settings.handleBackwardsCompatibility();
|
|
40291
40221
|
Environment.printEnvironmentInfo(false);
|
|
40292
40222
|
this.canvasElement = uiFacade.createCanvasElement();
|
|
40293
40223
|
this.container.appendChild(this.canvasElement);
|
|
@@ -40446,6 +40376,7 @@
|
|
|
40446
40376
|
* ```
|
|
40447
40377
|
*/
|
|
40448
40378
|
updateSettings() {
|
|
40379
|
+
this.settings.handleBackwardsCompatibility();
|
|
40449
40380
|
const score = this.score;
|
|
40450
40381
|
if (score) {
|
|
40451
40382
|
ModelUtils.applyPitchOffsets(this.settings, score);
|
|
@@ -41253,6 +41184,22 @@
|
|
|
41253
41184
|
set timePosition(value) {
|
|
41254
41185
|
this._player.timePosition = value;
|
|
41255
41186
|
}
|
|
41187
|
+
/**
|
|
41188
|
+
* The total length of the song in midi ticks.
|
|
41189
|
+
* @category Properties - Player
|
|
41190
|
+
* @since 1.6.2
|
|
41191
|
+
*/
|
|
41192
|
+
get endTick() {
|
|
41193
|
+
return this._player.currentPosition.endTick;
|
|
41194
|
+
}
|
|
41195
|
+
/**
|
|
41196
|
+
* The total length of the song in milliseconds.
|
|
41197
|
+
* @category Properties - Player
|
|
41198
|
+
* @since 1.6.2
|
|
41199
|
+
*/
|
|
41200
|
+
get endTime() {
|
|
41201
|
+
return this._player.currentPosition.endTime;
|
|
41202
|
+
}
|
|
41256
41203
|
/**
|
|
41257
41204
|
* The range of the song that should be played.
|
|
41258
41205
|
* @remarks
|
|
@@ -43892,27 +43839,33 @@
|
|
|
43892
43839
|
value: value
|
|
43893
43840
|
});
|
|
43894
43841
|
}
|
|
43842
|
+
get loadedMidiInfo() {
|
|
43843
|
+
return this.loadedMidiInfo;
|
|
43844
|
+
}
|
|
43845
|
+
get currentPosition() {
|
|
43846
|
+
return this._currentPosition;
|
|
43847
|
+
}
|
|
43895
43848
|
get tickPosition() {
|
|
43896
|
-
return this.
|
|
43849
|
+
return this._currentPosition.currentTick;
|
|
43897
43850
|
}
|
|
43898
43851
|
set tickPosition(value) {
|
|
43899
43852
|
if (value < 0) {
|
|
43900
43853
|
value = 0;
|
|
43901
43854
|
}
|
|
43902
|
-
this.
|
|
43855
|
+
this._currentPosition = new PositionChangedEventArgs(this._currentPosition.currentTime, this._currentPosition.endTime, value, this._currentPosition.endTick, true, this._currentPosition.originalTempo, this._currentPosition.modifiedTempo);
|
|
43903
43856
|
this._synth.postMessage({
|
|
43904
43857
|
cmd: 'alphaSynth.setTickPosition',
|
|
43905
43858
|
value: value
|
|
43906
43859
|
});
|
|
43907
43860
|
}
|
|
43908
43861
|
get timePosition() {
|
|
43909
|
-
return this.
|
|
43862
|
+
return this._currentPosition.currentTime;
|
|
43910
43863
|
}
|
|
43911
43864
|
set timePosition(value) {
|
|
43912
43865
|
if (value < 0) {
|
|
43913
43866
|
value = 0;
|
|
43914
43867
|
}
|
|
43915
|
-
this.
|
|
43868
|
+
this._currentPosition = new PositionChangedEventArgs(value, this._currentPosition.endTime, this._currentPosition.currentTick, this._currentPosition.endTick, true, this._currentPosition.originalTempo, this._currentPosition.modifiedTempo);
|
|
43916
43869
|
this._synth.postMessage({
|
|
43917
43870
|
cmd: 'alphaSynth.setTimePosition',
|
|
43918
43871
|
value: value
|
|
@@ -43955,11 +43908,10 @@
|
|
|
43955
43908
|
this._metronomeVolume = 0;
|
|
43956
43909
|
this._countInVolume = 0;
|
|
43957
43910
|
this._playbackSpeed = 0;
|
|
43958
|
-
this._tickPosition = 0;
|
|
43959
|
-
this._timePosition = 0;
|
|
43960
43911
|
this._isLooping = false;
|
|
43961
43912
|
this._playbackRange = null;
|
|
43962
43913
|
this._midiEventsPlayedFilter = [];
|
|
43914
|
+
this._currentPosition = new PositionChangedEventArgs(0, 0, 0, 0, false, 120, 120);
|
|
43963
43915
|
this.ready = new EventEmitter();
|
|
43964
43916
|
this.readyForPlayback = new EventEmitter();
|
|
43965
43917
|
this.finished = new EventEmitter();
|
|
@@ -43978,8 +43930,6 @@
|
|
|
43978
43930
|
this._masterVolume = 0.0;
|
|
43979
43931
|
this._metronomeVolume = 0.0;
|
|
43980
43932
|
this._playbackSpeed = 0.0;
|
|
43981
|
-
this._tickPosition = 0;
|
|
43982
|
-
this._timePosition = 0.0;
|
|
43983
43933
|
this._isLooping = false;
|
|
43984
43934
|
this._playbackRange = null;
|
|
43985
43935
|
this._output = player;
|
|
@@ -44114,9 +44064,8 @@
|
|
|
44114
44064
|
this.checkReadyForPlayback();
|
|
44115
44065
|
break;
|
|
44116
44066
|
case 'alphaSynth.positionChanged':
|
|
44117
|
-
this.
|
|
44118
|
-
this.
|
|
44119
|
-
this.positionChanged.trigger(new PositionChangedEventArgs(data.currentTime, data.endTime, data.currentTick, data.endTick, data.isSeek, data.originalTempo, data.modifiedTempo));
|
|
44067
|
+
this._currentPosition = new PositionChangedEventArgs(data.currentTime, data.endTime, data.currentTick, data.endTick, data.isSeek, data.originalTempo, data.modifiedTempo);
|
|
44068
|
+
this.positionChanged.trigger(this._currentPosition);
|
|
44120
44069
|
break;
|
|
44121
44070
|
case 'alphaSynth.midiEventsPlayed':
|
|
44122
44071
|
this.midiEventsPlayed.trigger(new MidiEventsPlayedEventArgs(data.events.map(JsonConverter.jsObjectToMidiEvent)));
|
|
@@ -44140,7 +44089,8 @@
|
|
|
44140
44089
|
break;
|
|
44141
44090
|
case 'alphaSynth.midiLoaded':
|
|
44142
44091
|
this.checkReadyForPlayback();
|
|
44143
|
-
this.
|
|
44092
|
+
this._loadedMidiInfo = new PositionChangedEventArgs(data.currentTime, data.endTime, data.currentTick, data.endTick, data.isSeek, data.originalTempo, data.modifiedTempo);
|
|
44093
|
+
this.midiLoaded.trigger(this._loadedMidiInfo);
|
|
44144
44094
|
break;
|
|
44145
44095
|
case 'alphaSynth.midiLoadFailed':
|
|
44146
44096
|
this.checkReadyForPlayback();
|
|
@@ -61795,9 +61745,9 @@
|
|
|
61795
61745
|
print(`build date: ${VersionInfo.date}`);
|
|
61796
61746
|
}
|
|
61797
61747
|
}
|
|
61798
|
-
VersionInfo.version = '1.6.
|
|
61799
|
-
VersionInfo.date = '2025-
|
|
61800
|
-
VersionInfo.commit = '
|
|
61748
|
+
VersionInfo.version = '1.6.2';
|
|
61749
|
+
VersionInfo.date = '2025-08-23T16:08:14.997Z';
|
|
61750
|
+
VersionInfo.commit = '7a3395e57a19e6e78397974ab295db87b6cc7bff';
|
|
61801
61751
|
|
|
61802
61752
|
/**
|
|
61803
61753
|
* A factory for custom layout engines.
|