@coderline/alphatab 1.3.0-alpha.184 → 1.3.0-alpha.193

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.
@@ -800,8 +800,10 @@ declare class PlayerSettings {
800
800
  soundFont: string | null;
801
801
  /**
802
802
  * Gets or sets the element that should be used for scrolling.
803
+ * @target web
804
+ * @json_read_only
803
805
  */
804
- scrollElement: string;
806
+ scrollElement: string | HTMLElement;
805
807
  /**
806
808
  * Gets or sets whether the player should be enabled.
807
809
  */
@@ -4969,10 +4971,10 @@ declare class AlphaTabApiBase<TSettings> {
4969
4971
  /**
4970
4972
  * @target web
4971
4973
  */
4972
- declare class AlphaTabApi extends AlphaTabApiBase<unknown> {
4973
- constructor(element: HTMLElement, options: unknown);
4974
+ declare class AlphaTabApi extends AlphaTabApiBase<any | Settings> {
4975
+ constructor(element: HTMLElement, options: any | Settings);
4974
4976
  tex(tex: string, tracks?: number[]): void;
4975
- print(width: string, additionalSettings?: unknown): void;
4977
+ print(width?: string, additionalSettings?: unknown): void;
4976
4978
  downloadMidi(): void;
4977
4979
  changeTrackMute(tracks: Track[], mute: boolean): void;
4978
4980
  changeTrackSolo(tracks: Track[], solo: boolean): void;
package/dist/alphaTab.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.184 (develop, build 184)
2
+ * alphaTab v1.3.0-alpha.193 (develop, build 193)
3
3
  *
4
4
  * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -18536,6 +18536,8 @@
18536
18536
  this.soundFont = null;
18537
18537
  /**
18538
18538
  * Gets or sets the element that should be used for scrolling.
18539
+ * @target web
18540
+ * @json_read_only
18539
18541
  */
18540
18542
  this.scrollElement = 'html,body';
18541
18543
  /**
@@ -19043,7 +19045,6 @@
19043
19045
  }
19044
19046
  const o = new Map();
19045
19047
  o.set("soundfont", obj.soundFont);
19046
- o.set("scrollelement", obj.scrollElement);
19047
19048
  o.set("enableplayer", obj.enablePlayer);
19048
19049
  o.set("enablecursor", obj.enableCursor);
19049
19050
  o.set("enableanimatedbeatcursor", obj.enableAnimatedBeatCursor);
@@ -19067,6 +19068,7 @@
19067
19068
  case "soundfont":
19068
19069
  obj.soundFont = v;
19069
19070
  return true;
19071
+ /*@target web*/
19070
19072
  case "scrollelement":
19071
19073
  obj.scrollElement = v;
19072
19074
  return true;
@@ -25575,7 +25577,7 @@
25575
25577
  get sampleRate() {
25576
25578
  return this._context ? this._context.sampleRate : AlphaSynthWebAudioOutputBase.PreferredSampleRate;
25577
25579
  }
25578
- activate() {
25580
+ activate(resumedCallback) {
25579
25581
  if (!this._context) {
25580
25582
  this._context = this.createAudioContext();
25581
25583
  }
@@ -25584,15 +25586,18 @@
25584
25586
  this._context.resume().then(() => {
25585
25587
  var _a, _b;
25586
25588
  Logger.debug('WebAudio', `Audio Context resume success: state=${(_a = this._context) === null || _a === void 0 ? void 0 : _a.state}, sampleRate:${(_b = this._context) === null || _b === void 0 ? void 0 : _b.sampleRate}`);
25589
+ if (resumedCallback) {
25590
+ resumedCallback();
25591
+ }
25587
25592
  }, reason => {
25588
25593
  var _a, _b;
25589
- Logger.debug('WebAudio', `Audio Context resume failed: state=${(_a = this._context) === null || _a === void 0 ? void 0 : _a.state}, sampleRate:${(_b = this._context) === null || _b === void 0 ? void 0 : _b.sampleRate}, reason=${reason}`);
25594
+ Logger.warning('WebAudio', `Audio Context resume failed: state=${(_a = this._context) === null || _a === void 0 ? void 0 : _a.state}, sampleRate:${(_b = this._context) === null || _b === void 0 ? void 0 : _b.sampleRate}, reason=${reason}`);
25590
25595
  });
25591
25596
  }
25592
25597
  }
25593
25598
  patchIosSampleRate() {
25594
25599
  let ua = navigator.userAgent;
25595
- if (ua.indexOf('iPhone') !== -1 || ua.indexOf('iPad') !== 0) {
25600
+ if (ua.indexOf('iPhone') !== -1 || ua.indexOf('iPad') !== -1) {
25596
25601
  let context = this.createAudioContext();
25597
25602
  let buffer = context.createBuffer(1, 1, AlphaSynthWebAudioOutputBase.PreferredSampleRate);
25598
25603
  let dummy = context.createBufferSource();
@@ -25616,20 +25621,25 @@
25616
25621
  open() {
25617
25622
  this.patchIosSampleRate();
25618
25623
  this._context = this.createAudioContext();
25619
- // possible fix for Web Audio in iOS 9 (issue #4)
25620
25624
  let ctx = this._context;
25621
25625
  if (ctx.state === 'suspended') {
25622
- let resume = () => {
25623
- ctx.resume();
25624
- Environment.globalThis.setTimeout(() => {
25625
- if (ctx.state === 'running') {
25626
- document.body.removeEventListener('touchend', resume, false);
25627
- document.body.removeEventListener('click', resume, false);
25628
- }
25629
- }, 0);
25630
- };
25631
- document.body.addEventListener('touchend', resume, false);
25632
- document.body.addEventListener('click', resume, false);
25626
+ this.registerResumeHandler();
25627
+ }
25628
+ }
25629
+ registerResumeHandler() {
25630
+ this._resumeHandler = (() => {
25631
+ this.activate(() => {
25632
+ this.unregisterResumeHandler();
25633
+ });
25634
+ }).bind(this);
25635
+ document.body.addEventListener('touchend', this._resumeHandler, false);
25636
+ document.body.addEventListener('click', this._resumeHandler, false);
25637
+ }
25638
+ unregisterResumeHandler() {
25639
+ const resumeHandler = this._resumeHandler;
25640
+ if (resumeHandler) {
25641
+ document.body.removeEventListener('touchend', resumeHandler, false);
25642
+ document.body.removeEventListener('click', resumeHandler, false);
25633
25643
  }
25634
25644
  }
25635
25645
  play() {
@@ -25652,6 +25662,8 @@
25652
25662
  var _a;
25653
25663
  this.pause();
25654
25664
  (_a = this._context) === null || _a === void 0 ? void 0 : _a.close();
25665
+ this._context = null;
25666
+ this.unregisterResumeHandler();
25655
25667
  }
25656
25668
  onSamplesPlayed(numberOfSamples) {
25657
25669
  this.samplesPlayed.trigger(numberOfSamples);
@@ -27147,7 +27159,6 @@
27147
27159
  SettingsSerializer.fromJson(settings, additionalSettings);
27148
27160
  let alphaTab = new AlphaTabApi(a4, settings);
27149
27161
  alphaTab.renderer.postRenderFinished.on(() => {
27150
- alphaTab.canvasElement.height = -1;
27151
27162
  preview.print();
27152
27163
  });
27153
27164
  alphaTab.renderTracks(this.tracks);
@@ -40636,8 +40647,8 @@
40636
40647
  // </auto-generated>
40637
40648
  class VersionInfo {
40638
40649
  }
40639
- VersionInfo.version = '1.3.0-alpha.184';
40640
- VersionInfo.date = '2022-02-22T00:33:41.955Z';
40650
+ VersionInfo.version = '1.3.0-alpha.193';
40651
+ VersionInfo.date = '2022-03-01T00:46:27.049Z';
40641
40652
 
40642
40653
  var index$5 = /*#__PURE__*/Object.freeze({
40643
40654
  __proto__: null,