@famibee/skynovel 1.64.14 → 1.64.16

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
@@ -1,6 +1,6 @@
1
- import { m as R, n as w, T as M, o as ue, l as F, e as A, S as ae, L as le } from "./web2.js";
2
- import { C as ce } from "./CmnTween.js";
3
- import { a as L, T as pe, r as he } from "./Reading.js";
1
+ import { m as R, n as O, T, o as ue, l as F, e as A, S as ae, L as le, a as ce } from "./web2.js";
2
+ import { C as pe } from "./CmnTween.js";
3
+ import { a as L, T as he, r as fe } from "./Reading.js";
4
4
  var ee;
5
5
  function _() {
6
6
  return ee;
@@ -25,29 +25,29 @@ var V = function() {
25
25
  return n;
26
26
  }).apply(this, arguments);
27
27
  }, se = ["mp3", "ogg", "oga", "opus", "mpeg", "wav", "m4a", "aiff", "wma", "mid", "caf"], K = {};
28
- function fe(n) {
28
+ function de(n) {
29
29
  var e = V({ m4a: "audio/mp4", oga: "audio/ogg", opus: 'audio/ogg; codecs="opus"', caf: 'audio/x-caf; codecs="opus"' }, n || {}), t = document.createElement("audio"), s = {}, o = /^no$/;
30
- se.forEach(function(r) {
31
- var i = t.canPlayType("audio/".concat(r)).replace(o, ""), u = e[r] ? t.canPlayType(e[r]).replace(o, "") : "";
32
- s[r] = !!i || !!u;
30
+ se.forEach(function(i) {
31
+ var r = t.canPlayType("audio/".concat(i)).replace(o, ""), u = e[i] ? t.canPlayType(e[i]).replace(o, "") : "";
32
+ s[i] = !!r || !!u;
33
33
  }), Object.assign(K, s);
34
34
  }
35
- fe();
36
- var de = /\.(\{([^\}]+)\})(\?.*)?$/;
35
+ de();
36
+ var _e = /\.(\{([^\}]+)\})(\?.*)?$/;
37
37
  function ne(n) {
38
- var e = de, t = typeof n == "string" ? n : n.url;
38
+ var e = _e, t = typeof n == "string" ? n : n.url;
39
39
  if (!e.test(t)) return t;
40
- for (var s = e.exec(t), o = s[2].split(","), r = o[o.length - 1], i = 0, u = o.length; i < u; i++) {
41
- var a = o[i];
40
+ for (var s = e.exec(t), o = s[2].split(","), i = o[o.length - 1], r = 0, u = o.length; r < u; r++) {
41
+ var a = o[r];
42
42
  if (K[a]) {
43
- r = a;
43
+ i = a;
44
44
  break;
45
45
  }
46
46
  }
47
- var l = t.replace(s[1], r);
47
+ var l = t.replace(s[1], i);
48
48
  if (typeof n != "string") {
49
49
  var h = n;
50
- h.extension = r, h.url = l;
50
+ h.extension = i, h.url = l;
51
51
  }
52
52
  return l;
53
53
  }
@@ -60,19 +60,19 @@ var q = se.filter(function(n) {
60
60
  n.setLegacy(_().useLegacy);
61
61
  }, n.setLegacy = function(e) {
62
62
  e ? q.forEach(function(t) {
63
- w.setExtensionXhrType(t, w.XHR_RESPONSE_TYPE.DEFAULT), w.setExtensionLoadType(t, w.LOAD_TYPE.AUDIO);
63
+ O.setExtensionXhrType(t, O.XHR_RESPONSE_TYPE.DEFAULT), O.setExtensionLoadType(t, O.LOAD_TYPE.AUDIO);
64
64
  }) : q.forEach(function(t) {
65
- w.setExtensionXhrType(t, w.XHR_RESPONSE_TYPE.BUFFER), w.setExtensionLoadType(t, w.LOAD_TYPE.XHR);
65
+ O.setExtensionXhrType(t, O.XHR_RESPONSE_TYPE.BUFFER), O.setExtensionLoadType(t, O.LOAD_TYPE.XHR);
66
66
  });
67
67
  }, n.pre = function(e, t) {
68
68
  ne(e), t();
69
69
  }, n.use = function(e, t) {
70
70
  e.data && q.indexOf(e.extension) > -1 ? e.sound = _().add(e.name, { loaded: t, preload: !0, url: e.url, source: e.data }) : t();
71
71
  }, n.extension = "loader", n;
72
- }(), _e = 0, ye = function(n) {
72
+ }(), ye = 0, me = function(n) {
73
73
  function e(t) {
74
74
  var s = n.call(this) || this;
75
- return s.id = _e++, s.init(t), s;
75
+ return s.id = ye++, s.init(t), s;
76
76
  }
77
77
  return b(e, n), e.prototype.set = function(t, s) {
78
78
  if (this[t] === void 0) throw new Error("Property with name ".concat(t, " does not exist."));
@@ -133,35 +133,35 @@ var q = se.filter(function(n) {
133
133
  }, enumerable: !1, configurable: !0 }), e.prototype.refresh = function() {
134
134
  var t = this._media.context, s = this._media.parent;
135
135
  this._source.loop = this._loop || s.loop;
136
- var o = t.volume * (t.muted ? 0 : 1), r = s.volume * (s.muted ? 0 : 1), i = this._volume * (this._muted ? 0 : 1);
137
- this._source.volume = i * o * r, this._source.playbackRate = this._speed * t.speed * s.speed;
136
+ var o = t.volume * (t.muted ? 0 : 1), i = s.volume * (s.muted ? 0 : 1), r = this._volume * (this._muted ? 0 : 1);
137
+ this._source.volume = r * o * i, this._source.playbackRate = this._speed * t.speed * s.speed;
138
138
  }, e.prototype.refreshPaused = function() {
139
139
  var t = this._media.context, s = this._media.parent, o = this._paused || s.paused || t.paused;
140
140
  o !== this._pausedReal && (this._pausedReal = o, o ? (this._internalStop(), this.emit("paused")) : (this.emit("resumed"), this.play({ start: this._source.currentTime, end: this._end, volume: this._volume, speed: this._speed, loop: this._loop })), this.emit("pause", o));
141
141
  }, e.prototype.play = function(t) {
142
- var s = this, o = t.start, r = t.end, i = t.speed, u = t.loop, a = t.volume, l = t.muted;
143
- this._speed = i, this._volume = a, this._loop = !!u, this._muted = l, this.refresh(), this.loop && r !== null && (this.loop = !1), this._start = o, this._end = r || this._duration, this._start = Math.max(0, this._start - e.PADDING), this._end = Math.min(this._end + e.PADDING, this._duration), this._source.onloadedmetadata = function() {
144
- s._source && (s._source.currentTime = o, s._source.onloadedmetadata = null, s.emit("progress", o, s._duration), M.shared.add(s._onUpdate, s));
142
+ var s = this, o = t.start, i = t.end, r = t.speed, u = t.loop, a = t.volume, l = t.muted;
143
+ this._speed = r, this._volume = a, this._loop = !!u, this._muted = l, this.refresh(), this.loop && i !== null && (this.loop = !1), this._start = o, this._end = i || this._duration, this._start = Math.max(0, this._start - e.PADDING), this._end = Math.min(this._end + e.PADDING, this._duration), this._source.onloadedmetadata = function() {
144
+ s._source && (s._source.currentTime = o, s._source.onloadedmetadata = null, s.emit("progress", o, s._duration), T.shared.add(s._onUpdate, s));
145
145
  }, this._source.onended = this._onComplete.bind(this), this._source.play(), this.emit("start");
146
146
  }, e.prototype._onUpdate = function() {
147
147
  this.emit("progress", this.progress, this._duration), this._source.currentTime >= this._end && !this._source.loop && this._onComplete();
148
148
  }, e.prototype._onComplete = function() {
149
- M.shared.remove(this._onUpdate, this), this._internalStop(), this.emit("progress", 1, this._duration), this.emit("end", this);
149
+ T.shared.remove(this._onUpdate, this), this._internalStop(), this.emit("progress", 1, this._duration), this.emit("end", this);
150
150
  }, e.prototype.destroy = function() {
151
- M.shared.remove(this._onUpdate, this), this.removeAllListeners();
151
+ T.shared.remove(this._onUpdate, this), this.removeAllListeners();
152
152
  var t = this._source;
153
153
  t && (t.onended = null, t.onplay = null, t.onpause = null, this._internalStop()), this._source = null, this._speed = 1, this._volume = 1, this._loop = !1, this._end = null, this._start = 0, this._duration = 0, this._playing = !1, this._pausedReal = !1, this._paused = !1, this._muted = !1, this._media && (this._media.context.off("refresh", this.refresh, this), this._media.context.off("refreshPaused", this.refreshPaused, this), this._media = null);
154
154
  }, e.prototype.toString = function() {
155
155
  return "[HTMLAudioInstance id=".concat(this.id, "]");
156
156
  }, e.PADDING = 0.1, e;
157
- }(R), me = function(n) {
157
+ }(R), ge = function(n) {
158
158
  function e() {
159
159
  return n !== null && n.apply(this, arguments) || this;
160
160
  }
161
161
  return b(e, n), e.prototype.init = function(t) {
162
162
  this.parent = t, this._source = t.options.source || new Audio(), t.url && (this._source.src = t.url);
163
163
  }, e.prototype.create = function() {
164
- return new ye(this);
164
+ return new me(this);
165
165
  }, Object.defineProperty(e.prototype, "isPlayable", { get: function() {
166
166
  return !!this._source && this._source.readyState === 4;
167
167
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "duration", { get: function() {
@@ -179,20 +179,20 @@ var q = se.filter(function(n) {
179
179
  var s = this._source, o = this.parent;
180
180
  if (s.readyState !== 4) if (o.url) {
181
181
  s.src = o.url;
182
- var r = function() {
182
+ var i = function() {
183
183
  a(), o.isLoaded = !0;
184
184
  var h = o.autoPlayStart();
185
185
  t && t(null, o, h);
186
- }, i = function() {
186
+ }, r = function() {
187
187
  a(), t && t(new Error("Sound loading has been aborted"));
188
188
  }, u = function() {
189
189
  a();
190
190
  var h = "Failed to load audio element (code: ".concat(s.error.code, ")");
191
191
  t && t(new Error(h));
192
192
  }, a = function() {
193
- s.removeEventListener("canplaythrough", r), s.removeEventListener("load", r), s.removeEventListener("abort", i), s.removeEventListener("error", u);
193
+ s.removeEventListener("canplaythrough", i), s.removeEventListener("load", i), s.removeEventListener("abort", r), s.removeEventListener("error", u);
194
194
  };
195
- s.addEventListener("canplaythrough", r, !1), s.addEventListener("load", r, !1), s.addEventListener("abort", i, !1), s.addEventListener("error", u, !1), s.load();
195
+ s.addEventListener("canplaythrough", i, !1), s.addEventListener("load", i, !1), s.addEventListener("abort", r, !1), s.addEventListener("error", u, !1), s.load();
196
196
  } else t(new Error("sound.url or sound.source must be set"));
197
197
  else {
198
198
  o.isLoaded = !0;
@@ -202,7 +202,7 @@ var q = se.filter(function(n) {
202
202
  }, 0);
203
203
  }
204
204
  }, e;
205
- }(R), ge = function() {
205
+ }(R), be = function() {
206
206
  function n(e, t) {
207
207
  this.parent = e, Object.assign(this, t), this.duration = this.end - this.start;
208
208
  }
@@ -221,10 +221,10 @@ var q = se.filter(function(n) {
221
221
  } else e.value = t;
222
222
  return t;
223
223
  }, n;
224
- }(), be = 0, ve = function(n) {
224
+ }(), ve = 0, Pe = function(n) {
225
225
  function e(t) {
226
226
  var s = n.call(this) || this;
227
- return s.id = be++, s._media = null, s._paused = !1, s._muted = !1, s._elapsed = 0, s.init(t), s;
227
+ return s.id = ve++, s._media = null, s._paused = !1, s._muted = !1, s._elapsed = 0, s.init(t), s;
228
228
  }
229
229
  return b(e, n), e.prototype.set = function(t, s) {
230
230
  if (this[t] === void 0) throw new Error("Property with name ".concat(t, " does not exist."));
@@ -276,8 +276,8 @@ var q = se.filter(function(n) {
276
276
  if (this._source) {
277
277
  var t = this._media.context, s = this._media.parent;
278
278
  this._source.loop = this._loop || s.loop;
279
- var o = t.volume * (t.muted ? 0 : 1), r = s.volume * (s.muted ? 0 : 1), i = this._volume * (this._muted ? 0 : 1);
280
- v.setParamValue(this._gain.gain, i * r * o), v.setParamValue(this._source.playbackRate, this._speed * s.speed * t.speed), this.applyFilters();
279
+ var o = t.volume * (t.muted ? 0 : 1), i = s.volume * (s.muted ? 0 : 1), r = this._volume * (this._muted ? 0 : 1);
280
+ v.setParamValue(this._gain.gain, r * i * o), v.setParamValue(this._source.playbackRate, this._speed * s.speed * t.speed), this.applyFilters();
281
281
  }
282
282
  }, e.prototype.applyFilters = function() {
283
283
  var t;
@@ -292,14 +292,14 @@ var q = se.filter(function(n) {
292
292
  var t = this._media.context, s = this._media.parent, o = this._paused || s.paused || t.paused;
293
293
  o !== this._pausedReal && (this._pausedReal = o, o ? (this._internalStop(), this.emit("paused")) : (this.emit("resumed"), this.play({ start: this._elapsed % this._duration, end: this._end, speed: this._speed, loop: this._loop, volume: this._volume })), this.emit("pause", o));
294
294
  }, e.prototype.play = function(t) {
295
- var s = t.start, o = t.end, r = t.speed, i = t.loop, u = t.volume, a = t.muted, l = t.filters;
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
297
  var h = this._media.nodes.cloneBufferSource(), y = h.source, m = h.gain;
298
- this._source = y, this._gain = m, this._speed = r, this._volume = u, this._loop = !!i, this._muted = a, this._filters = l, this.refresh();
298
+ this._source = y, this._gain = m, 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) {
302
- M.shared.remove(this._updateListener, this), t && M.shared.add(this._updateListener, this);
302
+ T.shared.remove(this._updateListener, this), t && T.shared.add(this._updateListener, this);
303
303
  }, Object.defineProperty(e.prototype, "progress", { get: function() {
304
304
  return this._progress;
305
305
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "paused", { get: function() {
@@ -321,14 +321,14 @@ var q = se.filter(function(n) {
321
321
  if (t === void 0 && (t = !1), this._source) {
322
322
  var s = this._now(), o = s - this._lastUpdate;
323
323
  if (o > 0 || t) {
324
- var r = this._source.playbackRate.value;
325
- this._elapsed += o * r, this._lastUpdate = s;
326
- var i = this._duration, u = void 0;
324
+ var i = this._source.playbackRate.value;
325
+ this._elapsed += o * i, this._lastUpdate = s;
326
+ var r = this._duration, u = void 0;
327
327
  if (this._source.loopStart) {
328
328
  var a = this._source.loopEnd - this._source.loopStart;
329
- u = (this._source.loopStart + this._elapsed % a) / i;
330
- } else u = this._elapsed % i / i;
331
- this._progress = u, this.emit("progress", this._progress, i);
329
+ u = (this._source.loopStart + this._elapsed % a) / r;
330
+ } else u = this._elapsed % r / r;
331
+ this._progress = u, this.emit("progress", this._progress, r);
332
332
  }
333
333
  }
334
334
  }, e.prototype.init = function(t) {
@@ -352,7 +352,7 @@ var q = se.filter(function(n) {
352
352
  }
353
353
  this._source = null, this._progress = 1, this.emit("progress", 1, this._duration), this.emit("end", this);
354
354
  }, e;
355
- }(R), re = function() {
355
+ }(R), ie = function() {
356
356
  function n(e, t) {
357
357
  this._output = t, this._input = e;
358
358
  }
@@ -374,10 +374,10 @@ var q = se.filter(function(n) {
374
374
  }, enumerable: !1, configurable: !0 }), n.prototype.destroy = function() {
375
375
  this.filters = null, this._input = null, this._output = null;
376
376
  }, n;
377
- }(), Pe = function(n) {
377
+ }(), xe = function(n) {
378
378
  function e(t) {
379
- var s = this, o = t.audioContext, r = o.createBufferSource(), i = o.createGain(), u = o.createAnalyser();
380
- return r.connect(u), u.connect(i), i.connect(t.destination), (s = n.call(this, u, i) || this).context = t, s.bufferSource = r, s.gain = i, s.analyser = u, s;
379
+ var s = this, o = t.audioContext, i = o.createBufferSource(), r = o.createGain(), u = o.createAnalyser();
380
+ return i.connect(u), u.connect(r), r.connect(t.destination), (s = n.call(this, u, r) || this).context = t, s.bufferSource = i, s.gain = r, s.analyser = u, s;
381
381
  }
382
382
  return b(e, n), Object.defineProperty(e.prototype, "script", { get: function() {
383
383
  return this._script || (this._script = this.context.audioContext.createScriptProcessor(e.BUFFER_SIZE), this._script.connect(this.context.destination)), this._script;
@@ -391,11 +391,11 @@ var q = se.filter(function(n) {
391
391
  }, Object.defineProperty(e.prototype, "bufferSize", { get: function() {
392
392
  return this.script.bufferSize;
393
393
  }, enumerable: !1, configurable: !0 }), e.BUFFER_SIZE = 0, e;
394
- }(re), xe = function() {
394
+ }(ie), we = function() {
395
395
  function n() {
396
396
  }
397
397
  return n.prototype.init = function(e) {
398
- this.parent = e, this._nodes = new Pe(this.context), this._source = this._nodes.bufferSource, this.source = e.options.source;
398
+ this.parent = e, this._nodes = new xe(this.context), this._source = this._nodes.bufferSource, this.source = e.options.source;
399
399
  }, n.prototype.destroy = function() {
400
400
  this.parent = null, this._nodes.destroy(), this._nodes = null;
401
401
  try {
@@ -404,7 +404,7 @@ var q = se.filter(function(n) {
404
404
  }
405
405
  this._source = null, this.source = null;
406
406
  }, n.prototype.create = function() {
407
- return new ve(this);
407
+ return new Pe(this);
408
408
  }, Object.defineProperty(n.prototype, "context", { get: function() {
409
409
  return this.parent.context;
410
410
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isPlayable", { get: function() {
@@ -429,10 +429,10 @@ var q = se.filter(function(n) {
429
429
  t.source = s.response, t._decode(s.response, e);
430
430
  }, s.send();
431
431
  }, n.prototype._decode = function(e, t) {
432
- var s = this, o = function(r, i) {
433
- if (r) t && t(r);
432
+ var s = this, o = function(i, r) {
433
+ if (i) t && t(i);
434
434
  else {
435
- s.parent.isLoaded = !0, s.buffer = i;
435
+ s.parent.isLoaded = !0, s.buffer = r;
436
436
  var u = s.parent.autoPlayStart();
437
437
  t && t(null, s.parent, u);
438
438
  }
@@ -447,7 +447,7 @@ var q = se.filter(function(n) {
447
447
  }
448
448
  return n.from = function(e) {
449
449
  var t = {};
450
- return typeof e == "string" ? t.url = e : e instanceof ArrayBuffer || e instanceof AudioBuffer || e instanceof HTMLAudioElement ? t.source = e : t = e, (t = V({ autoPlay: !1, singleInstance: !1, url: null, source: null, preload: !1, volume: 1, speed: 1, complete: null, loaded: null, loop: !1 }, t)).url && (t.url = ne(t.url)), Object.freeze(t), new n(_().useLegacy ? new me() : new xe(), t);
450
+ return typeof e == "string" ? t.url = e : e instanceof ArrayBuffer || e instanceof AudioBuffer || e instanceof HTMLAudioElement ? t.source = e : t = e, (t = V({ autoPlay: !1, singleInstance: !1, url: null, source: null, preload: !1, volume: 1, speed: 1, complete: null, loaded: null, loop: !1 }, t)).url && (t.url = ne(t.url)), Object.freeze(t), new n(_().useLegacy ? new ge() : new we(), t);
451
451
  }, Object.defineProperty(n.prototype, "context", { get: function() {
452
452
  return _().context;
453
453
  }, enumerable: !1, configurable: !0 }), n.prototype.pause = function() {
@@ -472,8 +472,8 @@ var q = se.filter(function(n) {
472
472
  for (var o in e) s[o] = this.addSprites(o, e[o]);
473
473
  return s;
474
474
  }
475
- var r = new ge(this, t);
476
- return this._sprites[e] = r, r;
475
+ var i = new be(this, t);
476
+ return this._sprites[e] = i, i;
477
477
  }, n.prototype.destroy = function() {
478
478
  this._removeInstances(), this.removeSprites(), this.media.destroy(), this.media = null, this._sprites = null, this._instances = null;
479
479
  }, n.prototype.removeSprites = function(e) {
@@ -491,9 +491,9 @@ var q = se.filter(function(n) {
491
491
  return this;
492
492
  }, n.prototype.play = function(e, t) {
493
493
  var s, o = this;
494
- if (typeof e == "string" ? s = { sprite: i = e, loop: this.loop, complete: t } : typeof e == "function" ? (s = {}).complete = e : s = e, (s = V({ complete: null, loaded: null, sprite: null, end: null, start: 0, volume: 1, speed: 1, muted: !1, loop: !1 }, s || {})).sprite) {
495
- var r = s.sprite, i = this._sprites[r];
496
- s.start = i.start + (s.start || 0), s.end = i.end, s.speed = i.speed || 1, s.loop = i.loop || s.loop, delete s.sprite;
494
+ if (typeof e == "string" ? s = { sprite: r = e, loop: this.loop, complete: t } : typeof e == "function" ? (s = {}).complete = e : s = e, (s = V({ complete: null, loaded: null, sprite: null, end: null, start: 0, volume: 1, speed: 1, muted: !1, loop: !1 }, s || {})).sprite) {
495
+ var i = s.sprite, r = this._sprites[i];
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
499
  o.autoPlay = !0, o._autoPlayOptions = s, o._preload(function(h, y, m) {
@@ -552,7 +552,7 @@ var q = se.filter(function(n) {
552
552
  }, n.prototype._poolInstance = function(e) {
553
553
  e.destroy(), n._pool.indexOf(e) < 0 && n._pool.push(e);
554
554
  }, n._pool = [], n;
555
- }(), we = function(n) {
555
+ }(), Oe = function(n) {
556
556
  function e() {
557
557
  var t = n !== null && n.apply(this, arguments) || this;
558
558
  return t.speed = 1, t.muted = !1, t.volume = 1, t.paused = !1, t;
@@ -577,8 +577,8 @@ var q = se.filter(function(n) {
577
577
  function e() {
578
578
  var t = n.call(this, null, null) || this;
579
579
  t.autoPause = !0;
580
- var s = window, o = new e.AudioContext(), r = o.createDynamicsCompressor(), i = o.createAnalyser();
581
- return i.connect(r), r.connect(o.destination), t._input = i, t._output = o.destination, t._ctx = o, t._offlineCtx = new e.OfflineAudioContext(1, 2, s.OfflineAudioContext ? Math.max(8e3, Math.min(96e3, o.sampleRate)) : 44100), t.compressor = r, t.analyser = i, t.events = new R(), t.volume = 1, t.speed = 1, t.muted = !1, t.paused = !1, t._locked = o.state === "suspended" && ("ontouchstart" in globalThis || "onclick" in globalThis), t._locked && (t._unlock(), t._unlock = t._unlock.bind(t), document.addEventListener("mousedown", t._unlock, !0), document.addEventListener("touchstart", t._unlock, !0), document.addEventListener("touchend", t._unlock, !0)), t.onFocus = t.onFocus.bind(t), t.onBlur = t.onBlur.bind(t), globalThis.addEventListener("focus", t.onFocus), globalThis.addEventListener("blur", t.onBlur), t;
580
+ var s = window, o = new e.AudioContext(), i = o.createDynamicsCompressor(), r = o.createAnalyser();
581
+ return r.connect(i), i.connect(o.destination), t._input = r, t._output = o.destination, t._ctx = o, t._offlineCtx = new e.OfflineAudioContext(1, 2, s.OfflineAudioContext ? Math.max(8e3, Math.min(96e3, o.sampleRate)) : 44100), t.compressor = i, t.analyser = r, t.events = new R(), t.volume = 1, t.speed = 1, t.muted = !1, t.paused = !1, t._locked = o.state === "suspended" && ("ontouchstart" in globalThis || "onclick" in globalThis), t._locked && (t._unlock(), t._unlock = t._unlock.bind(t), document.addEventListener("mousedown", t._unlock, !0), document.addEventListener("touchstart", t._unlock, !0), document.addEventListener("touchend", t._unlock, !0)), t.onFocus = t.onFocus.bind(t), t.onBlur = t.onBlur.bind(t), globalThis.addEventListener("focus", t.onFocus), globalThis.addEventListener("blur", t.onBlur), t;
582
582
  }
583
583
  return b(e, n), e.prototype.onFocus = function() {
584
584
  if (this.autoPause) {
@@ -619,19 +619,19 @@ var q = se.filter(function(n) {
619
619
  }, e.prototype.togglePause = function() {
620
620
  return this.paused = !this.paused, this.refreshPaused(), this._paused;
621
621
  }, e.prototype.decode = function(t, s) {
622
- var o = function(i) {
623
- s(new Error(i?.message || "Unable to decode file"));
624
- }, r = this._offlineCtx.decodeAudioData(t, function(i) {
625
- s(null, i);
622
+ var o = function(r) {
623
+ s(new Error(r?.message || "Unable to decode file"));
624
+ }, i = this._offlineCtx.decodeAudioData(t, function(r) {
625
+ s(null, r);
626
626
  }, o);
627
- r && r.catch(o);
627
+ i && i.catch(o);
628
628
  }, e;
629
- }(re), Oe = function() {
629
+ }(ie), Ee = function() {
630
630
  function n() {
631
631
  this.init();
632
632
  }
633
633
  return n.prototype.init = function() {
634
- return this.supported && (this._webAudioContext = new Y()), this._htmlAudioContext = new we(), this._sounds = {}, this.useLegacy = !this.supported, this;
634
+ return this.supported && (this._webAudioContext = new Y()), this._htmlAudioContext = new Oe(), this._sounds = {}, this.useLegacy = !this.supported, this;
635
635
  }, Object.defineProperty(n.prototype, "context", { get: function() {
636
636
  return this._context;
637
637
  }, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "filtersAll", { get: function() {
@@ -644,13 +644,13 @@ var q = se.filter(function(n) {
644
644
  if (typeof e == "object") {
645
645
  var s = {};
646
646
  for (var o in e) {
647
- var r = this._getOptions(e[o], t);
648
- s[o] = this.add(o, r);
647
+ var i = this._getOptions(e[o], t);
648
+ s[o] = this.add(o, i);
649
649
  }
650
650
  return s;
651
651
  }
652
652
  if (t instanceof N) return this._sounds[e] = t, t;
653
- var i = this._getOptions(t), u = N.from(i);
653
+ var r = this._getOptions(t), u = N.from(r);
654
654
  return this._sounds[e] = u, u;
655
655
  }, n.prototype._getOptions = function(e, t) {
656
656
  var s;
@@ -714,7 +714,7 @@ var q = se.filter(function(n) {
714
714
  }, n.prototype.close = function() {
715
715
  return this.removeAll(), this._sounds = null, this._webAudioContext && (this._webAudioContext.destroy(), this._webAudioContext = null), this._htmlAudioContext && (this._htmlAudioContext.destroy(), this._htmlAudioContext = null), this._context = null, this;
716
716
  }, n;
717
- }(), S = function() {
717
+ }(), k = function() {
718
718
  function n(e, t) {
719
719
  this.init(e, t);
720
720
  }
@@ -728,18 +728,18 @@ 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, r, i, u, a, l, h, y) {
732
- t === void 0 && (t = 0), s === void 0 && (s = 0), o === void 0 && (o = 0), r === void 0 && (r = 0), i === void 0 && (i = 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);
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
733
  var m = 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: r }, { f: e.F500, type: "peaking", gain: i }, { 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: y }].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
739
  (m = n.call(this, g[0], g[g.length - 1]) || this).bands = g, m.bandsMap = {};
740
- for (var f = 0; f < m.bands.length; f++) {
741
- var x = m.bands[f];
742
- f > 0 && m.bands[f - 1].connect(x), m.bandsMap[x.frequency.value] = x;
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;
743
743
  }
744
744
  return m;
745
745
  }
@@ -800,7 +800,7 @@ var q = se.filter(function(n) {
800
800
  t.disconnect();
801
801
  }), this.bands = null, this.bandsMap = null;
802
802
  }, e.F32 = 32, e.F64 = 64, e.F125 = 125, e.F250 = 250, e.F500 = 500, e.F1K = 1e3, e.F2K = 2e3, e.F4K = 4e3, e.F8K = 8e3, e.F16K = 16e3, e;
803
- }(S), DistortionFilter: function(n) {
803
+ }(k), DistortionFilter: function(n) {
804
804
  function e(t) {
805
805
  t === void 0 && (t = 0);
806
806
  var s = this;
@@ -814,18 +814,18 @@ var q = se.filter(function(n) {
814
814
  return this._amount;
815
815
  }, set: function(t) {
816
816
  this._amount = t;
817
- for (var s, o = 1e3 * t, r = 44100, i = new Float32Array(r), u = Math.PI / 180, a = 0; a < r; ++a) s = 2 * a / r - 1, i[a] = (3 + o) * s * 20 * u / (Math.PI + o * Math.abs(s));
818
- this._distortion.curve = i, this._distortion.oversample = "4x";
817
+ for (var s, o = 1e3 * t, i = 44100, r = new Float32Array(i), u = Math.PI / 180, a = 0; a < i; ++a) s = 2 * a / i - 1, r[a] = (3 + o) * s * 20 * u / (Math.PI + o * Math.abs(s));
818
+ this._distortion.curve = r, this._distortion.oversample = "4x";
819
819
  }, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
820
820
  this._distortion = null, n.prototype.destroy.call(this);
821
821
  }, e;
822
- }(S), StereoFilter: function(n) {
822
+ }(k), StereoFilter: function(n) {
823
823
  function e(t) {
824
824
  t === void 0 && (t = 0);
825
825
  var s = this;
826
826
  if (!_().useLegacy) {
827
- var o, r, i, u = _().context.audioContext;
828
- return u.createStereoPanner ? i = o = u.createStereoPanner() : ((r = u.createPanner()).panningModel = "equalpower", i = r), (s = n.call(this, i) || this)._stereo = o, s._panner = r, s.pan = t, s;
827
+ var o, i, r, u = _().context.audioContext;
828
+ return u.createStereoPanner ? r = o = u.createStereoPanner() : ((i = u.createPanner()).panningModel = "equalpower", r = i), (s = n.call(this, r) || this)._stereo = o, s._panner = i, s.pan = t, s;
829
829
  }
830
830
  s = n.call(this, null) || this;
831
831
  }
@@ -836,12 +836,12 @@ var q = se.filter(function(n) {
836
836
  }, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
837
837
  n.prototype.destroy.call(this), this._stereo = null, this._panner = null;
838
838
  }, e;
839
- }(S), ReverbFilter: function(n) {
839
+ }(k), ReverbFilter: function(n) {
840
840
  function e(t, s, o) {
841
841
  t === void 0 && (t = 3), s === void 0 && (s = 2), o === void 0 && (o = !1);
842
- var r = this;
843
- if (!_().useLegacy) return (r = n.call(this, null) || this)._seconds = r._clamp(t, 1, 50), r._decay = r._clamp(s, 0, 100), r._reverse = o, r._rebuild(), r;
844
- r = n.call(this, null) || this;
842
+ var i = this;
843
+ if (!_().useLegacy) return (i = n.call(this, null) || this)._seconds = i._clamp(t, 1, 50), i._decay = i._clamp(s, 0, 100), i._reverse = o, i._rebuild(), i;
844
+ i = n.call(this, null) || this;
845
845
  }
846
846
  return b(e, n), e.prototype._clamp = function(t, s, o) {
847
847
  return Math.min(o, Math.max(s, t));
@@ -858,28 +858,28 @@ var q = se.filter(function(n) {
858
858
  }, set: function(t) {
859
859
  this._reverse = t, this._rebuild();
860
860
  }, enumerable: !1, configurable: !0 }), e.prototype._rebuild = function() {
861
- for (var t, s = _().context.audioContext, o = s.sampleRate, r = o * this._seconds, i = s.createBuffer(2, r, o), u = i.getChannelData(0), a = i.getChannelData(1), l = 0; l < r; l++) t = this._reverse ? r - l : l, u[l] = (2 * Math.random() - 1) * Math.pow(1 - t / r, this._decay), a[l] = (2 * Math.random() - 1) * Math.pow(1 - t / r, this._decay);
861
+ for (var t, s = _().context.audioContext, o = s.sampleRate, i = o * this._seconds, r = s.createBuffer(2, i, o), u = r.getChannelData(0), a = r.getChannelData(1), l = 0; l < i; l++) t = this._reverse ? i - l : l, u[l] = (2 * Math.random() - 1) * Math.pow(1 - t / i, this._decay), a[l] = (2 * Math.random() - 1) * Math.pow(1 - t / i, this._decay);
862
862
  var h = _().context.audioContext.createConvolver();
863
- h.buffer = i, this.init(h);
863
+ h.buffer = r, this.init(h);
864
864
  }, e;
865
- }(S), MonoFilter: function(n) {
865
+ }(k), MonoFilter: function(n) {
866
866
  function e() {
867
867
  var t = this;
868
868
  if (!_().useLegacy) {
869
- var s = _().context.audioContext, o = s.createChannelSplitter(), r = s.createChannelMerger();
870
- return r.connect(o), (t = n.call(this, r, o) || this)._merger = r, t;
869
+ var s = _().context.audioContext, o = s.createChannelSplitter(), i = s.createChannelMerger();
870
+ return i.connect(o), (t = n.call(this, i, o) || this)._merger = i, t;
871
871
  }
872
872
  t = n.call(this, null) || this;
873
873
  }
874
874
  return b(e, n), e.prototype.destroy = function() {
875
875
  this._merger.disconnect(), this._merger = null, n.prototype.destroy.call(this);
876
876
  }, e;
877
- }(S), StreamFilter: function(n) {
877
+ }(k), StreamFilter: function(n) {
878
878
  function e() {
879
879
  var t = this;
880
880
  if (!_().useLegacy) {
881
- var s = _().context.audioContext, o = s.createMediaStreamDestination(), r = s.createMediaStreamSource(o.stream);
882
- return (t = n.call(this, o, r) || this)._stream = o.stream, t;
881
+ var s = _().context.audioContext, o = s.createMediaStreamDestination(), i = s.createMediaStreamSource(o.stream);
882
+ return (t = n.call(this, o, i) || this)._stream = o.stream, t;
883
883
  }
884
884
  t = n.call(this, null) || this;
885
885
  }
@@ -888,58 +888,58 @@ var q = se.filter(function(n) {
888
888
  }, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
889
889
  this._stream = null, n.prototype.destroy.call(this);
890
890
  }, e;
891
- }(S), TelephoneFilter: function(n) {
891
+ }(k), TelephoneFilter: function(n) {
892
892
  function e() {
893
893
  if (!_().useLegacy) {
894
- var t = _().context.audioContext, s = t.createBiquadFilter(), o = t.createBiquadFilter(), r = t.createBiquadFilter(), i = t.createBiquadFilter();
895
- return s.type = "lowpass", v.setParamValue(s.frequency, 2e3), o.type = "lowpass", v.setParamValue(o.frequency, 2e3), r.type = "highpass", v.setParamValue(r.frequency, 500), i.type = "highpass", v.setParamValue(i.frequency, 500), s.connect(o), o.connect(r), r.connect(i), n.call(this, s, i) || this;
894
+ var t = _().context.audioContext, s = t.createBiquadFilter(), o = t.createBiquadFilter(), i = t.createBiquadFilter(), r = t.createBiquadFilter();
895
+ return s.type = "lowpass", v.setParamValue(s.frequency, 2e3), o.type = "lowpass", v.setParamValue(o.frequency, 2e3), i.type = "highpass", v.setParamValue(i.frequency, 500), r.type = "highpass", v.setParamValue(r.frequency, 500), s.connect(o), o.connect(i), i.connect(r), n.call(this, s, r) || this;
896
896
  }
897
897
  n.call(this, null);
898
898
  }
899
899
  return b(e, n), e;
900
- }(S) }, Ae = { __proto__: null, supported: K }, z = function(n) {
900
+ }(k) }, Ve = { __proto__: null, supported: K }, z = function(n) {
901
901
  return ee = n, n;
902
- }(new Oe());
902
+ }(new Ee());
903
903
  ue.add(oe);
904
904
  class j {
905
- constructor(e, t, s, o, r, i, u, a) {
906
- this.fn = e, this.buf = t, this.start_ms = s, this.end_ms = o, this.ret_ms = r, this.volume = i, this.pan = u, this.snd = a, this.stt = a ? new G(this) : new Ee(), this.#s = L.procID, a && this.addSnd(a);
905
+ constructor(e, t, s, o, i, r, u, a) {
906
+ this.fn = e, this.buf = t, this.start_ms = s, this.end_ms = o, this.ret_ms = i, this.volume = r, this.pan = u, this.snd = a, this.stt = a ? new G(this) : new Se(this), this.#e = L.procID, a && this.addSnd(a);
907
907
  }
908
908
  static #t = 1;
909
909
  stt;
910
910
  loop = !1;
911
- #s;
911
+ #e;
912
912
  get procID() {
913
- return this.#s;
913
+ return this.#e;
914
914
  }
915
915
  addSnd(e) {
916
916
  switch (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
- }, this.tw = () => new pe(e), this.onPlayEnd = () => {
919
- this.stt.onPlayEnd(this.buf), this.#e();
918
+ }, this.tw = () => new he(e), this.onPlayEnd = () => {
919
+ this.stt.onPlayEnd(this.buf), this.#s();
920
920
  }, this.stop = () => {
921
- e.stop(), this.#e();
922
- }, this.destroy = () => e.destroy(), this.buf) {
921
+ e.stop(), this.#s();
922
+ }, this.destroy = () => e.destroy(), !this.loop && ce.needClick2Play() && setTimeout(() => this.onPlayEnd(), (e.duration - this.start_ms - (this.end_ms <= 0 ? this.end_ms : this.end_ms === f.MAX_END_MS ? 0 : e.duration - this.end_ms)) * 1e3), this.buf) {
923
923
  // セリフ再生中はBGM音量を絞る
924
924
  case Q:
925
925
  {
926
926
  const t = Number(c.getVal("sys:sn.sound.BGM.vol_mul_talking") ?? 1);
927
927
  if (t === 1) break;
928
928
  j.#t = t;
929
- const s = X[H];
929
+ const s = H[X];
930
930
  s && s.setVol(this.volume * j.#t);
931
931
  }
932
932
  break;
933
- case H:
933
+ case X:
934
934
  e.volume = this.volume * j.#t;
935
935
  break;
936
936
  }
937
937
  }
938
- #e = () => {
939
- if (this.#e = () => {
938
+ #s = () => {
939
+ if (this.#s = () => {
940
940
  }, j.#t === 1 || this.buf !== Q) return;
941
941
  j.#t = 1;
942
- const e = X[H];
942
+ const e = H[X];
943
943
  e && e.setVol(this.volume * j.#t);
944
944
  };
945
945
  setVol(e) {
@@ -953,72 +953,72 @@ class j {
953
953
  destroy() {
954
954
  }
955
955
  }
956
- let J, c, E, Z, X, U;
957
- const H = "BGM", D = "SE", Q = "VOICE";
958
- class d {
956
+ let J, c, S, Z, H, U;
957
+ const X = "BGM", D = "SE", Q = "VOICE";
958
+ class f {
959
959
  constructor(e, t, s) {
960
960
  this.hArg = e, this.buf = t, this.fn = s;
961
- const o = F(e, "start_ms", 0), r = F(e, "end_ms", d.#s), i = F(e, "ret_ms", 0), u = F(e, "pan", 0), a = F(e, "speed", 1);
961
+ const o = F(e, "start_ms", 0), i = F(e, "end_ms", f.MAX_END_MS), r = F(e, "ret_ms", 0), u = F(e, "pan", 0), a = F(e, "speed", 1);
962
962
  if (o < 0) throw `[playse] start_ms:${o} が負の値です`;
963
- if (i < 0) throw `[playse] ret_ms:${i} が負の値です`;
964
- if (0 < r) {
965
- if (r <= o) throw `[playse] start_ms:${o} >= end_ms:${r} は異常値です`;
966
- if (r <= i) throw `[playse] ret_ms:${i} >= end_ms:${r} は異常値です`;
963
+ if (r < 0) throw `[playse] ret_ms:${r} が負の値です`;
964
+ if (0 < i) {
965
+ if (i <= o) throw `[playse] start_ms:${o} >= end_ms:${i} は異常値です`;
966
+ if (i <= r) throw `[playse] ret_ms:${r} >= end_ms:${i} は異常値です`;
967
967
  }
968
968
  const l = "const.sn.sound." + t + ".";
969
969
  c.setVal_Nochk("save", l + "fn", s);
970
- const h = d.getVol(e, 1);
970
+ const h = f.getVol(e, 1);
971
971
  c.setVal_Nochk("save", l + "volume", h);
972
972
  const y = h * Number(c.getVal("sys:" + l + "volume", 1, !0)), m = A(e, "loop", !1);
973
- m ? (d.#t[t] = s, c.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(d.#t))) : d.delLoopPlay(t), c.setVal_Nochk("save", l + "start_ms", o), c.setVal_Nochk("save", l + "end_ms", r), c.setVal_Nochk("save", l + "ret_ms", i), c.setVal_Nochk("tmp", l + "playing", !0), c.flush();
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();
974
974
  const g = z.find(s);
975
975
  this.#e = new j(
976
976
  s,
977
977
  t,
978
978
  o,
979
- r,
980
979
  i,
980
+ r,
981
981
  y,
982
982
  u,
983
983
  g
984
984
  );
985
- const f = {
985
+ const d = {
986
986
  loop: m,
987
987
  speed: a,
988
988
  volume: y,
989
- loaded: (p, P) => {
989
+ loaded: (p, x) => {
990
990
  if (!this.#e.stt.isDestroy) {
991
991
  if (p) {
992
- E.errScript(`ロード失敗です SndBuf fn:${s} ${String(p)}`, !1);
992
+ S.errScript(`ロード失敗です SndBuf fn:${s} ${String(p)}`, !1);
993
993
  return;
994
994
  }
995
- P && (this.#e.addSnd(P), u !== 0 && (P.filters = [new B.StereoFilter(u)]), e.fnc?.());
995
+ x && (this.#e.addSnd(x), u !== 0 && (x.filters = [new B.StereoFilter(u)]), e.fnc?.());
996
996
  }
997
997
  }
998
998
  };
999
- let x = "";
1000
- if (0 < o || r < d.#s) {
1001
- x = `${s};${o};${r};${i}`;
1002
- const p = (f.sprites ??= {})[x] = {
999
+ let w = "";
1000
+ if (0 < o || i < f.MAX_END_MS) {
1001
+ w = `${s};${o};${i};${r}`;
1002
+ const p = (d.sprites ??= {})[w] = {
1003
1003
  start: o / 1e3,
1004
- end: r / 1e3
1004
+ end: i / 1e3
1005
1005
  };
1006
- f.preload = !0;
1007
- const P = f.loaded;
1008
- f.loaded = (C, O) => {
1006
+ d.preload = !0;
1007
+ const x = d.loaded;
1008
+ d.loaded = (C, E) => {
1009
1009
  if (this.#e.stt.isDestroy) return;
1010
- P(C, O);
1011
- const I = O, T = I.duration;
1012
- p.end < 0 && (p.end += T, I.removeSprites(x), I.addSprites(x, p)), p.end <= p.start && E.errScript(`[playse] end_ms:${r}(${p.end * 1e3}) >= start_ms:${o} は異常値です`), p.end * 1e3 <= i && E.errScript(`[playse] end_ms:${r}(${p.end * 1e3}) <= ret_ms:${i} は異常値です`), T <= p.start && E.errScript(`[playse] 音声ファイル再生時間:${T * 1e3} <= start_ms:${o} は異常値です`), r !== d.#s && T <= p.end && E.errScript(`[playse] 音声ファイル再生時間:${T * 1e3} <= end_ms:${r} は異常値です`), I.play(x, (ie) => f.complete?.(ie));
1010
+ x(C, E);
1011
+ const I = E, M = I.duration;
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
- } else f.autoPlay = !0;
1015
- if (m ? i !== 0 && (f.loop = !1, f.complete = (p) => {
1016
- const P = p.duration, C = i / 1e3, O = r / 1e3;
1017
- P <= C && E.errScript(`[playse] 音声ファイル再生時間:${P * 1e3} <= ret_ms:${i} は異常値です`), p.play({
1014
+ } else d.autoPlay = !0;
1015
+ if (m ? r !== 0 && (d.loop = !1, d.complete = (p) => {
1016
+ const x = p.duration, C = r / 1e3, E = i / 1e3;
1017
+ x <= C && S.errScript(`[playse] 音声ファイル再生時間:${x * 1e3} <= ret_ms:${r} は異常値です`), p.play({
1018
1018
  // 一周目はループなし、なのでキャッシュされてる
1019
- ...f,
1019
+ ...d,
1020
1020
  start: C,
1021
- end: O < 0 ? O + P : O,
1021
+ end: E < 0 ? E + x : E,
1022
1022
  // 負の値は末尾から
1023
1023
  // speed, // 重複
1024
1024
  loop: !0,
@@ -1029,14 +1029,14 @@ class d {
1029
1029
  //- loaded?: LoadedCallback;
1030
1030
  //- singleInstance?: boolean;
1031
1031
  });
1032
- }) : f.complete = () => {
1032
+ }) : d.complete = () => {
1033
1033
  W(this.#e, t), this.#e.onPlayEnd();
1034
- }, this.#n(), g) {
1035
- if (g.volume = y, x) this.#o(s, f);
1034
+ }, this.#s(), g) {
1035
+ if (g.volume = y, w) this.#n(s, d);
1036
1036
  else if (g.isPlayable) {
1037
1037
  const p = g.options.source;
1038
- !(p instanceof ArrayBuffer) || p.byteLength === 0 ? g.play(f) : this.#e.addSnd(N.from({
1039
- ...f,
1038
+ !(p instanceof ArrayBuffer) || p.byteLength === 0 ? g.play(d) : this.#e.addSnd(N.from({
1039
+ ...d,
1040
1040
  url: g.options.url,
1041
1041
  source: p
1042
1042
  }));
@@ -1047,24 +1047,24 @@ class d {
1047
1047
  if (this.needLoad = A(e, "join", !0)) {
1048
1048
  const p = this.#e.procID + `loaded buf:${t} fn:${s}`;
1049
1049
  L.beginProc(p);
1050
- const P = f.loaded;
1051
- f.loaded = (C, O) => {
1052
- P(C, O), L.endProc(p);
1050
+ const x = d.loaded;
1051
+ d.loaded = (C, E) => {
1052
+ x(C, E), L.endProc(p);
1053
1053
  };
1054
1054
  }
1055
- this.#o(s, f);
1055
+ this.#n(s, d);
1056
1056
  }
1057
1057
  static #t = {};
1058
- static init(e, t, s, o, r) {
1059
- d.#t = {}, J = e, c = t, E = s, Z = o, X = r;
1058
+ static init(e, t, s, o, i) {
1059
+ f.#t = {}, J = e, c = t, S = s, Z = o, H = i;
1060
1060
  }
1061
1061
  static setEvtMng(e) {
1062
1062
  U = e;
1063
1063
  }
1064
1064
  static delLoopPlay(e) {
1065
- delete d.#t[e];
1065
+ delete f.#t[e];
1066
1066
  const t = "const.sn.sound." + e + ".";
1067
- c.setVal_Nochk("save", t + "fn", ""), c.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(d.#t)), c.flush();
1067
+ c.setVal_Nochk("save", t + "fn", ""), c.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(f.#t)), c.flush();
1068
1068
  }
1069
1069
  static getVol(e, t) {
1070
1070
  const s = F(e, "volume", t);
@@ -1072,28 +1072,28 @@ class d {
1072
1072
  }
1073
1073
  static xchgbuf({ buf: e = D, buf2: t = D }) {
1074
1074
  if (e === t) throw `[xchgbuf] buf:${e} が同じ値です`;
1075
- const s = "const.sn.sound." + e + ".", o = Number(c.getVal("save:" + s + "volume")), r = String(c.getVal("save:" + s + "fn")), i = "const.sn.sound." + t + ".", u = Number(c.getVal("save:" + i + "volume")), a = String(c.getVal("save:" + i + "fn"));
1076
- c.setVal_Nochk("save", s + "volume", u), c.setVal_Nochk("save", i + "volume", o), c.setVal_Nochk("save", s + "fn", a), c.setVal_Nochk("save", i + "fn", r), e in d.#t != t in d.#t && (e in d.#t ? (delete d.#t[e], d.#t[t] = r) : (delete d.#t[t], d.#t[e] = a), c.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(d.#t))), c.flush();
1075
+ const s = "const.sn.sound." + e + ".", o = Number(c.getVal("save:" + s + "volume")), i = String(c.getVal("save:" + s + "fn")), r = "const.sn.sound." + t + ".", u = Number(c.getVal("save:" + r + "volume")), a = String(c.getVal("save:" + r + "fn"));
1076
+ c.setVal_Nochk("save", s + "volume", u), c.setVal_Nochk("save", r + "volume", o), c.setVal_Nochk("save", s + "fn", a), c.setVal_Nochk("save", r + "fn", i), e in f.#t != t in f.#t && (e in f.#t ? (delete f.#t[e], f.#t[t] = i) : (delete f.#t[t], f.#t[e] = a), c.setVal_Nochk("save", "const.sn.loopPlaying", JSON.stringify(f.#t))), c.flush();
1077
1077
  }
1078
- static #s = 999e3;
1078
+ static MAX_END_MS = 999e3;
1079
1079
  #e;
1080
1080
  needLoad;
1081
- #n = () => {
1082
- z.volumeAll = Number(c.getVal("sys:sn.sound.global_volume", 1)), this.#n = () => {
1081
+ #s = () => {
1082
+ z.volumeAll = Number(c.getVal("sys:sn.sound.global_volume", 1)), this.#s = () => {
1083
1083
  };
1084
1084
  };
1085
- #o(e, t) {
1085
+ #n(e, t) {
1086
1086
  const s = J.searchPath(e, ae.SOUND);
1087
1087
  if (!s.endsWith(".bin")) {
1088
1088
  t.url = s, N.from(t);
1089
1089
  return;
1090
1090
  }
1091
- new le().add({ name: e, url: s, xhrType: w.XHR_RESPONSE_TYPE.BUFFER }).use((o, r) => {
1092
- Z.decAB(o.data).then((i) => {
1093
- o.data = i;
1094
- }).catch((i) => E.errScript(`Sound ロード失敗ですc fn:${o.name} ${i}`, !1)).finally(() => r());
1095
- }).load((o, r) => {
1096
- t.source = r[e]?.data, N.from(t);
1091
+ new le().add({ name: e, url: s, xhrType: O.XHR_RESPONSE_TYPE.BUFFER }).use((o, i) => {
1092
+ Z.decAB(o.data).then((r) => {
1093
+ o.data = r;
1094
+ }).catch((r) => S.errScript(`Sound ロード失敗ですc fn:${o.name} ${r}`, !1)).finally(() => i());
1095
+ }).load((o, i) => {
1096
+ t.source = i[e]?.data, N.from(t);
1097
1097
  });
1098
1098
  }
1099
1099
  setVol(e) {
@@ -1109,21 +1109,25 @@ class d {
1109
1109
  }
1110
1110
  function W({ loop: n }, e) {
1111
1111
  if (n) {
1112
- d.delLoopPlay(e);
1112
+ f.delLoopPlay(e);
1113
1113
  return;
1114
1114
  }
1115
1115
  const t = "const.sn.sound." + e + ".";
1116
1116
  c.setVal_Nochk("tmp", t + "playing", !1), c.flush();
1117
1117
  }
1118
- class Ee {
1118
+ class Se {
1119
+ constructor(e) {
1120
+ this.si = e;
1121
+ }
1119
1122
  onLoad(e) {
1120
1123
  e.stt = new G(e);
1121
1124
  }
1122
1125
  stopse(e) {
1123
- e.stt = new k(e, !1);
1126
+ e.stt = new P(e, !1);
1124
1127
  }
1125
1128
  ws = () => !1;
1126
1129
  onPlayEnd() {
1130
+ this.si.stt = new P(this.si, !1);
1127
1131
  }
1128
1132
  // ok
1129
1133
  fade() {
@@ -1147,7 +1151,7 @@ class G {
1147
1151
  }
1148
1152
  // ok
1149
1153
  stopse(e) {
1150
- e.stt = new k(e);
1154
+ e.stt = new P(e);
1151
1155
  }
1152
1156
  ws(e, t) {
1153
1157
  if (e.loop) return !1;
@@ -1156,30 +1160,31 @@ class G {
1156
1160
  if (s && U.isSkipping)
1157
1161
  return o ? e.stt.stopse(e) : e.stt.onPlayEnd = () => {
1158
1162
  }, !1;
1159
- const { buf: r = D } = t, i = () => {
1160
- W(e, r), e.onPlayEnd(), o ? e.stt.stopse(e) : e.stt.onPlayEnd = () => {
1163
+ const { buf: i = D } = t, r = () => {
1164
+ W(e, i), e.onPlayEnd(), o ? e.stt.stopse(e) : e.stt.onPlayEnd = () => {
1161
1165
  };
1162
1166
  };
1163
- return L.beginProc(e.procID + "ws", i, !0, s ? i : void 0), !0;
1167
+ return L.beginProc(e.procID + "ws", r, !0, s ? r : void 0), !0;
1164
1168
  }
1165
1169
  onPlayEnd() {
1170
+ this.si.stt = new P(this.si, !1);
1166
1171
  }
1167
1172
  // ok
1168
1173
  fade(e, t) {
1169
- const { buf: s = D } = t, r = "const.sn.sound." + s + "." + "volume", i = d.getVol(t, NaN);
1170
- c.setVal_Nochk("save", r, i);
1171
- const u = i * Number(c.getVal("sys:" + r, 1)), a = A(t, "stop", i === 0);
1172
- a && d.delLoopPlay(s), c.flush();
1174
+ const { buf: s = D } = t, i = "const.sn.sound." + s + "." + "volume", r = f.getVol(t, NaN);
1175
+ c.setVal_Nochk("save", i, r);
1176
+ const u = r * Number(c.getVal("sys:" + i, 1)), a = A(t, "stop", r === 0);
1177
+ a && f.delLoopPlay(s), c.flush();
1173
1178
  const l = F(t, "time", NaN), h = F(t, "delay", 0);
1174
1179
  if (l === 0 && h === 0 || U.isSkipping) {
1175
- e.setVol(u), e.stt = a ? new k(e) : new G(e);
1180
+ e.setVol(u), e.stt = a ? new P(e) : new G(e);
1176
1181
  return;
1177
1182
  }
1178
1183
  const y = e.tw();
1179
- y && (ce.setTwProp(y, t).to({ volume: u }, l).onUpdate(() => {
1184
+ y && (pe.setTwProp(y, t).to({ volume: u }, l).onUpdate(() => {
1180
1185
  e.snd?.isPlaying || (y.stop(), y.onComplete());
1181
1186
  }).onComplete(() => {
1182
- he(y), e.stt.compFade(s), e.stt = a ? new k(e) : new G(e);
1187
+ fe(y), e.stt.compFade(s), e.stt = a ? new P(e) : new G(e);
1183
1188
  }).start(), e.stt = new je(y, e));
1184
1189
  }
1185
1190
  wf = () => !1;
@@ -1200,12 +1205,12 @@ class Fe {
1200
1205
  }
1201
1206
  // ok
1202
1207
  stopse(e) {
1203
- e.stt = new k(e);
1208
+ e.stt = new P(e);
1204
1209
  }
1205
1210
  ws = () => !1;
1206
1211
  // ok
1207
1212
  onPlayEnd() {
1208
- L.notifyEndProc(this.si.procID + "ws");
1213
+ this.si.stt = new P(this.si, !1), L.notifyEndProc(this.si.procID + "ws");
1209
1214
  }
1210
1215
  fade() {
1211
1216
  }
@@ -1228,19 +1233,20 @@ class je {
1228
1233
  }
1229
1234
  // ok
1230
1235
  stopse(e) {
1231
- this.stopfadese(), e.stt = new k(e);
1236
+ this.stopfadese(), e.stt = new P(e);
1232
1237
  }
1233
1238
  // 順番厳守
1234
1239
  ws = () => !1;
1235
1240
  // ok ?
1236
1241
  onPlayEnd() {
1242
+ this.stopfadese(), this.si.stt = new P(this.si, !1);
1237
1243
  }
1238
1244
  // ok
1239
1245
  fade() {
1240
1246
  }
1241
1247
  // ok
1242
1248
  wf(e, t) {
1243
- e.stt = new Se(e);
1249
+ e.stt = new ke(e);
1244
1250
  const s = A(t, "canskip", !1);
1245
1251
  if (s && U.isSkipping)
1246
1252
  return this.stopfadese(), !1;
@@ -1253,7 +1259,7 @@ class je {
1253
1259
  stopfadese = () => this.si.stop();
1254
1260
  isDestroy = !1;
1255
1261
  }
1256
- class Se {
1262
+ class ke {
1257
1263
  constructor(e) {
1258
1264
  this.si = e;
1259
1265
  }
@@ -1261,11 +1267,12 @@ class Se {
1261
1267
  }
1262
1268
  // ok
1263
1269
  stopse(e) {
1264
- this.stopfadese(), e.stt = new k(e);
1270
+ this.stopfadese(), e.stt = new P(e);
1265
1271
  }
1266
1272
  ws = () => !1;
1267
1273
  // ok
1268
1274
  onPlayEnd() {
1275
+ this.stopfadese(), this.si.stt = new P(this.si, !1);
1269
1276
  }
1270
1277
  // ok
1271
1278
  fade() {
@@ -1279,7 +1286,7 @@ class Se {
1279
1286
  stopfadese = () => this.si.stop();
1280
1287
  isDestroy = !1;
1281
1288
  }
1282
- class k {
1289
+ class P {
1283
1290
  constructor(e, t = !0) {
1284
1291
  this.si = e, this.stop = t, t && (e.stop(), e.loop && (e.destroy(), e.destroy = () => {
1285
1292
  }));
@@ -1310,9 +1317,9 @@ class k {
1310
1317
  }
1311
1318
  export {
1312
1319
  D as B,
1313
- Ae as I,
1320
+ Ve as I,
1314
1321
  z as R,
1315
- d as S,
1316
- H as a
1322
+ f as S,
1323
+ X as a
1317
1324
  };
1318
1325
  //# sourceMappingURL=SndBuf.js.map