@coderline/alphatab 1.3.0-alpha.189 → 1.3.0-alpha.190

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * alphaTab v1.3.0-alpha.189 (develop, build 189)
2
+ * alphaTab v1.3.0-alpha.190 (develop, build 190)
3
3
  *
4
4
  * Copyright © 2022, Daniel Kuschny and Contributors, All rights reserved.
5
5
  *
@@ -25577,7 +25577,7 @@
25577
25577
  get sampleRate() {
25578
25578
  return this._context ? this._context.sampleRate : AlphaSynthWebAudioOutputBase.PreferredSampleRate;
25579
25579
  }
25580
- activate() {
25580
+ activate(resumedCallback) {
25581
25581
  if (!this._context) {
25582
25582
  this._context = this.createAudioContext();
25583
25583
  }
@@ -25586,15 +25586,18 @@
25586
25586
  this._context.resume().then(() => {
25587
25587
  var _a, _b;
25588
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
+ }
25589
25592
  }, reason => {
25590
25593
  var _a, _b;
25591
- 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}`);
25592
25595
  });
25593
25596
  }
25594
25597
  }
25595
25598
  patchIosSampleRate() {
25596
25599
  let ua = navigator.userAgent;
25597
- if (ua.indexOf('iPhone') !== -1 || ua.indexOf('iPad') !== 0) {
25600
+ if (ua.indexOf('iPhone') !== -1 || ua.indexOf('iPad') !== -1) {
25598
25601
  let context = this.createAudioContext();
25599
25602
  let buffer = context.createBuffer(1, 1, AlphaSynthWebAudioOutputBase.PreferredSampleRate);
25600
25603
  let dummy = context.createBufferSource();
@@ -25618,20 +25621,25 @@
25618
25621
  open() {
25619
25622
  this.patchIosSampleRate();
25620
25623
  this._context = this.createAudioContext();
25621
- // possible fix for Web Audio in iOS 9 (issue #4)
25622
25624
  let ctx = this._context;
25623
25625
  if (ctx.state === 'suspended') {
25624
- let resume = () => {
25625
- ctx.resume();
25626
- Environment.globalThis.setTimeout(() => {
25627
- if (ctx.state === 'running') {
25628
- document.body.removeEventListener('touchend', resume, false);
25629
- document.body.removeEventListener('click', resume, false);
25630
- }
25631
- }, 0);
25632
- };
25633
- document.body.addEventListener('touchend', resume, false);
25634
- 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);
25635
25643
  }
25636
25644
  }
25637
25645
  play() {
@@ -25654,6 +25662,8 @@
25654
25662
  var _a;
25655
25663
  this.pause();
25656
25664
  (_a = this._context) === null || _a === void 0 ? void 0 : _a.close();
25665
+ this._context = null;
25666
+ this.unregisterResumeHandler();
25657
25667
  }
25658
25668
  onSamplesPlayed(numberOfSamples) {
25659
25669
  this.samplesPlayed.trigger(numberOfSamples);
@@ -27149,7 +27159,6 @@
27149
27159
  SettingsSerializer.fromJson(settings, additionalSettings);
27150
27160
  let alphaTab = new AlphaTabApi(a4, settings);
27151
27161
  alphaTab.renderer.postRenderFinished.on(() => {
27152
- alphaTab.canvasElement.height = -1;
27153
27162
  preview.print();
27154
27163
  });
27155
27164
  alphaTab.renderTracks(this.tracks);
@@ -40638,8 +40647,8 @@
40638
40647
  // </auto-generated>
40639
40648
  class VersionInfo {
40640
40649
  }
40641
- VersionInfo.version = '1.3.0-alpha.189';
40642
- VersionInfo.date = '2022-02-26T16:57:03.536Z';
40650
+ VersionInfo.version = '1.3.0-alpha.190';
40651
+ VersionInfo.date = '2022-02-27T00:33:54.943Z';
40643
40652
 
40644
40653
  var index$5 = /*#__PURE__*/Object.freeze({
40645
40654
  __proto__: null,