@famibee/skynovel 1.64.17 → 1.64.18

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/SndBuf.js CHANGED
@@ -294,8 +294,8 @@ var q = se.filter(function(n) {
294
294
  }, e.prototype.play = function(t) {
295
295
  var s = t.start, o = t.end, i = t.speed, r = t.loop, u = t.volume, a = t.muted, l = t.filters;
296
296
  this._paused = !1;
297
- var h = this._media.nodes.cloneBufferSource(), y = h.source, m = h.gain;
298
- this._source = y, this._gain = m, this._speed = i, this._volume = u, this._loop = !!r, this._muted = a, this._filters = l, this.refresh();
297
+ var h = this._media.nodes.cloneBufferSource(), m = h.source, y = h.gain;
298
+ this._source = m, this._gain = y, this._speed = i, this._volume = u, this._loop = !!r, this._muted = a, this._filters = l, this.refresh();
299
299
  var g = this._source.buffer.duration;
300
300
  this._duration = g, this._end = o, this._lastUpdate = this._now(), this._elapsed = s, this._source.onended = this._onComplete.bind(this), this._loop ? (this._source.loopEnd = o, this._source.loopStart = s, this._source.start(0, s)) : o ? this._source.start(0, s, o - s) : this._source.start(0, s), this.emit("start"), this._update(!0), this.enableTicker(!0);
301
301
  }, e.prototype.enableTicker = function(t) {
@@ -496,8 +496,8 @@ var q = se.filter(function(n) {
496
496
  s.start = r.start + (s.start || 0), s.end = r.end, s.speed = r.speed || 1, s.loop = r.loop || s.loop, delete s.sprite;
497
497
  }
498
498
  if (s.offset && (s.start = s.offset), !this.isLoaded) return new Promise(function(a, l) {
499
- o.autoPlay = !0, o._autoPlayOptions = s, o._preload(function(h, y, m) {
500
- h ? l(h) : (s.loaded && s.loaded(h, y, m), a(m));
499
+ o.autoPlay = !0, o._autoPlayOptions = s, o._preload(function(h, m, y) {
500
+ h ? l(h) : (s.loaded && s.loaded(h, m, y), a(y));
501
501
  });
502
502
  });
503
503
  (this.singleInstance || s.singleInstance) && this._removeInstances();
@@ -728,22 +728,22 @@ var q = se.filter(function(n) {
728
728
  this.disconnect(), this.destination = null, this.source = null;
729
729
  }, n;
730
730
  }(), B = { __proto__: null, EqualizerFilter: function(n) {
731
- function e(t, s, o, i, r, u, a, l, h, y) {
732
- t === void 0 && (t = 0), s === void 0 && (s = 0), o === void 0 && (o = 0), i === void 0 && (i = 0), r === void 0 && (r = 0), u === void 0 && (u = 0), a === void 0 && (a = 0), l === void 0 && (l = 0), h === void 0 && (h = 0), y === void 0 && (y = 0);
733
- var m = this;
731
+ function e(t, s, o, i, r, u, a, l, h, m) {
732
+ t === void 0 && (t = 0), s === void 0 && (s = 0), o === void 0 && (o = 0), i === void 0 && (i = 0), r === void 0 && (r = 0), u === void 0 && (u = 0), a === void 0 && (a = 0), l === void 0 && (l = 0), h === void 0 && (h = 0), m === void 0 && (m = 0);
733
+ var y = this;
734
734
  if (!_().useLegacy) {
735
- var g = [{ f: e.F32, type: "lowshelf", gain: t }, { f: e.F64, type: "peaking", gain: s }, { f: e.F125, type: "peaking", gain: o }, { f: e.F250, type: "peaking", gain: i }, { f: e.F500, type: "peaking", gain: r }, { f: e.F1K, type: "peaking", gain: u }, { f: e.F2K, type: "peaking", gain: a }, { f: e.F4K, type: "peaking", gain: l }, { f: e.F8K, type: "peaking", gain: h }, { f: e.F16K, type: "highshelf", gain: y }].map(function($) {
735
+ var g = [{ f: e.F32, type: "lowshelf", gain: t }, { f: e.F64, type: "peaking", gain: s }, { f: e.F125, type: "peaking", gain: o }, { f: e.F250, type: "peaking", gain: i }, { f: e.F500, type: "peaking", gain: r }, { f: e.F1K, type: "peaking", gain: u }, { f: e.F2K, type: "peaking", gain: a }, { f: e.F4K, type: "peaking", gain: l }, { f: e.F8K, type: "peaking", gain: h }, { f: e.F16K, type: "highshelf", gain: m }].map(function($) {
736
736
  var p = _().context.audioContext.createBiquadFilter();
737
737
  return p.type = $.type, v.setParamValue(p.Q, 1), p.frequency.value = $.f, v.setParamValue(p.gain, $.gain), p;
738
738
  });
739
- (m = n.call(this, g[0], g[g.length - 1]) || this).bands = g, m.bandsMap = {};
740
- for (var d = 0; d < m.bands.length; d++) {
741
- var w = m.bands[d];
742
- d > 0 && m.bands[d - 1].connect(w), m.bandsMap[w.frequency.value] = w;
739
+ (y = n.call(this, g[0], g[g.length - 1]) || this).bands = g, y.bandsMap = {};
740
+ for (var d = 0; d < y.bands.length; d++) {
741
+ var w = y.bands[d];
742
+ d > 0 && y.bands[d - 1].connect(w), y.bandsMap[w.frequency.value] = w;
743
743
  }
744
- return m;
744
+ return y;
745
745
  }
746
- m = n.call(this, null) || this;
746
+ y = n.call(this, null) || this;
747
747
  }
748
748
  return b(e, n), e.prototype.setGain = function(t, s) {
749
749
  if (s === void 0 && (s = 0), !this.bandsMap[t]) throw new Error("No band found for frequency ".concat(t));
@@ -913,7 +913,7 @@ class j {
913
913
  return this.#e;
914
914
  }
915
915
  addSnd(e) {
916
- switch (this.loop = e.loop, this.stt.onLoad(this), this.pan !== 0 && (e.filters = [new B.StereoFilter(this.pan)]), this.setVol = (t) => {
916
+ switch (this.snd = e, this.loop = e.loop, this.stt.onLoad(this), this.pan !== 0 && (e.filters = [new B.StereoFilter(this.pan)]), this.setVol = (t) => {
917
917
  e.volume = t;
918
918
  }, this.tw = () => new he(e), this.onPlayEnd = () => {
919
919
  this.stt.onPlayEnd(this.buf), this.#s();
@@ -969,8 +969,8 @@ class f {
969
969
  c.setVal_Nochk("save", l + "fn", s);
970
970
  const h = f.getVol(e, 1);
971
971
  c.setVal_Nochk("save", l + "volume", h);
972
- const y = h * Number(c.getVal("sys:" + l + "volume", 1, !0)), m = A(e, "loop", !1);
973
- m ? (f.#t[t] = s, c.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(f.#t))) : f.delLoopPlay(t), c.setVal_Nochk("save", l + "start_ms", o), c.setVal_Nochk("save", l + "end_ms", i), c.setVal_Nochk("save", l + "ret_ms", r), c.setVal_Nochk("tmp", l + "playing", !0), c.flush();
972
+ const m = h * Number(c.getVal("sys:" + l + "volume", 1, !0)), y = A(e, "loop", !1);
973
+ y ? (f.#t[t] = s, c.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(f.#t))) : f.delLoopPlay(t), c.setVal_Nochk("save", l + "start_ms", o), c.setVal_Nochk("save", l + "end_ms", i), c.setVal_Nochk("save", l + "ret_ms", r), c.setVal_Nochk("tmp", l + "playing", !0), c.flush();
974
974
  const g = z.find(s);
975
975
  this.#e = new j(
976
976
  s,
@@ -978,14 +978,14 @@ class f {
978
978
  o,
979
979
  i,
980
980
  r,
981
- y,
981
+ m,
982
982
  u,
983
983
  g
984
984
  );
985
985
  const d = {
986
- loop: m,
986
+ loop: y,
987
987
  speed: a,
988
- volume: y,
988
+ volume: m,
989
989
  loaded: (p, x) => {
990
990
  if (!this.#e.stt.isDestroy) {
991
991
  if (p) {
@@ -1012,7 +1012,7 @@ class f {
1012
1012
  p.end < 0 && (p.end += M, I.removeSprites(w), I.addSprites(w, p)), p.end <= p.start && S.errScript(`[playse] end_ms:${i}(${p.end * 1e3}) >= start_ms:${o} は異常値です`), p.end * 1e3 <= r && S.errScript(`[playse] end_ms:${i}(${p.end * 1e3}) <= ret_ms:${r} は異常値です`), M <= p.start && S.errScript(`[playse] 音声ファイル再生時間:${M * 1e3} <= start_ms:${o} は異常値です`), i !== f.MAX_END_MS && M <= p.end && S.errScript(`[playse] 音声ファイル再生時間:${M * 1e3} <= end_ms:${i} は異常値です`), I.play(w, (re) => d.complete?.(re));
1013
1013
  };
1014
1014
  } else d.autoPlay = !0;
1015
- if (m ? r !== 0 && (d.loop = !1, d.complete = (p) => {
1015
+ if (y ? r !== 0 && (d.loop = !1, d.complete = (p) => {
1016
1016
  const x = p.duration, C = r / 1e3, E = i / 1e3;
1017
1017
  x <= C && S.errScript(`[playse] 音声ファイル再生時間:${x * 1e3} <= ret_ms:${r} は異常値です`), p.play({
1018
1018
  // 一周目はループなし、なのでキャッシュされてる
@@ -1032,7 +1032,7 @@ class f {
1032
1032
  }) : d.complete = () => {
1033
1033
  W(this.#e, t), this.#e.onPlayEnd();
1034
1034
  }, this.#s(), g) {
1035
- if (g.volume = y, w) this.#n(s, d);
1035
+ if (g.volume = m, w) this.#n(s, d);
1036
1036
  else if (g.isPlayable) {
1037
1037
  const p = g.options.source;
1038
1038
  !(p instanceof ArrayBuffer) || p.byteLength === 0 ? g.play(d) : this.#e.addSnd(N.from({
@@ -1180,12 +1180,17 @@ class G {
1180
1180
  e.setVol(u), e.stt = a ? new P(e) : new G(e);
1181
1181
  return;
1182
1182
  }
1183
- const y = e.tw();
1184
- y && (pe.setTwProp(y, t).to({ volume: u }, l).onUpdate(() => {
1185
- e.snd?.isPlaying || (y.stop(), y.onComplete());
1183
+ if (!e.snd) return;
1184
+ const m = e.tw();
1185
+ m && (pe.setTwProp(m, t).to({ volume: u }, l).onUpdate((y) => {
1186
+ if (e.snd?.isPlaying) {
1187
+ e.snd.volume = y.volume;
1188
+ return;
1189
+ }
1190
+ m.stop(), m.onComplete();
1186
1191
  }).onComplete(() => {
1187
- fe(y), e.stt.compFade(s), e.stt = a ? new P(e) : new G(e);
1188
- }).start(), e.stt = new je(y, e));
1192
+ fe(m), e.stt.compFade(s), e.stt = a ? new P(e) : new G(e);
1193
+ }).start(), e.stt = new je(m, e));
1189
1194
  }
1190
1195
  wf = () => !1;
1191
1196
  // ok