@onjmin/dtm 0.1.74 → 0.1.75

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/index.js CHANGED
@@ -7920,6 +7920,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
7920
7920
  currentPlaySec = playOffsetSec;
7921
7921
  ownCtx ??= options.audioContext ? null : new AudioContext();
7922
7922
  const ctx = options.audioContext ?? ownCtx;
7923
+ const resumePromise = ctx.state === "suspended" ? ctx.resume() : Promise.resolve();
7923
7924
  const cutGain = ctx.createGain();
7924
7925
  cutGain.connect(ctx.destination);
7925
7926
  activeCut = { gain: cutGain, ctx };
@@ -7931,18 +7932,15 @@ var mountChordPlayer = (target, chords, options = {}) => {
7931
7932
  setProgress(totalSec > 0 ? playOffsetSec / totalSec : 0);
7932
7933
  playInternal(startIdx, ctx, cutGain);
7933
7934
  };
7934
- if (activeGmName && !_wafCache.has(activeGmName)) {
7935
- const myAbortId = ++loadAbortId;
7936
- setLoadingUI(true);
7937
- loadWafFont(ctx, activeGmName).then(() => {
7938
- if (loadAbortId !== myAbortId) return;
7939
- setLoadingUI(false);
7940
- startPlayback();
7941
- });
7942
- } else {
7935
+ const myAbortId = ++loadAbortId;
7936
+ setLoadingUI(true);
7937
+ const wafPromise = activeGmName && !_wafCache.has(activeGmName) ? loadWafFont(ctx, activeGmName) : Promise.resolve(null);
7938
+ Promise.all([resumePromise, wafPromise]).then(() => {
7939
+ if (loadAbortId !== myAbortId) return;
7940
+ setLoadingUI(false);
7943
7941
  startPlayback();
7944
- }
7945
- preloadInstruments();
7942
+ preloadInstruments();
7943
+ });
7946
7944
  };
7947
7945
  const seekTo = (idx) => {
7948
7946
  if (isLoading) {
package/dist/index.mjs CHANGED
@@ -7797,6 +7797,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
7797
7797
  currentPlaySec = playOffsetSec;
7798
7798
  ownCtx ??= options.audioContext ? null : new AudioContext();
7799
7799
  const ctx = options.audioContext ?? ownCtx;
7800
+ const resumePromise = ctx.state === "suspended" ? ctx.resume() : Promise.resolve();
7800
7801
  const cutGain = ctx.createGain();
7801
7802
  cutGain.connect(ctx.destination);
7802
7803
  activeCut = { gain: cutGain, ctx };
@@ -7808,18 +7809,15 @@ var mountChordPlayer = (target, chords, options = {}) => {
7808
7809
  setProgress(totalSec > 0 ? playOffsetSec / totalSec : 0);
7809
7810
  playInternal(startIdx, ctx, cutGain);
7810
7811
  };
7811
- if (activeGmName && !_wafCache.has(activeGmName)) {
7812
- const myAbortId = ++loadAbortId;
7813
- setLoadingUI(true);
7814
- loadWafFont(ctx, activeGmName).then(() => {
7815
- if (loadAbortId !== myAbortId) return;
7816
- setLoadingUI(false);
7817
- startPlayback();
7818
- });
7819
- } else {
7812
+ const myAbortId = ++loadAbortId;
7813
+ setLoadingUI(true);
7814
+ const wafPromise = activeGmName && !_wafCache.has(activeGmName) ? loadWafFont(ctx, activeGmName) : Promise.resolve(null);
7815
+ Promise.all([resumePromise, wafPromise]).then(() => {
7816
+ if (loadAbortId !== myAbortId) return;
7817
+ setLoadingUI(false);
7820
7818
  startPlayback();
7821
- }
7822
- preloadInstruments();
7819
+ preloadInstruments();
7820
+ });
7823
7821
  };
7824
7822
  const seekTo = (idx) => {
7825
7823
  if (isLoading) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "onjmin",
3
3
  "license": "MIT",
4
4
  "name": "@onjmin/dtm",
5
- "version": "0.1.74",
5
+ "version": "0.1.75",
6
6
  "description": "MMLを中間言語に用いた、モバイルファーストなDAW / ピアノロール打ち込みコンポーネント",
7
7
  "homepage": "https://onjmin.github.io/dtm",
8
8
  "repository": {