@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.mjs 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
  *
@@ -25571,7 +25571,7 @@ class AlphaSynthWebAudioOutputBase {
25571
25571
  get sampleRate() {
25572
25572
  return this._context ? this._context.sampleRate : AlphaSynthWebAudioOutputBase.PreferredSampleRate;
25573
25573
  }
25574
- activate() {
25574
+ activate(resumedCallback) {
25575
25575
  if (!this._context) {
25576
25576
  this._context = this.createAudioContext();
25577
25577
  }
@@ -25580,15 +25580,18 @@ class AlphaSynthWebAudioOutputBase {
25580
25580
  this._context.resume().then(() => {
25581
25581
  var _a, _b;
25582
25582
  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}`);
25583
+ if (resumedCallback) {
25584
+ resumedCallback();
25585
+ }
25583
25586
  }, reason => {
25584
25587
  var _a, _b;
25585
- 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}`);
25588
+ 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}`);
25586
25589
  });
25587
25590
  }
25588
25591
  }
25589
25592
  patchIosSampleRate() {
25590
25593
  let ua = navigator.userAgent;
25591
- if (ua.indexOf('iPhone') !== -1 || ua.indexOf('iPad') !== 0) {
25594
+ if (ua.indexOf('iPhone') !== -1 || ua.indexOf('iPad') !== -1) {
25592
25595
  let context = this.createAudioContext();
25593
25596
  let buffer = context.createBuffer(1, 1, AlphaSynthWebAudioOutputBase.PreferredSampleRate);
25594
25597
  let dummy = context.createBufferSource();
@@ -25612,20 +25615,25 @@ class AlphaSynthWebAudioOutputBase {
25612
25615
  open() {
25613
25616
  this.patchIosSampleRate();
25614
25617
  this._context = this.createAudioContext();
25615
- // possible fix for Web Audio in iOS 9 (issue #4)
25616
25618
  let ctx = this._context;
25617
25619
  if (ctx.state === 'suspended') {
25618
- let resume = () => {
25619
- ctx.resume();
25620
- Environment.globalThis.setTimeout(() => {
25621
- if (ctx.state === 'running') {
25622
- document.body.removeEventListener('touchend', resume, false);
25623
- document.body.removeEventListener('click', resume, false);
25624
- }
25625
- }, 0);
25626
- };
25627
- document.body.addEventListener('touchend', resume, false);
25628
- document.body.addEventListener('click', resume, false);
25620
+ this.registerResumeHandler();
25621
+ }
25622
+ }
25623
+ registerResumeHandler() {
25624
+ this._resumeHandler = (() => {
25625
+ this.activate(() => {
25626
+ this.unregisterResumeHandler();
25627
+ });
25628
+ }).bind(this);
25629
+ document.body.addEventListener('touchend', this._resumeHandler, false);
25630
+ document.body.addEventListener('click', this._resumeHandler, false);
25631
+ }
25632
+ unregisterResumeHandler() {
25633
+ const resumeHandler = this._resumeHandler;
25634
+ if (resumeHandler) {
25635
+ document.body.removeEventListener('touchend', resumeHandler, false);
25636
+ document.body.removeEventListener('click', resumeHandler, false);
25629
25637
  }
25630
25638
  }
25631
25639
  play() {
@@ -25648,6 +25656,8 @@ class AlphaSynthWebAudioOutputBase {
25648
25656
  var _a;
25649
25657
  this.pause();
25650
25658
  (_a = this._context) === null || _a === void 0 ? void 0 : _a.close();
25659
+ this._context = null;
25660
+ this.unregisterResumeHandler();
25651
25661
  }
25652
25662
  onSamplesPlayed(numberOfSamples) {
25653
25663
  this.samplesPlayed.trigger(numberOfSamples);
@@ -27143,7 +27153,6 @@ class AlphaTabApi extends AlphaTabApiBase {
27143
27153
  SettingsSerializer.fromJson(settings, additionalSettings);
27144
27154
  let alphaTab = new AlphaTabApi(a4, settings);
27145
27155
  alphaTab.renderer.postRenderFinished.on(() => {
27146
- alphaTab.canvasElement.height = -1;
27147
27156
  preview.print();
27148
27157
  });
27149
27158
  alphaTab.renderTracks(this.tracks);
@@ -40632,8 +40641,8 @@ class CoreSettings {
40632
40641
  // </auto-generated>
40633
40642
  class VersionInfo {
40634
40643
  }
40635
- VersionInfo.version = '1.3.0-alpha.189';
40636
- VersionInfo.date = '2022-02-26T16:57:03.536Z';
40644
+ VersionInfo.version = '1.3.0-alpha.190';
40645
+ VersionInfo.date = '2022-02-27T00:33:54.943Z';
40637
40646
 
40638
40647
  var index$5 = /*#__PURE__*/Object.freeze({
40639
40648
  __proto__: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coderline/alphatab",
3
- "version": "1.3.0-alpha.189",
3
+ "version": "1.3.0-alpha.190",
4
4
  "description": "alphaTab is a music notation and guitar tablature rendering library",
5
5
  "keywords": [
6
6
  "guitar",