@famibee/skynovel 1.64.15 → 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 +101 -101
- package/dist/SndBuf.js.map +1 -1
- package/dist/sn/CmnInterface.d.ts +1 -1
- package/dist/sn/CmnInterface.d.ts.map +1 -1
- package/dist/sn/CmnLib.d.ts +2 -0
- package/dist/sn/CmnLib.d.ts.map +1 -1
- package/dist/sn/SndBuf.d.ts +1 -0
- package/dist/sn/SndBuf.d.ts.map +1 -1
- package/dist/sn/SysBase.d.ts.map +1 -1
- package/dist/web2.js +6 -2
- package/dist/web2.js.map +1 -1
- package/dist_app/SndBuf.js +101 -101
- package/dist_app/SndBuf.js.map +1 -1
- package/dist_app/app2.js +92 -88
- package/dist_app/app2.js.map +1 -1
- package/dist_app/sn/CmnInterface.d.ts +1 -1
- package/dist_app/sn/CmnInterface.d.ts.map +1 -1
- package/dist_app/sn/CmnLib.d.ts +2 -0
- package/dist_app/sn/CmnLib.d.ts.map +1 -1
- package/dist_app/sn/SndBuf.d.ts +1 -0
- package/dist_app/sn/SndBuf.d.ts.map +1 -1
- package/dist_app/sn/SysBase.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/SndBuf.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as R, n as O, T
|
|
2
|
-
import { C as
|
|
3
|
-
import { a as L, T as
|
|
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,17 +25,17 @@ 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
|
|
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
30
|
se.forEach(function(i) {
|
|
31
31
|
var r = t.canPlayType("audio/".concat(i)).replace(o, ""), u = e[i] ? t.canPlayType(e[i]).replace(o, "") : "";
|
|
32
32
|
s[i] = !!r || !!u;
|
|
33
33
|
}), Object.assign(K, s);
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
var
|
|
35
|
+
de();
|
|
36
|
+
var _e = /\.(\{([^\}]+)\})(\?.*)?$/;
|
|
37
37
|
function ne(n) {
|
|
38
|
-
var e =
|
|
38
|
+
var e = _e, t = typeof n == "string" ? n : n.url;
|
|
39
39
|
if (!e.test(t)) return t;
|
|
40
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
41
|
var a = o[r];
|
|
@@ -69,10 +69,10 @@ var q = se.filter(function(n) {
|
|
|
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
|
-
}(),
|
|
72
|
+
}(), ye = 0, me = function(n) {
|
|
73
73
|
function e(t) {
|
|
74
74
|
var s = n.call(this) || this;
|
|
75
|
-
return s.id =
|
|
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."));
|
|
@@ -141,27 +141,27 @@ var q = se.filter(function(n) {
|
|
|
141
141
|
}, e.prototype.play = function(t) {
|
|
142
142
|
var s = this, o = t.start, i = t.end, r = t.speed, u = t.loop, a = t.volume, l = t.muted;
|
|
143
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),
|
|
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
|
-
|
|
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
|
-
|
|
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),
|
|
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
|
|
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() {
|
|
@@ -202,7 +202,7 @@ var q = se.filter(function(n) {
|
|
|
202
202
|
}, 0);
|
|
203
203
|
}
|
|
204
204
|
}, e;
|
|
205
|
-
}(R),
|
|
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
|
-
}(),
|
|
224
|
+
}(), ve = 0, Pe = function(n) {
|
|
225
225
|
function e(t) {
|
|
226
226
|
var s = n.call(this) || this;
|
|
227
|
-
return s.id =
|
|
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."));
|
|
@@ -299,7 +299,7 @@ var q = se.filter(function(n) {
|
|
|
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
|
-
|
|
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() {
|
|
@@ -374,7 +374,7 @@ 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
|
-
}(),
|
|
377
|
+
}(), xe = function(n) {
|
|
378
378
|
function e(t) {
|
|
379
379
|
var s = this, o = t.audioContext, i = o.createBufferSource(), r = o.createGain(), u = o.createAnalyser();
|
|
380
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;
|
|
@@ -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
|
-
}(ie),
|
|
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
|
|
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
|
|
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() {
|
|
@@ -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
|
|
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,7 +472,7 @@ 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 i = new
|
|
475
|
+
var i = new be(this, t);
|
|
476
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;
|
|
@@ -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
|
-
}(),
|
|
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;
|
|
@@ -626,12 +626,12 @@ var q = se.filter(function(n) {
|
|
|
626
626
|
}, o);
|
|
627
627
|
i && i.catch(o);
|
|
628
628
|
}, e;
|
|
629
|
-
}(ie),
|
|
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
|
|
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() {
|
|
@@ -737,9 +737,9 @@ var q = se.filter(function(n) {
|
|
|
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
|
|
741
|
-
var w = m.bands[
|
|
742
|
-
|
|
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
|
}
|
|
@@ -897,50 +897,50 @@ var q = se.filter(function(n) {
|
|
|
897
897
|
n.call(this, null);
|
|
898
898
|
}
|
|
899
899
|
return b(e, n), e;
|
|
900
|
-
}(k) },
|
|
900
|
+
}(k) }, Ve = { __proto__: null, supported: K }, z = function(n) {
|
|
901
901
|
return ee = n, n;
|
|
902
|
-
}(new
|
|
902
|
+
}(new Ee());
|
|
903
903
|
ue.add(oe);
|
|
904
|
-
class
|
|
904
|
+
class j {
|
|
905
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
|
|
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
|
-
#
|
|
911
|
+
#e;
|
|
912
912
|
get procID() {
|
|
913
|
-
return this.#
|
|
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
|
|
919
|
-
this.stt.onPlayEnd(this.buf), this.#
|
|
918
|
+
}, this.tw = () => new he(e), this.onPlayEnd = () => {
|
|
919
|
+
this.stt.onPlayEnd(this.buf), this.#s();
|
|
920
920
|
}, this.stop = () => {
|
|
921
|
-
e.stop(), this.#
|
|
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
|
-
|
|
929
|
-
const s = X
|
|
930
|
-
s && s.setVol(this.volume *
|
|
928
|
+
j.#t = t;
|
|
929
|
+
const s = H[X];
|
|
930
|
+
s && s.setVol(this.volume * j.#t);
|
|
931
931
|
}
|
|
932
932
|
break;
|
|
933
|
-
case
|
|
934
|
-
e.volume = this.volume *
|
|
933
|
+
case X:
|
|
934
|
+
e.volume = this.volume * j.#t;
|
|
935
935
|
break;
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
|
-
#
|
|
939
|
-
if (this.#
|
|
940
|
-
},
|
|
941
|
-
|
|
942
|
-
const e = X
|
|
943
|
-
e && e.setVol(this.volume *
|
|
938
|
+
#s = () => {
|
|
939
|
+
if (this.#s = () => {
|
|
940
|
+
}, j.#t === 1 || this.buf !== Q) return;
|
|
941
|
+
j.#t = 1;
|
|
942
|
+
const e = H[X];
|
|
943
|
+
e && e.setVol(this.volume * j.#t);
|
|
944
944
|
};
|
|
945
945
|
setVol(e) {
|
|
946
946
|
}
|
|
@@ -953,12 +953,12 @@ class S {
|
|
|
953
953
|
destroy() {
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
|
-
let J, c,
|
|
957
|
-
const
|
|
958
|
-
class
|
|
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 =
|
|
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
963
|
if (r < 0) throw `[playse] ret_ms:${r} が負の値です`;
|
|
964
964
|
if (0 < i) {
|
|
@@ -967,12 +967,12 @@ class d {
|
|
|
967
967
|
}
|
|
968
968
|
const l = "const.sn.sound." + t + ".";
|
|
969
969
|
c.setVal_Nochk("save", l + "fn", s);
|
|
970
|
-
const h =
|
|
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 ? (
|
|
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
|
-
this.#e = new
|
|
975
|
+
this.#e = new j(
|
|
976
976
|
s,
|
|
977
977
|
t,
|
|
978
978
|
o,
|
|
@@ -982,14 +982,14 @@ class d {
|
|
|
982
982
|
u,
|
|
983
983
|
g
|
|
984
984
|
);
|
|
985
|
-
const
|
|
985
|
+
const d = {
|
|
986
986
|
loop: m,
|
|
987
987
|
speed: a,
|
|
988
988
|
volume: y,
|
|
989
989
|
loaded: (p, x) => {
|
|
990
990
|
if (!this.#e.stt.isDestroy) {
|
|
991
991
|
if (p) {
|
|
992
|
-
|
|
992
|
+
S.errScript(`ロード失敗です SndBuf fn:${s} ${String(p)}`, !1);
|
|
993
993
|
return;
|
|
994
994
|
}
|
|
995
995
|
x && (this.#e.addSnd(x), u !== 0 && (x.filters = [new B.StereoFilter(u)]), e.fnc?.());
|
|
@@ -997,26 +997,26 @@ class d {
|
|
|
997
997
|
}
|
|
998
998
|
};
|
|
999
999
|
let w = "";
|
|
1000
|
-
if (0 < o || i <
|
|
1000
|
+
if (0 < o || i < f.MAX_END_MS) {
|
|
1001
1001
|
w = `${s};${o};${i};${r}`;
|
|
1002
|
-
const p = (
|
|
1002
|
+
const p = (d.sprites ??= {})[w] = {
|
|
1003
1003
|
start: o / 1e3,
|
|
1004
1004
|
end: i / 1e3
|
|
1005
1005
|
};
|
|
1006
|
-
|
|
1007
|
-
const x =
|
|
1008
|
-
|
|
1006
|
+
d.preload = !0;
|
|
1007
|
+
const x = d.loaded;
|
|
1008
|
+
d.loaded = (C, E) => {
|
|
1009
1009
|
if (this.#e.stt.isDestroy) return;
|
|
1010
1010
|
x(C, E);
|
|
1011
|
-
const I = E,
|
|
1012
|
-
p.end < 0 && (p.end +=
|
|
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
|
|
1015
|
-
if (m ? r !== 0 && (
|
|
1014
|
+
} else d.autoPlay = !0;
|
|
1015
|
+
if (m ? r !== 0 && (d.loop = !1, d.complete = (p) => {
|
|
1016
1016
|
const x = p.duration, C = r / 1e3, E = i / 1e3;
|
|
1017
|
-
x <= C &&
|
|
1017
|
+
x <= C && S.errScript(`[playse] 音声ファイル再生時間:${x * 1e3} <= ret_ms:${r} は異常値です`), p.play({
|
|
1018
1018
|
// 一周目はループなし、なのでキャッシュされてる
|
|
1019
|
-
...
|
|
1019
|
+
...d,
|
|
1020
1020
|
start: C,
|
|
1021
1021
|
end: E < 0 ? E + x : E,
|
|
1022
1022
|
// 負の値は末尾から
|
|
@@ -1029,14 +1029,14 @@ class d {
|
|
|
1029
1029
|
//- loaded?: LoadedCallback;
|
|
1030
1030
|
//- singleInstance?: boolean;
|
|
1031
1031
|
});
|
|
1032
|
-
}) :
|
|
1032
|
+
}) : d.complete = () => {
|
|
1033
1033
|
W(this.#e, t), this.#e.onPlayEnd();
|
|
1034
|
-
}, this.#
|
|
1035
|
-
if (g.volume = y, w) this.#
|
|
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(
|
|
1039
|
-
...
|
|
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,42 +1047,42 @@ 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 x =
|
|
1051
|
-
|
|
1050
|
+
const x = d.loaded;
|
|
1051
|
+
d.loaded = (C, E) => {
|
|
1052
1052
|
x(C, E), L.endProc(p);
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
1055
|
-
this.#
|
|
1055
|
+
this.#n(s, d);
|
|
1056
1056
|
}
|
|
1057
1057
|
static #t = {};
|
|
1058
1058
|
static init(e, t, s, o, i) {
|
|
1059
|
-
|
|
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
|
|
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(
|
|
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
|
-
const s =
|
|
1070
|
+
const s = F(e, "volume", t);
|
|
1071
1071
|
return s < 0 ? 0 : s > 1 ? 1 : s;
|
|
1072
1072
|
}
|
|
1073
1073
|
static xchgbuf({ buf: e = D, buf2: t = D }) {
|
|
1074
1074
|
if (e === t) throw `[xchgbuf] buf:${e} が同じ値です`;
|
|
1075
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
|
|
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
|
|
1078
|
+
static MAX_END_MS = 999e3;
|
|
1079
1079
|
#e;
|
|
1080
1080
|
needLoad;
|
|
1081
|
-
#
|
|
1082
|
-
z.volumeAll = Number(c.getVal("sys:sn.sound.global_volume", 1)), this.#
|
|
1081
|
+
#s = () => {
|
|
1082
|
+
z.volumeAll = Number(c.getVal("sys:sn.sound.global_volume", 1)), this.#s = () => {
|
|
1083
1083
|
};
|
|
1084
1084
|
};
|
|
1085
|
-
#
|
|
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);
|
|
@@ -1091,7 +1091,7 @@ class d {
|
|
|
1091
1091
|
new le().add({ name: e, url: s, xhrType: O.XHR_RESPONSE_TYPE.BUFFER }).use((o, i) => {
|
|
1092
1092
|
Z.decAB(o.data).then((r) => {
|
|
1093
1093
|
o.data = r;
|
|
1094
|
-
}).catch((r) =>
|
|
1094
|
+
}).catch((r) => S.errScript(`Sound ロード失敗ですc fn:${o.name} ${r}`, !1)).finally(() => i());
|
|
1095
1095
|
}).load((o, i) => {
|
|
1096
1096
|
t.source = i[e]?.data, N.from(t);
|
|
1097
1097
|
});
|
|
@@ -1109,13 +1109,13 @@ class d {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
function W({ loop: n }, e) {
|
|
1111
1111
|
if (n) {
|
|
1112
|
-
|
|
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
|
|
1118
|
+
class Se {
|
|
1119
1119
|
constructor(e) {
|
|
1120
1120
|
this.si = e;
|
|
1121
1121
|
}
|
|
@@ -1171,20 +1171,20 @@ class G {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
// ok
|
|
1173
1173
|
fade(e, t) {
|
|
1174
|
-
const { buf: s = D } = t, i = "const.sn.sound." + s + "." + "volume", r =
|
|
1174
|
+
const { buf: s = D } = t, i = "const.sn.sound." + s + "." + "volume", r = f.getVol(t, NaN);
|
|
1175
1175
|
c.setVal_Nochk("save", i, r);
|
|
1176
1176
|
const u = r * Number(c.getVal("sys:" + i, 1)), a = A(t, "stop", r === 0);
|
|
1177
|
-
a &&
|
|
1178
|
-
const l =
|
|
1177
|
+
a && f.delLoopPlay(s), c.flush();
|
|
1178
|
+
const l = F(t, "time", NaN), h = F(t, "delay", 0);
|
|
1179
1179
|
if (l === 0 && h === 0 || U.isSkipping) {
|
|
1180
1180
|
e.setVol(u), e.stt = a ? new P(e) : new G(e);
|
|
1181
1181
|
return;
|
|
1182
1182
|
}
|
|
1183
1183
|
const y = e.tw();
|
|
1184
|
-
y && (
|
|
1184
|
+
y && (pe.setTwProp(y, t).to({ volume: u }, l).onUpdate(() => {
|
|
1185
1185
|
e.snd?.isPlaying || (y.stop(), y.onComplete());
|
|
1186
1186
|
}).onComplete(() => {
|
|
1187
|
-
|
|
1187
|
+
fe(y), e.stt.compFade(s), e.stt = a ? new P(e) : new G(e);
|
|
1188
1188
|
}).start(), e.stt = new je(y, e));
|
|
1189
1189
|
}
|
|
1190
1190
|
wf = () => !1;
|
|
@@ -1246,7 +1246,7 @@ class je {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
// ok
|
|
1248
1248
|
wf(e, t) {
|
|
1249
|
-
e.stt = new
|
|
1249
|
+
e.stt = new ke(e);
|
|
1250
1250
|
const s = A(t, "canskip", !1);
|
|
1251
1251
|
if (s && U.isSkipping)
|
|
1252
1252
|
return this.stopfadese(), !1;
|
|
@@ -1259,7 +1259,7 @@ class je {
|
|
|
1259
1259
|
stopfadese = () => this.si.stop();
|
|
1260
1260
|
isDestroy = !1;
|
|
1261
1261
|
}
|
|
1262
|
-
class
|
|
1262
|
+
class ke {
|
|
1263
1263
|
constructor(e) {
|
|
1264
1264
|
this.si = e;
|
|
1265
1265
|
}
|
|
@@ -1317,9 +1317,9 @@ class P {
|
|
|
1317
1317
|
}
|
|
1318
1318
|
export {
|
|
1319
1319
|
D as B,
|
|
1320
|
-
|
|
1320
|
+
Ve as I,
|
|
1321
1321
|
z as R,
|
|
1322
|
-
|
|
1323
|
-
|
|
1322
|
+
f as S,
|
|
1323
|
+
X as a
|
|
1324
1324
|
};
|
|
1325
1325
|
//# sourceMappingURL=SndBuf.js.map
|