@coderline/alphatab 1.6.1 → 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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * alphaTab v1.6.1 (, build 20)
2
+ * alphaTab v1.6.2 (, build 21)
3
3
  *
4
4
  * Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -13745,9 +13745,7 @@ class BinaryStylesheet {
13745
13745
  return writer.toArray();
13746
13746
  }
13747
13747
  static addHeaderAndFooter(binaryStylesheet, style, prefix, name) {
13748
- if (style.template !== undefined) {
13749
- binaryStylesheet.addValue(`${prefix}${name}`, style.template, DataType.String);
13750
- }
13748
+ binaryStylesheet.addValue(`${prefix}${name}`, style.template, DataType.String);
13751
13749
  binaryStylesheet.addValue(`${prefix}${name}Alignment`, style.textAlign, DataType.Integer);
13752
13750
  if (style.isVisible !== undefined) {
13753
13751
  binaryStylesheet.addValue(`${prefix}draw${name}`, style.isVisible, DataType.Boolean);
@@ -28320,11 +28318,15 @@ class TinySoundFont {
28320
28318
  }
28321
28319
 
28322
28320
  class EventEmitter {
28323
- constructor() {
28321
+ constructor(fireOnRegister = undefined) {
28324
28322
  this._listeners = [];
28323
+ this._fireOnRegister = fireOnRegister;
28325
28324
  }
28326
28325
  on(value) {
28327
28326
  this._listeners.push(value);
28327
+ if (this._fireOnRegister?.()) {
28328
+ value();
28329
+ }
28328
28330
  return () => {
28329
28331
  this.off(value);
28330
28332
  };
@@ -28342,11 +28344,18 @@ class EventEmitter {
28342
28344
  * @partial
28343
28345
  */
28344
28346
  class EventEmitterOfT {
28345
- constructor() {
28347
+ constructor(fireOnRegister = undefined) {
28346
28348
  this._listeners = [];
28349
+ this._fireOnRegister = fireOnRegister;
28347
28350
  }
28348
28351
  on(value) {
28349
28352
  this._listeners.push(value);
28353
+ if (this._fireOnRegister) {
28354
+ const arg = this._fireOnRegister();
28355
+ if (arg !== null) {
28356
+ value(arg);
28357
+ }
28358
+ }
28350
28359
  return () => {
28351
28360
  this.off(value);
28352
28361
  };
@@ -28523,6 +28532,12 @@ class AlphaSynthBase {
28523
28532
  this.sequencer.playbackSpeed = value;
28524
28533
  this.timePosition = this.timePosition * (oldSpeed / value);
28525
28534
  }
28535
+ get loadedMidiInfo() {
28536
+ return this._loadedMidiInfo;
28537
+ }
28538
+ get currentPosition() {
28539
+ return this._currentPosition;
28540
+ }
28526
28541
  get tickPosition() {
28527
28542
  return this._tickPosition;
28528
28543
  }
@@ -28580,22 +28595,38 @@ class AlphaSynthBase {
28580
28595
  this._midiEventsPlayedFilter = new Set();
28581
28596
  this._notPlayedSamples = 0;
28582
28597
  this._synthStopping = false;
28598
+ this._currentPosition = new PositionChangedEventArgs(0, 0, 0, 0, false, 120, 120);
28583
28599
  this.isReady = false;
28584
28600
  this.state = PlayerState.Paused;
28585
28601
  this._loadedSoundFonts = [];
28586
- this.ready = new EventEmitter();
28587
28602
  this.readyForPlayback = new EventEmitter();
28588
28603
  this.finished = new EventEmitter();
28589
28604
  this.soundFontLoaded = new EventEmitter();
28590
28605
  this.soundFontLoadFailed = new EventEmitterOfT();
28591
- this.midiLoaded = new EventEmitterOfT();
28592
28606
  this.midiLoadFailed = new EventEmitterOfT();
28593
- this.stateChanged = new EventEmitterOfT();
28594
- this.positionChanged = new EventEmitterOfT();
28595
28607
  this.midiEventsPlayed = new EventEmitterOfT();
28596
- this.playbackRangeChanged = new EventEmitterOfT();
28597
28608
  Logger.debug('AlphaSynth', 'Initializing player');
28598
28609
  this.state = PlayerState.Paused;
28610
+ this.ready = new EventEmitter(() => this.isReady);
28611
+ this.readyForPlayback = new EventEmitter(() => this.isReadyForPlayback);
28612
+ this.midiLoaded = new EventEmitterOfT(() => {
28613
+ if (this._loadedMidiInfo) {
28614
+ return this._loadedMidiInfo;
28615
+ }
28616
+ return null;
28617
+ });
28618
+ this.stateChanged = new EventEmitterOfT(() => {
28619
+ return new PlayerStateChangedEventArgs(this.state, false);
28620
+ });
28621
+ this.positionChanged = new EventEmitterOfT(() => {
28622
+ return this._currentPosition;
28623
+ });
28624
+ this.playbackRangeChanged = new EventEmitterOfT(() => {
28625
+ if (this.playbackRange) {
28626
+ return new PlaybackRangeChangedEventArgs(this.playbackRange);
28627
+ }
28628
+ return null;
28629
+ });
28599
28630
  Logger.debug('AlphaSynth', 'Creating output');
28600
28631
  this._output = output;
28601
28632
  Logger.debug('AlphaSynth', 'Creating synthesizer');
@@ -28773,7 +28804,8 @@ class AlphaSynthBase {
28773
28804
  Logger.debug('AlphaSynth', 'Loading midi from model');
28774
28805
  this.sequencer.loadMidi(midi);
28775
28806
  this._isMidiLoaded = true;
28776
- this.midiLoaded.trigger(new PositionChangedEventArgs(0, this.sequencer.currentEndTime, 0, this.sequencer.currentEndTick, false, this.sequencer.currentTempo, this.sequencer.modifiedTempo));
28807
+ this._loadedMidiInfo = new PositionChangedEventArgs(0, this.sequencer.currentEndTime, 0, this.sequencer.currentEndTick, false, this.sequencer.currentTempo, this.sequencer.modifiedTempo);
28808
+ this.midiLoaded.trigger(this._loadedMidiInfo);
28777
28809
  Logger.debug('AlphaSynth', 'Midi successfully loaded');
28778
28810
  this.checkReadyForPlayback();
28779
28811
  this.tickPosition = 0;
@@ -28876,23 +28908,28 @@ class AlphaSynthBase {
28876
28908
  this.sequencer.resetOneTimeMidi();
28877
28909
  this.timePosition = this.sequencer.currentTime;
28878
28910
  }
28879
- updateTimePosition(timePosition, isSeek) {
28880
- // update the real positions
28881
- let currentTime = timePosition;
28882
- this._timePosition = currentTime;
28911
+ createPositionChangedEventArgs(isSeek) {
28912
+ // on fade outs we can have some milliseconds longer, ensure we don't report this
28913
+ let currentTime = this._timePosition;
28883
28914
  let currentTick = this.sequencer.currentTimePositionToTickPosition(currentTime);
28884
- this._tickPosition = currentTick;
28885
28915
  const endTime = this.sequencer.currentEndTime;
28886
28916
  const endTick = this.sequencer.currentEndTick;
28887
- // on fade outs we can have some milliseconds longer, ensure we don't report this
28888
28917
  if (currentTime > endTime) {
28889
28918
  currentTime = endTime;
28890
28919
  currentTick = endTick;
28891
28920
  }
28921
+ return new PositionChangedEventArgs(currentTime, endTime, currentTick, endTick, isSeek, this.sequencer.currentTempo, this.sequencer.modifiedTempo);
28922
+ }
28923
+ updateTimePosition(timePosition, isSeek) {
28924
+ // update the real positions
28925
+ this._timePosition = timePosition;
28926
+ const args = this.createPositionChangedEventArgs(isSeek);
28927
+ this._tickPosition = args.currentTick;
28892
28928
  const mode = this.sequencer.isPlayingMain ? 'main' : this.sequencer.isPlayingCountIn ? 'count-in' : 'one-time';
28893
- 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})`);
28929
+ 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})`);
28894
28930
  if (this.sequencer.isPlayingMain) {
28895
- this.positionChanged.trigger(new PositionChangedEventArgs(currentTime, endTime, currentTick, endTick, isSeek, this.sequencer.currentTempo, this.sequencer.modifiedTempo));
28931
+ this._currentPosition = args;
28932
+ this.positionChanged.trigger(args);
28896
28933
  }
28897
28934
  // build events which were actually played
28898
28935
  if (isSeek) {
@@ -28900,7 +28937,7 @@ class AlphaSynthBase {
28900
28937
  }
28901
28938
  else {
28902
28939
  const playedEvents = [];
28903
- while (!this._playedEventsQueue.isEmpty && this._playedEventsQueue.peek().time < currentTime) {
28940
+ while (!this._playedEventsQueue.isEmpty && this._playedEventsQueue.peek().time < args.currentTime) {
28904
28941
  const synthEvent = this._playedEventsQueue.dequeue();
28905
28942
  playedEvents.push(synthEvent.event);
28906
28943
  }
@@ -31446,6 +31483,15 @@ class Settings {
31446
31483
  fillFromJson(json) {
31447
31484
  SettingsSerializer.fromJson(this, json);
31448
31485
  }
31486
+ /**
31487
+ * handles backwards compatibility aspects on the settings, removed in 2.0
31488
+ * @internal
31489
+ */
31490
+ handleBackwardsCompatibility() {
31491
+ if (this.player.playerMode === PlayerMode.Disabled && this.player.enablePlayer) {
31492
+ this.player.playerMode = PlayerMode.EnabledAutomatic;
31493
+ }
31494
+ }
31449
31495
  }
31450
31496
 
31451
31497
  class SectionSerializer {
@@ -39128,17 +39174,29 @@ class AlphaSynthWrapper {
39128
39174
  this._playbackSpeed = 1;
39129
39175
  this._isLooping = false;
39130
39176
  this._midiEventsPlayedFilter = [];
39131
- this.ready = new EventEmitter();
39132
- this.readyForPlayback = new EventEmitter();
39133
39177
  this.finished = new EventEmitter();
39134
39178
  this.soundFontLoaded = new EventEmitter();
39135
39179
  this.soundFontLoadFailed = new EventEmitterOfT();
39136
- this.midiLoaded = new EventEmitterOfT();
39137
39180
  this.midiLoadFailed = new EventEmitterOfT();
39138
- this.stateChanged = new EventEmitterOfT();
39139
- this.positionChanged = new EventEmitterOfT();
39140
39181
  this.midiEventsPlayed = new EventEmitterOfT();
39141
- this.playbackRangeChanged = new EventEmitterOfT();
39182
+ this.ready = new EventEmitter(() => this.isReady);
39183
+ this.readyForPlayback = new EventEmitter(() => this.isReadyForPlayback);
39184
+ this.midiLoaded = new EventEmitterOfT(() => {
39185
+ return this._instance?.loadedMidiInfo ?? null;
39186
+ });
39187
+ this.stateChanged = new EventEmitterOfT(() => {
39188
+ return new PlayerStateChangedEventArgs(this.state, false);
39189
+ });
39190
+ this.positionChanged = new EventEmitterOfT(() => {
39191
+ return this.currentPosition;
39192
+ });
39193
+ this.playbackRangeChanged = new EventEmitterOfT(() => {
39194
+ const range = this.playbackRange;
39195
+ if (range) {
39196
+ return new PlaybackRangeChangedEventArgs(range);
39197
+ }
39198
+ return null;
39199
+ });
39142
39200
  }
39143
39201
  get instance() {
39144
39202
  return this._instance;
@@ -39160,10 +39218,14 @@ class AlphaSynthWrapper {
39160
39218
  newUnregister.push(value.finished.on(() => this.finished.trigger()));
39161
39219
  newUnregister.push(value.soundFontLoaded.on(() => this.soundFontLoaded.trigger()));
39162
39220
  newUnregister.push(value.soundFontLoadFailed.on(e => this.soundFontLoadFailed.trigger(e)));
39163
- newUnregister.push(value.midiLoaded.on(e => this.midiLoaded.trigger(e)));
39221
+ newUnregister.push(value.midiLoaded.on(e => {
39222
+ this.midiLoaded.trigger(e);
39223
+ }));
39164
39224
  newUnregister.push(value.midiLoadFailed.on(e => this.midiLoadFailed.trigger(e)));
39165
39225
  newUnregister.push(value.stateChanged.on(e => this.stateChanged.trigger(e)));
39166
- newUnregister.push(value.positionChanged.on(e => this.positionChanged.trigger(e)));
39226
+ newUnregister.push(value.positionChanged.on(e => {
39227
+ this.positionChanged.trigger(e);
39228
+ }));
39167
39229
  newUnregister.push(value.midiEventsPlayed.on(e => this.midiEventsPlayed.trigger(e)));
39168
39230
  newUnregister.push(value.playbackRangeChanged.on(e => this.playbackRangeChanged.trigger(e)));
39169
39231
  this._instanceEventUnregister = newUnregister;
@@ -39242,6 +39304,14 @@ class AlphaSynthWrapper {
39242
39304
  this._instance.playbackSpeed = value;
39243
39305
  }
39244
39306
  }
39307
+ get loadedMidiInfo() {
39308
+ return this._instance ? this._instance.loadedMidiInfo : undefined;
39309
+ }
39310
+ get currentPosition() {
39311
+ return this._instance
39312
+ ? this._instance.currentPosition
39313
+ : new PositionChangedEventArgs(0, 0, 0, 0, false, 120, 120);
39314
+ }
39245
39315
  get tickPosition() {
39246
39316
  return this._instance ? this._instance.tickPosition : 0;
39247
39317
  }
@@ -39583,83 +39653,6 @@ class AlphaTabApiBase {
39583
39653
  this._previousStateForCursor = PlayerState.Paused;
39584
39654
  this._previousCursorCache = null;
39585
39655
  this._lastScroll = 0;
39586
- /**
39587
- * This event is fired when the played beat changed.
39588
- *
39589
- * @eventProperty
39590
- * @category Events - Player
39591
- * @since 0.9.4
39592
- *
39593
- * @example
39594
- * JavaScript
39595
- * ```js
39596
- * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
39597
- * api.playedBeatChanged.on((beat) => {
39598
- * updateFretboard(beat);
39599
- * });
39600
- * ```
39601
- *
39602
- * @example
39603
- * C#
39604
- * ```cs
39605
- * var api = new AlphaTabApi<MyControl>(...);
39606
- * api.PlayedBeatChanged.On(beat =>
39607
- * {
39608
- * UpdateFretboard(beat);
39609
- * });
39610
- * ```
39611
- *
39612
- * @example
39613
- * Android
39614
- * ```kotlin
39615
- * val api = AlphaTabApi<MyControl>(...)
39616
- * api.playedBeatChanged.on { beat ->
39617
- * updateFretboard(beat)
39618
- * }
39619
- * ```
39620
- *
39621
- */
39622
- this.playedBeatChanged = new EventEmitterOfT();
39623
- /**
39624
- * This event is fired when the currently active beats across all tracks change.
39625
- *
39626
- * @remarks
39627
- * Unlike the {@link playedBeatChanged} event this event contains the beats of all tracks and voices independent of them being rendered.
39628
- *
39629
- * @eventProperty
39630
- * @category Events - Player
39631
- * @since 1.2.3
39632
- *
39633
- * @example
39634
- * JavaScript
39635
- * ```js
39636
- * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
39637
- * api.activeBeatsChanged.on(args => {
39638
- * updateHighlights(args.activeBeats);
39639
- * });
39640
- * ```
39641
- *
39642
- * @example
39643
- * C#
39644
- * ```cs
39645
- * var api = new AlphaTabApi<MyControl>(...);
39646
- * api.ActiveBeatsChanged.On(args =>
39647
- * {
39648
- * UpdateHighlights(args.ActiveBeats);
39649
- * });
39650
- * ```
39651
- *
39652
- * @example
39653
- * Android
39654
- * ```kotlin
39655
- * val api = AlphaTabApi<MyControl>(...)
39656
- * api.activeBeatsChanged.on { args ->
39657
- * updateHighlights(args.activeBeats)
39658
- * }
39659
- * ```
39660
- *
39661
- */
39662
- this.activeBeatsChanged = new EventEmitterOfT();
39663
39656
  this._beatMouseDown = false;
39664
39657
  this._noteMouseDown = false;
39665
39658
  this._selectionStart = null;
@@ -39898,47 +39891,6 @@ class AlphaTabApiBase {
39898
39891
  *
39899
39892
  */
39900
39893
  this.noteMouseUp = new EventEmitterOfT();
39901
- /**
39902
- * This event is fired whenever a new song is loaded.
39903
- * @remarks
39904
- * This event is fired whenever a new song is loaded or changing due to {@link renderScore} or {@link renderTracks} calls.
39905
- * It is fired after the transposition midi pitches from the settings were applied, but before any midi is generated or rendering is started.
39906
- * This allows any modification of the score before further processing.
39907
- *
39908
- * @eventProperty
39909
- * @category Events - Core
39910
- * @since 0.9.4
39911
- *
39912
- * @example
39913
- * JavaScript
39914
- * ```js
39915
- * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
39916
- * api.scoreLoaded.on((score) => {
39917
- * updateSongInformationInUi(score);
39918
- * });
39919
- * ```
39920
- *
39921
- * @example
39922
- * C#
39923
- * ```cs
39924
- * var api = new AlphaTabApi<MyControl>(...);
39925
- * api.ScoreLoaded.On(score =>
39926
- * {
39927
- * UpdateSongInformationInUi(score);
39928
- * });
39929
- * ```
39930
- *
39931
- * @example
39932
- * Android
39933
- * ```kotlin
39934
- * val api = AlphaTabApi<MyControl>(...)
39935
- * api.scoreLoaded.on { score ->
39936
- * updateSongInformationInUi(score)
39937
- * }
39938
- * ```
39939
- *
39940
- */
39941
- this.scoreLoaded = new EventEmitterOfT();
39942
39894
  /**
39943
39895
  * This event is fired when alphaTab was resized and is about to rerender the music notation.
39944
39896
  * @remarks
@@ -40197,46 +40149,6 @@ class AlphaTabApiBase {
40197
40149
  *
40198
40150
  */
40199
40151
  this.midiLoad = new EventEmitterOfT();
40200
- /**
40201
- * This event is fired when the Midi file needed for playback was loaded.
40202
- *
40203
- * @eventProperty
40204
- * @category Events - Player
40205
- * @since 0.9.4
40206
- *
40207
- * @example
40208
- * JavaScript
40209
- * ```js
40210
- * const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
40211
- * api.midiLoaded.on(e => {
40212
- * hideGeneratingAudioIndicator();
40213
- * updateSongDuration(e.endTime);
40214
- * });
40215
- * ```
40216
- *
40217
- * @example
40218
- * C#
40219
- * ```cs
40220
- * var api = new AlphaTabApi<MyControl>(...);
40221
- * api.MidiLoaded.On(e =>
40222
- * {
40223
- * HideGeneratingAudioIndicator();
40224
- * UpdateSongDuration(e.EndTime);
40225
- * });
40226
- * ```
40227
- *
40228
- * @example
40229
- * Android
40230
- * ```kotlin
40231
- * val api = AlphaTabApi<MyControl>(...)
40232
- * api.midiLoaded.on { e ->
40233
- * hideGeneratingAudioIndicator()
40234
- * updateSongDuration(e.endTime)
40235
- * }
40236
- * ```
40237
- *
40238
- */
40239
- this.midiLoaded = new EventEmitterOfT();
40240
40152
  /**
40241
40153
  * This event is fired when a settings update was requested.
40242
40154
  *
@@ -40276,12 +40188,30 @@ class AlphaTabApiBase {
40276
40188
  this.settingsUpdated = new EventEmitter();
40277
40189
  this.uiFacade = uiFacade;
40278
40190
  this.container = uiFacade.rootContainer;
40191
+ this.activeBeatsChanged = new EventEmitterOfT(() => {
40192
+ if (this._player.state === PlayerState.Playing && this._currentBeat) {
40193
+ return new ActiveBeatsChangedEventArgs(this._currentBeat.beatLookup.highlightedBeats.map(h => h.beat));
40194
+ }
40195
+ return null;
40196
+ });
40197
+ this.playedBeatChanged = new EventEmitterOfT(() => {
40198
+ if (this._player.state === PlayerState.Playing && this._currentBeat) {
40199
+ return this._currentBeat.beat;
40200
+ }
40201
+ return null;
40202
+ });
40203
+ this.scoreLoaded = new EventEmitterOfT(() => {
40204
+ if (this._score) {
40205
+ return this._score;
40206
+ }
40207
+ return null;
40208
+ });
40209
+ this.midiLoaded = new EventEmitterOfT(() => {
40210
+ return this._player.loadedMidiInfo ?? null;
40211
+ });
40279
40212
  uiFacade.initialize(this, settings);
40280
40213
  Logger.logLevel = this.settings.core.logLevel;
40281
- // backwards compatibility: remove in 2.0
40282
- if (this.settings.player.playerMode === PlayerMode.Disabled && this.settings.player.enablePlayer) {
40283
- this.settings.player.playerMode = PlayerMode.EnabledAutomatic;
40284
- }
40214
+ this.settings.handleBackwardsCompatibility();
40285
40215
  Environment.printEnvironmentInfo(false);
40286
40216
  this.canvasElement = uiFacade.createCanvasElement();
40287
40217
  this.container.appendChild(this.canvasElement);
@@ -40440,6 +40370,7 @@ class AlphaTabApiBase {
40440
40370
  * ```
40441
40371
  */
40442
40372
  updateSettings() {
40373
+ this.settings.handleBackwardsCompatibility();
40443
40374
  const score = this.score;
40444
40375
  if (score) {
40445
40376
  ModelUtils.applyPitchOffsets(this.settings, score);
@@ -41247,6 +41178,22 @@ class AlphaTabApiBase {
41247
41178
  set timePosition(value) {
41248
41179
  this._player.timePosition = value;
41249
41180
  }
41181
+ /**
41182
+ * The total length of the song in midi ticks.
41183
+ * @category Properties - Player
41184
+ * @since 1.6.2
41185
+ */
41186
+ get endTick() {
41187
+ return this._player.currentPosition.endTick;
41188
+ }
41189
+ /**
41190
+ * The total length of the song in milliseconds.
41191
+ * @category Properties - Player
41192
+ * @since 1.6.2
41193
+ */
41194
+ get endTime() {
41195
+ return this._player.currentPosition.endTime;
41196
+ }
41250
41197
  /**
41251
41198
  * The range of the song that should be played.
41252
41199
  * @remarks
@@ -43886,27 +43833,33 @@ class AlphaSynthWebWorkerApi {
43886
43833
  value: value
43887
43834
  });
43888
43835
  }
43836
+ get loadedMidiInfo() {
43837
+ return this.loadedMidiInfo;
43838
+ }
43839
+ get currentPosition() {
43840
+ return this._currentPosition;
43841
+ }
43889
43842
  get tickPosition() {
43890
- return this._tickPosition;
43843
+ return this._currentPosition.currentTick;
43891
43844
  }
43892
43845
  set tickPosition(value) {
43893
43846
  if (value < 0) {
43894
43847
  value = 0;
43895
43848
  }
43896
- this._tickPosition = value;
43849
+ this._currentPosition = new PositionChangedEventArgs(this._currentPosition.currentTime, this._currentPosition.endTime, value, this._currentPosition.endTick, true, this._currentPosition.originalTempo, this._currentPosition.modifiedTempo);
43897
43850
  this._synth.postMessage({
43898
43851
  cmd: 'alphaSynth.setTickPosition',
43899
43852
  value: value
43900
43853
  });
43901
43854
  }
43902
43855
  get timePosition() {
43903
- return this._timePosition;
43856
+ return this._currentPosition.currentTime;
43904
43857
  }
43905
43858
  set timePosition(value) {
43906
43859
  if (value < 0) {
43907
43860
  value = 0;
43908
43861
  }
43909
- this._timePosition = value;
43862
+ this._currentPosition = new PositionChangedEventArgs(value, this._currentPosition.endTime, this._currentPosition.currentTick, this._currentPosition.endTick, true, this._currentPosition.originalTempo, this._currentPosition.modifiedTempo);
43910
43863
  this._synth.postMessage({
43911
43864
  cmd: 'alphaSynth.setTimePosition',
43912
43865
  value: value
@@ -43949,11 +43902,10 @@ class AlphaSynthWebWorkerApi {
43949
43902
  this._metronomeVolume = 0;
43950
43903
  this._countInVolume = 0;
43951
43904
  this._playbackSpeed = 0;
43952
- this._tickPosition = 0;
43953
- this._timePosition = 0;
43954
43905
  this._isLooping = false;
43955
43906
  this._playbackRange = null;
43956
43907
  this._midiEventsPlayedFilter = [];
43908
+ this._currentPosition = new PositionChangedEventArgs(0, 0, 0, 0, false, 120, 120);
43957
43909
  this.ready = new EventEmitter();
43958
43910
  this.readyForPlayback = new EventEmitter();
43959
43911
  this.finished = new EventEmitter();
@@ -43972,8 +43924,6 @@ class AlphaSynthWebWorkerApi {
43972
43924
  this._masterVolume = 0.0;
43973
43925
  this._metronomeVolume = 0.0;
43974
43926
  this._playbackSpeed = 0.0;
43975
- this._tickPosition = 0;
43976
- this._timePosition = 0.0;
43977
43927
  this._isLooping = false;
43978
43928
  this._playbackRange = null;
43979
43929
  this._output = player;
@@ -44108,9 +44058,8 @@ class AlphaSynthWebWorkerApi {
44108
44058
  this.checkReadyForPlayback();
44109
44059
  break;
44110
44060
  case 'alphaSynth.positionChanged':
44111
- this._timePosition = data.currentTime;
44112
- this._tickPosition = data.currentTick;
44113
- this.positionChanged.trigger(new PositionChangedEventArgs(data.currentTime, data.endTime, data.currentTick, data.endTick, data.isSeek, data.originalTempo, data.modifiedTempo));
44061
+ this._currentPosition = new PositionChangedEventArgs(data.currentTime, data.endTime, data.currentTick, data.endTick, data.isSeek, data.originalTempo, data.modifiedTempo);
44062
+ this.positionChanged.trigger(this._currentPosition);
44114
44063
  break;
44115
44064
  case 'alphaSynth.midiEventsPlayed':
44116
44065
  this.midiEventsPlayed.trigger(new MidiEventsPlayedEventArgs(data.events.map(JsonConverter.jsObjectToMidiEvent)));
@@ -44134,7 +44083,8 @@ class AlphaSynthWebWorkerApi {
44134
44083
  break;
44135
44084
  case 'alphaSynth.midiLoaded':
44136
44085
  this.checkReadyForPlayback();
44137
- this.midiLoaded.trigger(new PositionChangedEventArgs(data.currentTime, data.endTime, data.currentTick, data.endTick, data.isSeek, data.originalTempo, data.modifiedTempo));
44086
+ this._loadedMidiInfo = new PositionChangedEventArgs(data.currentTime, data.endTime, data.currentTick, data.endTick, data.isSeek, data.originalTempo, data.modifiedTempo);
44087
+ this.midiLoaded.trigger(this._loadedMidiInfo);
44138
44088
  break;
44139
44089
  case 'alphaSynth.midiLoadFailed':
44140
44090
  this.checkReadyForPlayback();
@@ -61789,9 +61739,9 @@ class VersionInfo {
61789
61739
  print(`build date: ${VersionInfo.date}`);
61790
61740
  }
61791
61741
  }
61792
- VersionInfo.version = '1.6.1';
61793
- VersionInfo.date = '2025-07-23T21:10:31.910Z';
61794
- VersionInfo.commit = '4f78524781ce9441cba1267d45a983c6ac92b977';
61742
+ VersionInfo.version = '1.6.2';
61743
+ VersionInfo.date = '2025-08-23T16:08:14.997Z';
61744
+ VersionInfo.commit = '7a3395e57a19e6e78397974ab295db87b6cc7bff';
61795
61745
 
61796
61746
  /**
61797
61747
  * A factory for custom layout engines.