@coderline/alphatab 1.3.0-alpha.418 → 1.3.0-alpha.424

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.
@@ -5517,6 +5517,7 @@ declare class MidiFileGenerator {
5517
5517
  private static getDynamicValue;
5518
5518
  private generateFadeIn;
5519
5519
  private generateVibrato;
5520
+ vibratoResolution: number;
5520
5521
  private generateVibratorWithParams;
5521
5522
  /**
5522
5523
  * Maximum semitones that are supported in bends in one direction (up or down)
package/dist/alphaTab.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.418 (develop, build 418)
2
+ * alphaTab v1.3.0-alpha.424 (develop, build 424)
3
3
  *
4
4
  * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -23004,6 +23004,7 @@
23004
23004
  */
23005
23005
  this.tickLookup = new MidiTickLookup();
23006
23006
  this._currentTripletFeel = null;
23007
+ this.vibratoResolution = 16;
23007
23008
  this._score = score;
23008
23009
  this._settings = !settings ? new Settings() : settings;
23009
23010
  this._currentTempo = this._score.tempo;
@@ -23342,7 +23343,7 @@
23342
23343
  else if (note.slideInType !== SlideInType.None || note.slideOutType !== SlideOutType.None) {
23343
23344
  this.generateSlide(note, noteStart, noteDuration, noteKey, dynamicValue, channel);
23344
23345
  }
23345
- else if (note.vibrato !== VibratoType.None) {
23346
+ else if (note.vibrato !== VibratoType.None || (note.isTieDestination && note.tieOrigin.vibrato !== VibratoType.None)) {
23346
23347
  this.generateVibrato(note, noteStart, noteDuration, noteKey, channel);
23347
23348
  }
23348
23349
  // for tied notes, and target notes of legato slides we do not pick the note
@@ -23488,7 +23489,9 @@
23488
23489
  generateVibrato(note, noteStart, noteDuration, noteKey, channel) {
23489
23490
  let phaseLength = 0;
23490
23491
  let bendAmplitude = 0;
23491
- switch (note.vibrato) {
23492
+ const vibratoType = note.vibrato !== VibratoType.None ? note.vibrato : (note.isTieDestination ? note.tieOrigin.vibrato :
23493
+ VibratoType.Slight /* should never happen unless called wrongly */);
23494
+ switch (vibratoType) {
23492
23495
  case VibratoType.Slight:
23493
23496
  phaseLength = this._settings.player.vibrato.noteSlightLength;
23494
23497
  bendAmplitude = this._settings.player.vibrato.noteSlightAmplitude;
@@ -23506,7 +23509,7 @@
23506
23509
  });
23507
23510
  }
23508
23511
  generateVibratorWithParams(noteStart, noteDuration, phaseLength, bendAmplitude, addBend) {
23509
- const resolution = 16;
23512
+ const resolution = this.vibratoResolution;
23510
23513
  const phaseHalf = (phaseLength / 2) | 0;
23511
23514
  // 1st Phase stays at bend 0,
23512
23515
  // then we have a sine wave with the given amplitude and phase length
@@ -25919,52 +25922,89 @@
25919
25922
  }
25920
25923
  }, 5000);
25921
25924
  Logger.debug('Font', `Start checking for font availablility: ${this._families.join(', ')}`);
25922
- let errorHandler = () => {
25925
+ let errorHandler = (e) => {
25923
25926
  if (this._families.length > 1) {
25924
- Logger.debug('Font', `[${this._families[0]}] Loading Failed, switching to ${this._families[1]}`);
25927
+ Logger.debug('Font', `[${this._families[0]}] Loading Failed, switching to ${this._families[1]}`, e);
25925
25928
  this._families.shift();
25926
25929
  window.setTimeout(() => {
25930
+ // tslint:disable-next-line: no-floating-promises
25927
25931
  checkFont();
25928
25932
  }, 0);
25929
25933
  }
25930
25934
  else {
25931
- Logger.error('Font', `[${this._originalFamilies.join(',')}] Loading Failed, rendering cannot start`);
25935
+ Logger.error('Font', `[${this._originalFamilies.join(',')}] Loading Failed, rendering cannot start`, e);
25932
25936
  window.clearInterval(failCounterId);
25937
+ debugger;
25933
25938
  }
25934
25939
  };
25935
25940
  let successHandler = (font) => {
25936
- Logger.debug('Rendering', `[${font}] Font API signaled available`);
25941
+ Logger.debug('Font', `[${font}] Font API signaled available`);
25937
25942
  this.isFontLoaded = true;
25938
25943
  window.clearInterval(failCounterId);
25939
25944
  this.fontLoaded.trigger(this._families[0]);
25940
25945
  };
25941
- let checkFont = () => {
25946
+ let checkFont = async () => {
25942
25947
  // Fast Path: check if one of the specified fonts is already available.
25943
25948
  for (const font of this._families) {
25944
- if (document.fonts.check('1em ' + font)) {
25949
+ if (await this.isFontAvailable(font, false)) {
25945
25950
  successHandler(font);
25946
25951
  return;
25947
25952
  }
25948
25953
  }
25949
25954
  // Slow path: Wait for fonts to be loaded sequentially
25950
- const promise = document.fonts.load(`1em ${this._families[0]}`);
25951
- promise.then(() => {
25952
- Logger.debug('Font', `[${this._families[0]}] Font API signaled loaded`);
25953
- if (document.fonts.check('1em ' + this._families[0])) {
25954
- successHandler(this._families[0]);
25955
- }
25956
- else {
25957
- errorHandler();
25958
- }
25959
- return true;
25960
- }, reason => {
25961
- errorHandler();
25962
- });
25955
+ try {
25956
+ await document.fonts.load(`1em ${this._families[0]}`);
25957
+ }
25958
+ catch (e) {
25959
+ errorHandler(e);
25960
+ }
25961
+ Logger.debug('Font', `[${this._families[0]}] Font API signaled loaded`);
25962
+ if (await this.isFontAvailable(this._families[0], true)) {
25963
+ successHandler(this._families[0]);
25964
+ }
25965
+ else {
25966
+ errorHandler('Font not available');
25967
+ }
25968
+ return true;
25963
25969
  };
25964
25970
  document.fonts.ready.then(() => {
25971
+ // tslint:disable-next-line: no-floating-promises
25965
25972
  checkFont();
25966
25973
  });
25967
25974
  }
25975
+ isFontAvailable(family, advancedCheck) {
25976
+ return new Promise(resolve => {
25977
+ // In some very rare occasions Chrome reports false for the font.
25978
+ // in this case we try to force some refresh and reload by creating an element with this font.
25979
+ const fontString = '1em ' + family;
25980
+ if (document.fonts.check(fontString)) {
25981
+ resolve(true);
25982
+ }
25983
+ else if (advancedCheck) {
25984
+ Logger.debug('Font', `Font ${family} not available, creating test element to trigger load`);
25985
+ const testElement = document.createElement('div');
25986
+ testElement.style.font = fontString;
25987
+ testElement.style.opacity = '0';
25988
+ testElement.style.position = 'absolute';
25989
+ testElement.style.top = '0';
25990
+ testElement.style.left = '0';
25991
+ testElement.innerText = `Trigger ${family} load`;
25992
+ document.body.appendChild(testElement);
25993
+ setTimeout(() => {
25994
+ document.body.removeChild(testElement);
25995
+ if (document.fonts.check(fontString)) {
25996
+ resolve(true);
25997
+ }
25998
+ else {
25999
+ resolve(false);
26000
+ }
26001
+ }, 200);
26002
+ }
26003
+ else {
26004
+ resolve(false);
26005
+ }
26006
+ });
26007
+ }
25968
26008
  }
25969
26009
 
25970
26010
  /**
@@ -27384,7 +27424,7 @@
27384
27424
  if (this._api.settings.core.enableLazyLoading) {
27385
27425
  this._intersectionObserver.unobserve(canvasElement.lastChild);
27386
27426
  }
27387
- canvasElement.removeChild(canvasElement.lastChild);
27427
+ canvasElement.removeChild(canvasElement.lastElementChild);
27388
27428
  }
27389
27429
  }
27390
27430
  else {
@@ -41384,8 +41424,8 @@
41384
41424
  // </auto-generated>
41385
41425
  class VersionInfo {
41386
41426
  }
41387
- VersionInfo.version = '1.3.0-alpha.418';
41388
- VersionInfo.date = '2022-10-11T00:58:31.859Z';
41427
+ VersionInfo.version = '1.3.0-alpha.424';
41428
+ VersionInfo.date = '2022-10-17T01:10:24.242Z';
41389
41429
 
41390
41430
  var index$5 = /*#__PURE__*/Object.freeze({
41391
41431
  __proto__: null,