@famibee/skynovel 1.64.8 → 1.64.10
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/README.md +1 -1
- package/dist/Button.js +162 -0
- package/dist/Button.js.map +1 -0
- package/dist/CallStack.js.map +1 -1
- package/dist/CmnTween.js +201 -0
- package/dist/CmnTween.js.map +1 -0
- package/dist/DebugMng.js +105 -0
- package/dist/DebugMng.js.map +1 -0
- package/dist/EventMng.js +40 -39
- package/dist/EventMng.js.map +1 -1
- package/dist/GrpLayer.js +192 -0
- package/dist/GrpLayer.js.map +1 -0
- package/dist/LayerMng.js +483 -2422
- package/dist/LayerMng.js.map +1 -1
- package/dist/Main.js +394 -0
- package/dist/Main.js.map +1 -0
- package/dist/PropParser.js +1 -1
- package/dist/PropParser.js.map +1 -1
- package/dist/Reading.js +11 -11
- package/dist/Reading.js.map +1 -1
- package/dist/RubySpliter.js +90 -0
- package/dist/RubySpliter.js.map +1 -0
- package/dist/ScriptIterator.js +263 -353
- package/dist/ScriptIterator.js.map +1 -1
- package/dist/SndBuf.js +746 -949
- package/dist/SndBuf.js.map +1 -1
- package/dist/SoundMng.js +1 -1
- package/dist/SoundMng.js.map +1 -1
- package/dist/SpritesMng.js +229 -0
- package/dist/SpritesMng.js.map +1 -0
- package/dist/TxtLayer.js +1402 -0
- package/dist/TxtLayer.js.map +1 -0
- package/dist/Variable.js +157 -164
- package/dist/Variable.js.map +1 -1
- package/dist/app.d.ts +4 -4
- package/dist/app.d.ts.map +1 -1
- package/dist/appMain.d.ts.map +1 -1
- package/dist/appMain_cmn.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/platform.js +369 -0
- package/dist/platform.js.map +1 -0
- package/dist/sn/Button.d.ts +2 -2
- package/dist/sn/CallStack.d.ts +2 -2
- package/dist/sn/CmnInterface.d.ts +39 -41
- package/dist/sn/CmnInterface.d.ts.map +1 -1
- package/dist/sn/CmnLib.d.ts +11 -7
- package/dist/sn/CmnLib.d.ts.map +1 -1
- package/dist/sn/CmnTween.d.ts +9 -9
- package/dist/sn/Config.d.ts.map +1 -1
- package/dist/sn/ConfigBase.d.ts +16 -17
- package/dist/sn/ConfigBase.d.ts.map +1 -1
- package/dist/sn/DebugMng.d.ts +2 -2
- package/dist/sn/DebugMng.d.ts.map +1 -1
- package/dist/sn/DesignCast.d.ts +9 -9
- package/dist/sn/DesignCast.d.ts.map +1 -1
- package/dist/sn/EventMng.d.ts +4 -4
- package/dist/sn/EventMng.d.ts.map +1 -1
- package/dist/sn/FrameMng.d.ts +5 -5
- package/dist/sn/FrameMng.d.ts.map +1 -1
- package/dist/sn/Grammar.d.ts +124 -124
- package/dist/sn/Grammar.d.ts.map +1 -1
- package/dist/sn/GrpLayer.d.ts +7 -7
- package/dist/sn/GrpLayer.d.ts.map +1 -1
- package/dist/sn/Hyphenation.d.ts +2 -2
- package/dist/sn/Layer.d.ts +10 -10
- package/dist/sn/LayerMng.d.ts +7 -8
- package/dist/sn/LayerMng.d.ts.map +1 -1
- package/dist/sn/Log.d.ts +3 -3
- package/dist/sn/Log.d.ts.map +1 -1
- package/dist/sn/Main.d.ts +6 -5
- package/dist/sn/Main.d.ts.map +1 -1
- package/dist/sn/Pages.d.ts +8 -8
- package/dist/sn/Pages.d.ts.map +1 -1
- package/dist/sn/PropParser.d.ts +3 -3
- package/dist/sn/PropParser.d.ts.map +1 -1
- package/dist/sn/Reading.d.ts +12 -12
- package/dist/sn/Reading.d.ts.map +1 -1
- package/dist/sn/RubySpliter.d.ts +4 -4
- package/dist/sn/RubySpliter.d.ts.map +1 -1
- package/dist/sn/ScriptIterator.d.ts +5 -6
- package/dist/sn/ScriptIterator.d.ts.map +1 -1
- package/dist/sn/SndBuf.d.ts +12 -12
- package/dist/sn/SndBuf.d.ts.map +1 -1
- package/dist/sn/SoundMng.d.ts +4 -4
- package/dist/sn/SoundMng.d.ts.map +1 -1
- package/dist/sn/SpritesMng.d.ts +5 -5
- package/dist/sn/SpritesMng.d.ts.map +1 -1
- package/dist/sn/SysApp.d.ts +13 -10
- package/dist/sn/SysApp.d.ts.map +1 -1
- package/dist/sn/SysBase.d.ts +33 -32
- package/dist/sn/SysBase.d.ts.map +1 -1
- package/dist/sn/SysWeb.d.ts +7 -11
- package/dist/sn/SysWeb.d.ts.map +1 -1
- package/dist/sn/TxtLayer.d.ts +10 -8
- package/dist/sn/TxtLayer.d.ts.map +1 -1
- package/dist/sn/TxtStage.d.ts +5 -5
- package/dist/sn/TxtStage.d.ts.map +1 -1
- package/dist/sn/Variable.d.ts +9 -8
- package/dist/sn/Variable.d.ts.map +1 -1
- package/dist/test/SysTest.d.ts +2 -2
- package/dist/test/ValTest.d.ts +4 -4
- package/dist/test/ValTest.d.ts.map +1 -1
- package/dist/web.d.ts +4 -4
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +3 -3
- package/dist/web2.js +6959 -8339
- package/dist/web2.js.map +1 -1
- package/dist_app/Button.js +162 -0
- package/dist_app/Button.js.map +1 -0
- package/dist_app/CallStack.js.map +1 -1
- package/dist_app/CmnTween.js +201 -0
- package/dist_app/CmnTween.js.map +1 -0
- package/dist_app/EventMng.js +40 -39
- package/dist_app/EventMng.js.map +1 -1
- package/dist_app/GrpLayer.js +192 -0
- package/dist_app/GrpLayer.js.map +1 -0
- package/dist_app/LayerMng.js +483 -2422
- package/dist_app/LayerMng.js.map +1 -1
- package/dist_app/Main.js +393 -0
- package/dist_app/Main.js.map +1 -0
- package/dist_app/PropParser.js.map +1 -1
- package/dist_app/Reading.js +19 -19
- package/dist_app/Reading.js.map +1 -1
- package/dist_app/RubySpliter.js +90 -0
- package/dist_app/RubySpliter.js.map +1 -0
- package/dist_app/ScriptIterator.js +216 -307
- package/dist_app/ScriptIterator.js.map +1 -1
- package/dist_app/SndBuf.js +746 -949
- package/dist_app/SndBuf.js.map +1 -1
- package/dist_app/SoundMng.js +1 -1
- package/dist_app/SoundMng.js.map +1 -1
- package/dist_app/SpritesMng.js +228 -0
- package/dist_app/SpritesMng.js.map +1 -0
- package/dist_app/TxtLayer.js +1401 -0
- package/dist_app/TxtLayer.js.map +1 -0
- package/dist_app/Variable.js +157 -164
- package/dist_app/Variable.js.map +1 -1
- package/dist_app/app.d.ts +4 -4
- package/dist_app/app.d.ts.map +1 -1
- package/dist_app/app.js +2 -2
- package/dist_app/app2.js +3075 -4351
- package/dist_app/app2.js.map +1 -1
- package/dist_app/appMain.d.ts.map +1 -1
- package/dist_app/appMain.js +18 -18
- package/dist_app/appMain.js.map +1 -1
- package/dist_app/appMain_cmn.d.ts.map +1 -1
- package/dist_app/index.d.ts +0 -1
- package/dist_app/index.d.ts.map +1 -1
- package/dist_app/platform.js +369 -0
- package/dist_app/platform.js.map +1 -0
- package/dist_app/sn/Button.d.ts +2 -2
- package/dist_app/sn/CallStack.d.ts +2 -2
- package/dist_app/sn/CmnInterface.d.ts +39 -41
- package/dist_app/sn/CmnInterface.d.ts.map +1 -1
- package/dist_app/sn/CmnLib.d.ts +11 -7
- package/dist_app/sn/CmnLib.d.ts.map +1 -1
- package/dist_app/sn/CmnTween.d.ts +9 -9
- package/dist_app/sn/Config.d.ts.map +1 -1
- package/dist_app/sn/ConfigBase.d.ts +16 -17
- package/dist_app/sn/ConfigBase.d.ts.map +1 -1
- package/dist_app/sn/DebugMng.d.ts +2 -2
- package/dist_app/sn/DebugMng.d.ts.map +1 -1
- package/dist_app/sn/DesignCast.d.ts +9 -9
- package/dist_app/sn/DesignCast.d.ts.map +1 -1
- package/dist_app/sn/EventMng.d.ts +4 -4
- package/dist_app/sn/EventMng.d.ts.map +1 -1
- package/dist_app/sn/FrameMng.d.ts +5 -5
- package/dist_app/sn/FrameMng.d.ts.map +1 -1
- package/dist_app/sn/Grammar.d.ts +124 -124
- package/dist_app/sn/Grammar.d.ts.map +1 -1
- package/dist_app/sn/GrpLayer.d.ts +7 -7
- package/dist_app/sn/GrpLayer.d.ts.map +1 -1
- package/dist_app/sn/Hyphenation.d.ts +2 -2
- package/dist_app/sn/Layer.d.ts +10 -10
- package/dist_app/sn/LayerMng.d.ts +7 -8
- package/dist_app/sn/LayerMng.d.ts.map +1 -1
- package/dist_app/sn/Log.d.ts +3 -3
- package/dist_app/sn/Log.d.ts.map +1 -1
- package/dist_app/sn/Main.d.ts +6 -5
- package/dist_app/sn/Main.d.ts.map +1 -1
- package/dist_app/sn/Pages.d.ts +8 -8
- package/dist_app/sn/Pages.d.ts.map +1 -1
- package/dist_app/sn/PropParser.d.ts +3 -3
- package/dist_app/sn/PropParser.d.ts.map +1 -1
- package/dist_app/sn/Reading.d.ts +12 -12
- package/dist_app/sn/Reading.d.ts.map +1 -1
- package/dist_app/sn/RubySpliter.d.ts +4 -4
- package/dist_app/sn/RubySpliter.d.ts.map +1 -1
- package/dist_app/sn/ScriptIterator.d.ts +5 -6
- package/dist_app/sn/ScriptIterator.d.ts.map +1 -1
- package/dist_app/sn/SndBuf.d.ts +12 -12
- package/dist_app/sn/SndBuf.d.ts.map +1 -1
- package/dist_app/sn/SoundMng.d.ts +4 -4
- package/dist_app/sn/SoundMng.d.ts.map +1 -1
- package/dist_app/sn/SpritesMng.d.ts +5 -5
- package/dist_app/sn/SpritesMng.d.ts.map +1 -1
- package/dist_app/sn/SysApp.d.ts +13 -10
- package/dist_app/sn/SysApp.d.ts.map +1 -1
- package/dist_app/sn/SysBase.d.ts +33 -32
- package/dist_app/sn/SysBase.d.ts.map +1 -1
- package/dist_app/sn/SysWeb.d.ts +7 -11
- package/dist_app/sn/SysWeb.d.ts.map +1 -1
- package/dist_app/sn/TxtLayer.d.ts +10 -8
- package/dist_app/sn/TxtLayer.d.ts.map +1 -1
- package/dist_app/sn/TxtStage.d.ts +5 -5
- package/dist_app/sn/TxtStage.d.ts.map +1 -1
- package/dist_app/sn/Variable.d.ts +9 -8
- package/dist_app/sn/Variable.d.ts.map +1 -1
- package/dist_app/test/SysTest.d.ts +2 -2
- package/dist_app/test/ValTest.d.ts +4 -4
- package/dist_app/test/ValTest.d.ts.map +1 -1
- package/dist_app/web.d.ts +4 -4
- package/dist_app/web.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/sn/SysNode.d.ts +0 -15
- package/dist/sn/SysNode.d.ts.map +0 -1
- package/dist_app/sn/SysNode.d.ts +0 -15
- package/dist_app/sn/SysNode.d.ts.map +0 -1
package/dist_app/SndBuf.js
CHANGED
|
@@ -1,282 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
static #s;
|
|
8
|
-
static #e;
|
|
9
|
-
static init(t, e) {
|
|
10
|
-
this.#t = {}, this.#s = t, this.#e = e, this.#e.ticker.add(this.#n);
|
|
11
|
-
}
|
|
12
|
-
static #n = () => mt();
|
|
13
|
-
static destroy() {
|
|
14
|
-
this.stopAllTw(), this.#e.ticker.remove(this.#n);
|
|
15
|
-
}
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
static setTwProp(t, e) {
|
|
18
|
-
const s = S(e, "repeat", 1);
|
|
19
|
-
return t.delay(S(e, "delay", 0)).easing(this.ease(e.ease)).repeat(s > 0 ? s - 1 : 1 / 0).yoyo(V(e, "yoyo", !1));
|
|
20
|
-
}
|
|
21
|
-
static #o = {
|
|
22
|
-
"Back.In": (t) => f.Back.In(t),
|
|
23
|
-
"Back.InOut": (t) => f.Back.InOut(t),
|
|
24
|
-
"Back.Out": (t) => f.Back.Out(t),
|
|
25
|
-
"Bounce.In": (t) => f.Bounce.In(t),
|
|
26
|
-
"Bounce.InOut": (t) => f.Bounce.InOut(t),
|
|
27
|
-
"Bounce.Out": (t) => f.Bounce.Out(t),
|
|
28
|
-
"Circular.In": (t) => f.Circular.In(t),
|
|
29
|
-
"Circular.InOut": (t) => f.Circular.InOut(t),
|
|
30
|
-
"Circular.Out": (t) => f.Circular.Out(t),
|
|
31
|
-
"Cubic.In": (t) => f.Cubic.In(t),
|
|
32
|
-
"Cubic.InOut": (t) => f.Cubic.InOut(t),
|
|
33
|
-
"Cubic.Out": (t) => f.Cubic.Out(t),
|
|
34
|
-
"Elastic.In": (t) => f.Elastic.In(t),
|
|
35
|
-
"Elastic.InOut": (t) => f.Elastic.InOut(t),
|
|
36
|
-
"Elastic.Out": (t) => f.Elastic.Out(t),
|
|
37
|
-
"Exponential.In": (t) => f.Exponential.In(t),
|
|
38
|
-
"Exponential.InOut": (t) => f.Exponential.InOut(t),
|
|
39
|
-
"Exponential.Out": (t) => f.Exponential.Out(t),
|
|
40
|
-
"Linear.None": (t) => f.Linear.None(t),
|
|
41
|
-
"Quadratic.In": (t) => f.Quadratic.In(t),
|
|
42
|
-
"Quadratic.InOut": (t) => f.Quadratic.InOut(t),
|
|
43
|
-
"Quadratic.Out": (t) => f.Quadratic.Out(t),
|
|
44
|
-
"Quartic.In": (t) => f.Quartic.In(t),
|
|
45
|
-
"Quartic.InOut": (t) => f.Quartic.InOut(t),
|
|
46
|
-
"Quartic.Out": (t) => f.Quartic.Out(t),
|
|
47
|
-
"Quintic.In": (t) => f.Quintic.In(t),
|
|
48
|
-
"Quintic.InOut": (t) => f.Quintic.InOut(t),
|
|
49
|
-
"Quintic.Out": (t) => f.Quintic.Out(t),
|
|
50
|
-
"Sinusoidal.In": (t) => f.Sinusoidal.In(t),
|
|
51
|
-
"Sinusoidal.InOut": (t) => f.Sinusoidal.InOut(t),
|
|
52
|
-
"Sinusoidal.Out": (t) => f.Sinusoidal.Out(t)
|
|
53
|
-
};
|
|
54
|
-
static ease(t) {
|
|
55
|
-
if (!t) return (s) => f.Linear.None(s);
|
|
56
|
-
const e = this.#o[t];
|
|
57
|
-
if (!e) throw "異常なease指定です";
|
|
58
|
-
return e;
|
|
59
|
-
}
|
|
60
|
-
static hMemberCnt = {
|
|
61
|
-
alpha: 0,
|
|
62
|
-
height: 0,
|
|
63
|
-
rotation: 0,
|
|
64
|
-
// rotationX〜Z、scaleZ、zは設定すると
|
|
65
|
-
scale_x: 0,
|
|
66
|
-
// 三次元方向の拡大縮小ルーチンが働き画像がぼやけるので
|
|
67
|
-
scale_y: 0,
|
|
68
|
-
// backlayで設定しない方針
|
|
69
|
-
pivot_x: 0,
|
|
70
|
-
pivot_y: 0,
|
|
71
|
-
width: 0,
|
|
72
|
-
x: 0,
|
|
73
|
-
y: 0
|
|
74
|
-
};
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
-
static cnvTweenArg(t, e) {
|
|
77
|
-
const s = {};
|
|
78
|
-
for (const o of Object.keys(this.hMemberCnt)) {
|
|
79
|
-
const i = t[o];
|
|
80
|
-
if (!i) continue;
|
|
81
|
-
const r = String(i), a = r.startsWith("="), u = a ? r.slice(1) : r;
|
|
82
|
-
if (!u) continue;
|
|
83
|
-
const [c, l] = u.split(","), _ = s[o] = parseFloat(c);
|
|
84
|
-
l && (s[o] += Math.round(
|
|
85
|
-
Math.random() * (parseFloat(l) - _ + 1)
|
|
86
|
-
)), a && (s[o] += parseFloat(e[o]));
|
|
87
|
-
}
|
|
88
|
-
return s;
|
|
89
|
-
}
|
|
90
|
-
// トゥイーン全停止
|
|
91
|
-
static stopAllTw() {
|
|
92
|
-
this.#t = {}, gt();
|
|
93
|
-
}
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
-
static tween(t, e, s, o, i, r, a, u = !0) {
|
|
96
|
-
const c = this.#s.isSkipping ? 0 : S(e, "time", NaN), l = new Z(s).to(o, c).onUpdate(i);
|
|
97
|
-
this.setTwProp(l, e), this.#t[t] = { tw: l, onEnd: a };
|
|
98
|
-
const { path: _ } = e;
|
|
99
|
-
let m = l;
|
|
100
|
-
if (_) {
|
|
101
|
-
Y.debugLog && console.group(`🍝 [${e[":タグ名"]}] path=${_}= start(${s.x},${s.y},${s.alpha})`);
|
|
102
|
-
for (const { groups: h } of _.matchAll(this.#a)) {
|
|
103
|
-
const { x: v, x2: T, y: p, y2: P, o: F, o2: O, json: L } = h;
|
|
104
|
-
let E = {};
|
|
105
|
-
if (L) try {
|
|
106
|
-
E = JSON.parse(L);
|
|
107
|
-
} catch (ft) {
|
|
108
|
-
console.error(`🍝 json=${L} ` + String(ft));
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
else
|
|
112
|
-
(v ?? T) && (E.x = v ?? T), (p ?? P) && (E.y = p ?? P), (F ?? O) && (E.alpha = Number(F ?? O));
|
|
113
|
-
const K = this.cnvTweenArg(E, s);
|
|
114
|
-
Y.debugLog && console.info(`🍝 ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
115
|
-
L ?? `{x:${v} y:${p} o:${F}}`} => hTo:${JSON.stringify(K)}`);
|
|
116
|
-
const W = new Z(s).to(K, c);
|
|
117
|
-
this.setTwProp(W, e), m.chain(W), m = W;
|
|
118
|
-
}
|
|
119
|
-
Y.debugLog && console.groupEnd();
|
|
120
|
-
}
|
|
121
|
-
m.onComplete(() => {
|
|
122
|
-
const h = this.#t[t];
|
|
123
|
-
h?.tw && (delete this.#t[t], h.tw = void 0, l.stop(), h.onEnd?.(), r(), k.notifyEndProc(Q + t));
|
|
124
|
-
});
|
|
125
|
-
const { chain: b } = e;
|
|
126
|
-
if (b) {
|
|
127
|
-
const h = this.#t[b];
|
|
128
|
-
if (!h?.tw) throw `${b}は存在しない・または終了したトゥイーンです`;
|
|
129
|
-
delete h.onEnd, h.tw.chain(l);
|
|
130
|
-
} else u && l.start();
|
|
131
|
-
return l;
|
|
132
|
-
}
|
|
133
|
-
// 11 match 301 step (0.1ms) PCRE2 https://regex101.com/r/reinpq/1
|
|
134
|
-
// List ${x}${x2}/${y}${y2}/${o}${o2}=${json}\n
|
|
135
|
-
/*
|
|
136
|
-
\(\s*
|
|
137
|
-
(?: (?<x>[-=\d\.]+) | (['"]) (?<x2>.*?) \2 )?
|
|
138
|
-
(?:
|
|
139
|
-
\s*,\s*
|
|
140
|
-
(?: (?<y>[-=\d\.]+) | (['"]) (?<y2>.*?) \5 )?
|
|
141
|
-
(?:
|
|
142
|
-
\s*,\s*
|
|
143
|
-
(?: (?<o>[-=\d\.]+) | (['"]) (?<o2>.*?) \8 )
|
|
144
|
-
|
|
145
|
-
)?
|
|
146
|
-
)?
|
|
147
|
-
|
|
|
148
|
-
(?<json>\{[^{}]*})
|
|
149
|
-
*/
|
|
150
|
-
static #a = /\(\s*(?:(?<x>[-=\d.]+)|(['"])(?<x2>.*?)\2)?(?:\s*,\s*(?:(?<y>[-=\d.]+)|(['"])(?<y2>.*?)\5)?(?:\s*,\s*(?:(?<o>[-=\d.]+)|(['"])(?<o2>.*?)\8))?)?|(?<json>\{[^{}]*})/g;
|
|
151
|
-
// トランス終了待ち
|
|
152
|
-
static wt(t) {
|
|
153
|
-
if (!this.#t[$]?.tw) return !1;
|
|
154
|
-
const s = () => this.#r();
|
|
155
|
-
return k.beginProc(Q + $, s, !0, s), !0;
|
|
156
|
-
}
|
|
157
|
-
// レイヤのトランジションの停止
|
|
158
|
-
static #r() {
|
|
159
|
-
this.#t[$]?.tw?.stop().end();
|
|
160
|
-
}
|
|
161
|
-
// stop()とend()は別
|
|
162
|
-
static async closeTrans() {
|
|
163
|
-
if (!this.#t[$]?.tw) return;
|
|
164
|
-
const { promise: e, resolve: s } = Promise.withResolvers();
|
|
165
|
-
k.beginProc(Q + $, s, !1, s), this.#r(), await e;
|
|
166
|
-
}
|
|
167
|
-
// トゥイーン終了待ち
|
|
168
|
-
static wait_tsy(t) {
|
|
169
|
-
const e = this.#i(t), s = this.#t[e];
|
|
170
|
-
if (!s?.tw) return !1;
|
|
171
|
-
const o = () => s.tw?.end();
|
|
172
|
-
return k.beginProc(Q + e, o, !0, o), !0;
|
|
173
|
-
}
|
|
174
|
-
static #i(t) {
|
|
175
|
-
const { layer: e = "", id: s, name: o } = t, i = s ? `frm
|
|
176
|
-
${s}` : o ?? e;
|
|
177
|
-
if (!i) throw "トゥイーンが指定されていません";
|
|
178
|
-
return i;
|
|
179
|
-
}
|
|
180
|
-
// トゥイーン中断
|
|
181
|
-
static stop_tsy(t) {
|
|
182
|
-
const e = this.#i(t);
|
|
183
|
-
return this.#t[e]?.tw?.stop().end(), !1;
|
|
184
|
-
}
|
|
185
|
-
// 一時停止
|
|
186
|
-
static pause_tsy(t) {
|
|
187
|
-
const e = this.#i(t);
|
|
188
|
-
return this.#t[e]?.tw?.pause(), !1;
|
|
189
|
-
}
|
|
190
|
-
// 一時停止再開
|
|
191
|
-
static resume_tsy(t) {
|
|
192
|
-
const e = this.#i(t);
|
|
193
|
-
return this.#t[e]?.tw?.resume(), !1;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/*!
|
|
197
|
-
* @pixi/sound - v4.4.1
|
|
198
|
-
* https://github.com/pixijs/pixi-sound
|
|
199
|
-
* Compiled Tue, 15 Aug 2023 19:22:13 UTC
|
|
200
|
-
*
|
|
201
|
-
* @pixi/sound is licensed under the MIT license.
|
|
202
|
-
* http://www.opensource.org/licenses/mit-license
|
|
203
|
-
*/
|
|
204
|
-
var at;
|
|
205
|
-
function g() {
|
|
206
|
-
return at;
|
|
1
|
+
import { l as R, m as w, T as M, n as ue, k as F, e as A, S as ae, L as le } from "./app2.js";
|
|
2
|
+
import { C as ce } from "./CmnTween.js";
|
|
3
|
+
import { a as L, T as pe, r as he } from "./Reading.js";
|
|
4
|
+
var ee;
|
|
5
|
+
function _() {
|
|
6
|
+
return ee;
|
|
207
7
|
}
|
|
208
|
-
var
|
|
209
|
-
return (
|
|
210
|
-
|
|
211
|
-
} || function(
|
|
212
|
-
for (var o in s) Object.prototype.hasOwnProperty.call(s, o) && (
|
|
213
|
-
})(n,
|
|
8
|
+
var te = function(n, e) {
|
|
9
|
+
return (te = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, s) {
|
|
10
|
+
t.__proto__ = s;
|
|
11
|
+
} || function(t, s) {
|
|
12
|
+
for (var o in s) Object.prototype.hasOwnProperty.call(s, o) && (t[o] = s[o]);
|
|
13
|
+
})(n, e);
|
|
214
14
|
};
|
|
215
|
-
function
|
|
216
|
-
if (typeof
|
|
217
|
-
function
|
|
15
|
+
function b(n, e) {
|
|
16
|
+
if (typeof e != "function" && e !== null) throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
17
|
+
function t() {
|
|
218
18
|
this.constructor = n;
|
|
219
19
|
}
|
|
220
|
-
|
|
20
|
+
te(n, e), n.prototype = e === null ? Object.create(e) : (t.prototype = e.prototype, new t());
|
|
221
21
|
}
|
|
222
|
-
var
|
|
223
|
-
return (
|
|
224
|
-
for (var
|
|
22
|
+
var V = function() {
|
|
23
|
+
return (V = Object.assign || function(n) {
|
|
24
|
+
for (var e, t = 1, s = arguments.length; t < s; t++) for (var o in e = arguments[t]) Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]);
|
|
225
25
|
return n;
|
|
226
26
|
}).apply(this, arguments);
|
|
227
|
-
},
|
|
228
|
-
function
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
var
|
|
232
|
-
s[
|
|
233
|
-
}), Object.assign(
|
|
27
|
+
}, se = ["mp3", "ogg", "oga", "opus", "mpeg", "wav", "m4a", "aiff", "wma", "mid", "caf"], U = {};
|
|
28
|
+
function fe(n) {
|
|
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;
|
|
33
|
+
}), Object.assign(U, s);
|
|
234
34
|
}
|
|
235
|
-
|
|
236
|
-
var
|
|
237
|
-
function
|
|
238
|
-
var
|
|
239
|
-
if (!
|
|
240
|
-
for (var s =
|
|
241
|
-
var
|
|
242
|
-
if (
|
|
243
|
-
|
|
35
|
+
fe();
|
|
36
|
+
var de = /\.(\{([^\}]+)\})(\?.*)?$/;
|
|
37
|
+
function ne(n) {
|
|
38
|
+
var e = de, t = typeof n == "string" ? n : n.url;
|
|
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];
|
|
42
|
+
if (U[a]) {
|
|
43
|
+
r = a;
|
|
244
44
|
break;
|
|
245
45
|
}
|
|
246
46
|
}
|
|
247
|
-
var
|
|
47
|
+
var l = t.replace(s[1], r);
|
|
248
48
|
if (typeof n != "string") {
|
|
249
|
-
var
|
|
250
|
-
|
|
49
|
+
var h = n;
|
|
50
|
+
h.extension = r, h.url = l;
|
|
251
51
|
}
|
|
252
|
-
return
|
|
52
|
+
return l;
|
|
253
53
|
}
|
|
254
|
-
var
|
|
255
|
-
return
|
|
256
|
-
}),
|
|
54
|
+
var q = se.filter(function(n) {
|
|
55
|
+
return U[n];
|
|
56
|
+
}), oe = function() {
|
|
257
57
|
function n() {
|
|
258
58
|
}
|
|
259
59
|
return n.add = function() {
|
|
260
|
-
n.setLegacy(
|
|
261
|
-
}, n.setLegacy = function(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}) :
|
|
265
|
-
|
|
60
|
+
n.setLegacy(_().useLegacy);
|
|
61
|
+
}, n.setLegacy = function(e) {
|
|
62
|
+
e ? q.forEach(function(t) {
|
|
63
|
+
w.setExtensionXhrType(t, w.XHR_RESPONSE_TYPE.DEFAULT), w.setExtensionLoadType(t, w.LOAD_TYPE.AUDIO);
|
|
64
|
+
}) : q.forEach(function(t) {
|
|
65
|
+
w.setExtensionXhrType(t, w.XHR_RESPONSE_TYPE.BUFFER), w.setExtensionLoadType(t, w.LOAD_TYPE.XHR);
|
|
266
66
|
});
|
|
267
|
-
}, n.pre = function(
|
|
268
|
-
|
|
269
|
-
}, n.use = function(
|
|
270
|
-
|
|
67
|
+
}, n.pre = function(e, t) {
|
|
68
|
+
ne(e), t();
|
|
69
|
+
}, n.use = function(e, t) {
|
|
70
|
+
e.data && q.indexOf(e.extension) > -1 ? e.sound = _().add(e.name, { loaded: t, preload: !0, url: e.url, source: e.data }) : t();
|
|
271
71
|
}, n.extension = "loader", n;
|
|
272
|
-
}(),
|
|
273
|
-
function t
|
|
72
|
+
}(), _e = 0, ye = function(n) {
|
|
73
|
+
function e(t) {
|
|
274
74
|
var s = n.call(this) || this;
|
|
275
|
-
return s.id =
|
|
75
|
+
return s.id = _e++, s.init(t), s;
|
|
276
76
|
}
|
|
277
|
-
return
|
|
278
|
-
if (this[
|
|
279
|
-
switch (
|
|
77
|
+
return b(e, n), e.prototype.set = function(t, s) {
|
|
78
|
+
if (this[t] === void 0) throw new Error("Property with name ".concat(t, " does not exist."));
|
|
79
|
+
switch (t) {
|
|
280
80
|
case "speed":
|
|
281
81
|
this.speed = s;
|
|
282
82
|
break;
|
|
@@ -293,142 +93,142 @@ var J = ct.filter(function(n) {
|
|
|
293
93
|
this.muted = s;
|
|
294
94
|
}
|
|
295
95
|
return this;
|
|
296
|
-
}, Object.defineProperty(
|
|
96
|
+
}, Object.defineProperty(e.prototype, "progress", { get: function() {
|
|
297
97
|
return this._source.currentTime / this._duration;
|
|
298
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
98
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "paused", { get: function() {
|
|
299
99
|
return this._paused;
|
|
300
|
-
}, set: function(
|
|
301
|
-
this._paused =
|
|
302
|
-
}, enumerable: !1, configurable: !0 }),
|
|
100
|
+
}, set: function(t) {
|
|
101
|
+
this._paused = t, this.refreshPaused();
|
|
102
|
+
}, enumerable: !1, configurable: !0 }), e.prototype._onPlay = function() {
|
|
303
103
|
this._playing = !0;
|
|
304
|
-
},
|
|
104
|
+
}, e.prototype._onPause = function() {
|
|
305
105
|
this._playing = !1;
|
|
306
|
-
},
|
|
307
|
-
this._playing = !1, this._duration =
|
|
308
|
-
var s = this._source =
|
|
309
|
-
s.src =
|
|
310
|
-
},
|
|
106
|
+
}, e.prototype.init = function(t) {
|
|
107
|
+
this._playing = !1, this._duration = t.source.duration;
|
|
108
|
+
var s = this._source = t.source.cloneNode(!1);
|
|
109
|
+
s.src = t.parent.url, s.onplay = this._onPlay.bind(this), s.onpause = this._onPause.bind(this), t.context.on("refresh", this.refresh, this), t.context.on("refreshPaused", this.refreshPaused, this), this._media = t;
|
|
110
|
+
}, e.prototype._internalStop = function() {
|
|
311
111
|
this._source && this._playing && (this._source.onended = null, this._source.pause());
|
|
312
|
-
},
|
|
112
|
+
}, e.prototype.stop = function() {
|
|
313
113
|
this._internalStop(), this._source && this.emit("stop");
|
|
314
|
-
}, Object.defineProperty(
|
|
114
|
+
}, Object.defineProperty(e.prototype, "speed", { get: function() {
|
|
315
115
|
return this._speed;
|
|
316
|
-
}, set: function(
|
|
317
|
-
this._speed =
|
|
318
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
116
|
+
}, set: function(t) {
|
|
117
|
+
this._speed = t, this.refresh();
|
|
118
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "volume", { get: function() {
|
|
319
119
|
return this._volume;
|
|
320
|
-
}, set: function(
|
|
321
|
-
this._volume =
|
|
322
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
120
|
+
}, set: function(t) {
|
|
121
|
+
this._volume = t, this.refresh();
|
|
122
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "loop", { get: function() {
|
|
323
123
|
return this._loop;
|
|
324
|
-
}, set: function(
|
|
325
|
-
this._loop =
|
|
326
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
124
|
+
}, set: function(t) {
|
|
125
|
+
this._loop = t, this.refresh();
|
|
126
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "muted", { get: function() {
|
|
327
127
|
return this._muted;
|
|
328
|
-
}, set: function(
|
|
329
|
-
this._muted =
|
|
330
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
128
|
+
}, set: function(t) {
|
|
129
|
+
this._muted = t, this.refresh();
|
|
130
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "filters", { get: function() {
|
|
331
131
|
return null;
|
|
332
|
-
}, set: function(
|
|
333
|
-
}, enumerable: !1, configurable: !0 }),
|
|
334
|
-
var
|
|
132
|
+
}, set: function(t) {
|
|
133
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.refresh = function() {
|
|
134
|
+
var t = this._media.context, s = this._media.parent;
|
|
335
135
|
this._source.loop = this._loop || s.loop;
|
|
336
|
-
var o =
|
|
337
|
-
this._source.volume =
|
|
338
|
-
},
|
|
339
|
-
var
|
|
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;
|
|
138
|
+
}, e.prototype.refreshPaused = function() {
|
|
139
|
+
var t = this._media.context, s = this._media.parent, o = this._paused || s.paused || t.paused;
|
|
340
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));
|
|
341
|
-
},
|
|
342
|
-
var s = this, o =
|
|
343
|
-
this._speed =
|
|
344
|
-
s._source && (s._source.currentTime = o, s._source.onloadedmetadata = null, s.emit("progress", o, s._duration),
|
|
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));
|
|
345
145
|
}, this._source.onended = this._onComplete.bind(this), this._source.play(), this.emit("start");
|
|
346
|
-
},
|
|
146
|
+
}, e.prototype._onUpdate = function() {
|
|
347
147
|
this.emit("progress", this.progress, this._duration), this._source.currentTime >= this._end && !this._source.loop && this._onComplete();
|
|
348
|
-
},
|
|
349
|
-
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
var
|
|
353
|
-
|
|
354
|
-
},
|
|
148
|
+
}, e.prototype._onComplete = function() {
|
|
149
|
+
M.shared.remove(this._onUpdate, this), this._internalStop(), this.emit("progress", 1, this._duration), this.emit("end", this);
|
|
150
|
+
}, e.prototype.destroy = function() {
|
|
151
|
+
M.shared.remove(this._onUpdate, this), this.removeAllListeners();
|
|
152
|
+
var t = this._source;
|
|
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
|
+
}, e.prototype.toString = function() {
|
|
355
155
|
return "[HTMLAudioInstance id=".concat(this.id, "]");
|
|
356
|
-
},
|
|
357
|
-
}(
|
|
358
|
-
function
|
|
156
|
+
}, e.PADDING = 0.1, e;
|
|
157
|
+
}(R), me = function(n) {
|
|
158
|
+
function e() {
|
|
359
159
|
return n !== null && n.apply(this, arguments) || this;
|
|
360
160
|
}
|
|
361
|
-
return
|
|
362
|
-
this.parent =
|
|
363
|
-
},
|
|
364
|
-
return new
|
|
365
|
-
}, Object.defineProperty(
|
|
161
|
+
return b(e, n), e.prototype.init = function(t) {
|
|
162
|
+
this.parent = t, this._source = t.options.source || new Audio(), t.url && (this._source.src = t.url);
|
|
163
|
+
}, e.prototype.create = function() {
|
|
164
|
+
return new ye(this);
|
|
165
|
+
}, Object.defineProperty(e.prototype, "isPlayable", { get: function() {
|
|
366
166
|
return !!this._source && this._source.readyState === 4;
|
|
367
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
167
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "duration", { get: function() {
|
|
368
168
|
return this._source.duration;
|
|
369
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
169
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "context", { get: function() {
|
|
370
170
|
return this.parent.context;
|
|
371
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
171
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "filters", { get: function() {
|
|
372
172
|
return null;
|
|
373
|
-
}, set: function(
|
|
374
|
-
}, enumerable: !1, configurable: !0 }),
|
|
173
|
+
}, set: function(t) {
|
|
174
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
|
|
375
175
|
this.removeAllListeners(), this.parent = null, this._source && (this._source.src = "", this._source.load(), this._source = null);
|
|
376
|
-
}, Object.defineProperty(
|
|
176
|
+
}, Object.defineProperty(e.prototype, "source", { get: function() {
|
|
377
177
|
return this._source;
|
|
378
|
-
}, enumerable: !1, configurable: !0 }),
|
|
178
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.load = function(t) {
|
|
379
179
|
var s = this._source, o = this.parent;
|
|
380
180
|
if (s.readyState !== 4) if (o.url) {
|
|
381
181
|
s.src = o.url;
|
|
382
|
-
var
|
|
383
|
-
|
|
384
|
-
var
|
|
385
|
-
|
|
386
|
-
},
|
|
387
|
-
|
|
388
|
-
}, a = function() {
|
|
389
|
-
u();
|
|
390
|
-
var l = "Failed to load audio element (code: ".concat(s.error.code, ")");
|
|
391
|
-
e && e(new Error(l));
|
|
182
|
+
var r = function() {
|
|
183
|
+
a(), o.isLoaded = !0;
|
|
184
|
+
var h = o.autoPlayStart();
|
|
185
|
+
t && t(null, o, h);
|
|
186
|
+
}, i = function() {
|
|
187
|
+
a(), t && t(new Error("Sound loading has been aborted"));
|
|
392
188
|
}, u = function() {
|
|
393
|
-
|
|
189
|
+
a();
|
|
190
|
+
var h = "Failed to load audio element (code: ".concat(s.error.code, ")");
|
|
191
|
+
t && t(new Error(h));
|
|
192
|
+
}, a = function() {
|
|
193
|
+
s.removeEventListener("canplaythrough", r), s.removeEventListener("load", r), s.removeEventListener("abort", i), s.removeEventListener("error", u);
|
|
394
194
|
};
|
|
395
|
-
s.addEventListener("canplaythrough",
|
|
396
|
-
} else
|
|
195
|
+
s.addEventListener("canplaythrough", r, !1), s.addEventListener("load", r, !1), s.addEventListener("abort", i, !1), s.addEventListener("error", u, !1), s.load();
|
|
196
|
+
} else t(new Error("sound.url or sound.source must be set"));
|
|
397
197
|
else {
|
|
398
198
|
o.isLoaded = !0;
|
|
399
|
-
var
|
|
400
|
-
|
|
401
|
-
|
|
199
|
+
var l = o.autoPlayStart();
|
|
200
|
+
t && setTimeout(function() {
|
|
201
|
+
t(null, o, l);
|
|
402
202
|
}, 0);
|
|
403
203
|
}
|
|
404
|
-
},
|
|
405
|
-
}(
|
|
406
|
-
function n(
|
|
407
|
-
this.parent =
|
|
204
|
+
}, e;
|
|
205
|
+
}(R), ge = function() {
|
|
206
|
+
function n(e, t) {
|
|
207
|
+
this.parent = e, Object.assign(this, t), this.duration = this.end - this.start;
|
|
408
208
|
}
|
|
409
|
-
return n.prototype.play = function(
|
|
410
|
-
return this.parent.play({ complete:
|
|
209
|
+
return n.prototype.play = function(e) {
|
|
210
|
+
return this.parent.play({ complete: e, speed: this.speed || this.parent.speed, end: this.end, start: this.start, loop: this.loop });
|
|
411
211
|
}, n.prototype.destroy = function() {
|
|
412
212
|
this.parent = null;
|
|
413
213
|
}, n;
|
|
414
|
-
}(),
|
|
214
|
+
}(), v = function() {
|
|
415
215
|
function n() {
|
|
416
216
|
}
|
|
417
|
-
return n.setParamValue = function(
|
|
418
|
-
if (
|
|
419
|
-
var s =
|
|
420
|
-
|
|
421
|
-
} else
|
|
422
|
-
return
|
|
217
|
+
return n.setParamValue = function(e, t) {
|
|
218
|
+
if (e.setValueAtTime) {
|
|
219
|
+
var s = _().context;
|
|
220
|
+
e.setValueAtTime(t, s.audioContext.currentTime);
|
|
221
|
+
} else e.value = t;
|
|
222
|
+
return t;
|
|
423
223
|
}, n;
|
|
424
|
-
}(),
|
|
425
|
-
function t
|
|
224
|
+
}(), be = 0, ve = function(n) {
|
|
225
|
+
function e(t) {
|
|
426
226
|
var s = n.call(this) || this;
|
|
427
|
-
return s.id =
|
|
227
|
+
return s.id = be++, s._media = null, s._paused = !1, s._muted = !1, s._elapsed = 0, s.init(t), s;
|
|
428
228
|
}
|
|
429
|
-
return
|
|
430
|
-
if (this[
|
|
431
|
-
switch (
|
|
229
|
+
return b(e, n), e.prototype.set = function(t, s) {
|
|
230
|
+
if (this[t] === void 0) throw new Error("Property with name ".concat(t, " does not exist."));
|
|
231
|
+
switch (t) {
|
|
432
232
|
case "speed":
|
|
433
233
|
this.speed = s;
|
|
434
234
|
break;
|
|
@@ -445,95 +245,95 @@ var J = ct.filter(function(n) {
|
|
|
445
245
|
this.paused = s;
|
|
446
246
|
}
|
|
447
247
|
return this;
|
|
448
|
-
},
|
|
248
|
+
}, e.prototype.stop = function() {
|
|
449
249
|
this._source && (this._internalStop(), this.emit("stop"));
|
|
450
|
-
}, Object.defineProperty(
|
|
250
|
+
}, Object.defineProperty(e.prototype, "speed", { get: function() {
|
|
451
251
|
return this._speed;
|
|
452
|
-
}, set: function(
|
|
453
|
-
this._speed =
|
|
454
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
252
|
+
}, set: function(t) {
|
|
253
|
+
this._speed = t, this.refresh(), this._update(!0);
|
|
254
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "volume", { get: function() {
|
|
455
255
|
return this._volume;
|
|
456
|
-
}, set: function(
|
|
457
|
-
this._volume =
|
|
458
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
256
|
+
}, set: function(t) {
|
|
257
|
+
this._volume = t, this.refresh();
|
|
258
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "muted", { get: function() {
|
|
459
259
|
return this._muted;
|
|
460
|
-
}, set: function(
|
|
461
|
-
this._muted =
|
|
462
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
260
|
+
}, set: function(t) {
|
|
261
|
+
this._muted = t, this.refresh();
|
|
262
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "loop", { get: function() {
|
|
463
263
|
return this._loop;
|
|
464
|
-
}, set: function(
|
|
465
|
-
this._loop =
|
|
466
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
264
|
+
}, set: function(t) {
|
|
265
|
+
this._loop = t, this.refresh();
|
|
266
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "filters", { get: function() {
|
|
467
267
|
return this._filters;
|
|
468
|
-
}, set: function(
|
|
268
|
+
}, set: function(t) {
|
|
469
269
|
var s;
|
|
470
270
|
this._filters && ((s = this._filters) === null || s === void 0 || s.filter(function(o) {
|
|
471
271
|
return o;
|
|
472
272
|
}).forEach(function(o) {
|
|
473
273
|
return o.disconnect();
|
|
474
|
-
}), this._filters = null, this._source.connect(this._gain)), this._filters =
|
|
475
|
-
}, enumerable: !1, configurable: !0 }),
|
|
274
|
+
}), this._filters = null, this._source.connect(this._gain)), this._filters = t?.length ? t.slice(0) : null, this.refresh();
|
|
275
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.refresh = function() {
|
|
476
276
|
if (this._source) {
|
|
477
|
-
var
|
|
277
|
+
var t = this._media.context, s = this._media.parent;
|
|
478
278
|
this._source.loop = this._loop || s.loop;
|
|
479
|
-
var o =
|
|
480
|
-
|
|
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();
|
|
481
281
|
}
|
|
482
|
-
},
|
|
483
|
-
var
|
|
484
|
-
if (!((
|
|
282
|
+
}, e.prototype.applyFilters = function() {
|
|
283
|
+
var t;
|
|
284
|
+
if (!((t = this._filters) === null || t === void 0) && t.length) {
|
|
485
285
|
this._source.disconnect();
|
|
486
286
|
var s = this._source;
|
|
487
287
|
this._filters.forEach(function(o) {
|
|
488
288
|
s.connect(o.destination), s = o;
|
|
489
289
|
}), s.connect(this._gain);
|
|
490
290
|
}
|
|
491
|
-
},
|
|
492
|
-
var
|
|
291
|
+
}, e.prototype.refreshPaused = function() {
|
|
292
|
+
var t = this._media.context, s = this._media.parent, o = this._paused || s.paused || t.paused;
|
|
493
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));
|
|
494
|
-
},
|
|
495
|
-
var s =
|
|
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;
|
|
496
296
|
this._paused = !1;
|
|
497
|
-
var
|
|
498
|
-
this._source =
|
|
499
|
-
var
|
|
500
|
-
this._duration =
|
|
501
|
-
},
|
|
502
|
-
|
|
503
|
-
}, Object.defineProperty(
|
|
297
|
+
var h = this._media.nodes.cloneBufferSource(), m = h.source, y = h.gain;
|
|
298
|
+
this._source = m, this._gain = y, this._speed = r, this._volume = u, this._loop = !!i, this._muted = a, this._filters = l, this.refresh();
|
|
299
|
+
var g = this._source.buffer.duration;
|
|
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
|
+
}, e.prototype.enableTicker = function(t) {
|
|
302
|
+
M.shared.remove(this._updateListener, this), t && M.shared.add(this._updateListener, this);
|
|
303
|
+
}, Object.defineProperty(e.prototype, "progress", { get: function() {
|
|
504
304
|
return this._progress;
|
|
505
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
305
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "paused", { get: function() {
|
|
506
306
|
return this._paused;
|
|
507
|
-
}, set: function(
|
|
508
|
-
this._paused =
|
|
509
|
-
}, enumerable: !1, configurable: !0 }),
|
|
510
|
-
var
|
|
511
|
-
this.removeAllListeners(), this._internalStop(), this._gain && (this._gain.disconnect(), this._gain = null), this._media && (this._media.context.events.off("refresh", this.refresh, this), this._media.context.events.off("refreshPaused", this.refreshPaused, this), this._media = null), (
|
|
307
|
+
}, set: function(t) {
|
|
308
|
+
this._paused = t, this.refreshPaused();
|
|
309
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
|
|
310
|
+
var t;
|
|
311
|
+
this.removeAllListeners(), this._internalStop(), this._gain && (this._gain.disconnect(), this._gain = null), this._media && (this._media.context.events.off("refresh", this.refresh, this), this._media.context.events.off("refreshPaused", this.refreshPaused, this), this._media = null), (t = this._filters) === null || t === void 0 || t.forEach(function(s) {
|
|
512
312
|
return s.disconnect();
|
|
513
313
|
}), this._filters = null, this._end = null, this._speed = 1, this._volume = 1, this._loop = !1, this._elapsed = 0, this._duration = 0, this._paused = !1, this._muted = !1, this._pausedReal = !1;
|
|
514
|
-
},
|
|
314
|
+
}, e.prototype.toString = function() {
|
|
515
315
|
return "[WebAudioInstance id=".concat(this.id, "]");
|
|
516
|
-
},
|
|
316
|
+
}, e.prototype._now = function() {
|
|
517
317
|
return this._media.context.audioContext.currentTime;
|
|
518
|
-
},
|
|
318
|
+
}, e.prototype._updateListener = function() {
|
|
519
319
|
this._update();
|
|
520
|
-
},
|
|
521
|
-
if (
|
|
320
|
+
}, e.prototype._update = function(t) {
|
|
321
|
+
if (t === void 0 && (t = !1), this._source) {
|
|
522
322
|
var s = this._now(), o = s - this._lastUpdate;
|
|
523
|
-
if (o > 0 ||
|
|
524
|
-
var
|
|
525
|
-
this._elapsed += o *
|
|
526
|
-
var
|
|
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;
|
|
527
327
|
if (this._source.loopStart) {
|
|
528
|
-
var
|
|
529
|
-
|
|
530
|
-
} else
|
|
531
|
-
this._progress =
|
|
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);
|
|
532
332
|
}
|
|
533
333
|
}
|
|
534
|
-
},
|
|
535
|
-
this._media =
|
|
536
|
-
},
|
|
334
|
+
}, e.prototype.init = function(t) {
|
|
335
|
+
this._media = t, t.context.events.on("refresh", this.refresh, this), t.context.events.on("refreshPaused", this.refreshPaused, this);
|
|
336
|
+
}, e.prototype._internalStop = function() {
|
|
537
337
|
if (this._source) {
|
|
538
338
|
this.enableTicker(!1), this._source.onended = null, this._source.stop(0), this._source.disconnect();
|
|
539
339
|
try {
|
|
@@ -542,7 +342,7 @@ var J = ct.filter(function(n) {
|
|
|
542
342
|
}
|
|
543
343
|
this._source = null;
|
|
544
344
|
}
|
|
545
|
-
},
|
|
345
|
+
}, e.prototype._onComplete = function() {
|
|
546
346
|
if (this._source) {
|
|
547
347
|
this.enableTicker(!1), this._source.onended = null, this._source.disconnect();
|
|
548
348
|
try {
|
|
@@ -551,51 +351,51 @@ var J = ct.filter(function(n) {
|
|
|
551
351
|
}
|
|
552
352
|
}
|
|
553
353
|
this._source = null, this._progress = 1, this.emit("progress", 1, this._duration), this.emit("end", this);
|
|
554
|
-
},
|
|
555
|
-
}(
|
|
556
|
-
function n(
|
|
557
|
-
this._output =
|
|
354
|
+
}, e;
|
|
355
|
+
}(R), re = function() {
|
|
356
|
+
function n(e, t) {
|
|
357
|
+
this._output = t, this._input = e;
|
|
558
358
|
}
|
|
559
359
|
return Object.defineProperty(n.prototype, "destination", { get: function() {
|
|
560
360
|
return this._input;
|
|
561
361
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "filters", { get: function() {
|
|
562
362
|
return this._filters;
|
|
563
|
-
}, set: function(
|
|
564
|
-
var
|
|
363
|
+
}, set: function(e) {
|
|
364
|
+
var t = this;
|
|
565
365
|
if (this._filters && (this._filters.forEach(function(o) {
|
|
566
366
|
o && o.disconnect();
|
|
567
|
-
}), this._filters = null, this._input.connect(this._output)),
|
|
568
|
-
this._filters =
|
|
367
|
+
}), this._filters = null, this._input.connect(this._output)), e && e.length) {
|
|
368
|
+
this._filters = e.slice(0), this._input.disconnect();
|
|
569
369
|
var s = null;
|
|
570
|
-
|
|
571
|
-
s === null ?
|
|
370
|
+
e.forEach(function(o) {
|
|
371
|
+
s === null ? t._input.connect(o.destination) : s.connect(o.destination), s = o;
|
|
572
372
|
}), s.connect(this._output);
|
|
573
373
|
}
|
|
574
374
|
}, enumerable: !1, configurable: !0 }), n.prototype.destroy = function() {
|
|
575
375
|
this.filters = null, this._input = null, this._output = null;
|
|
576
376
|
}, n;
|
|
577
|
-
}(),
|
|
578
|
-
function t
|
|
579
|
-
var s = this, o =
|
|
580
|
-
return
|
|
581
|
-
}
|
|
582
|
-
return
|
|
583
|
-
return this._script || (this._script = this.context.audioContext.createScriptProcessor(
|
|
584
|
-
}, enumerable: !1, configurable: !0 }),
|
|
377
|
+
}(), Pe = function(n) {
|
|
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;
|
|
381
|
+
}
|
|
382
|
+
return b(e, n), Object.defineProperty(e.prototype, "script", { get: function() {
|
|
383
|
+
return this._script || (this._script = this.context.audioContext.createScriptProcessor(e.BUFFER_SIZE), this._script.connect(this.context.destination)), this._script;
|
|
384
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
|
|
585
385
|
n.prototype.destroy.call(this), this.bufferSource.disconnect(), this._script && this._script.disconnect(), this.gain.disconnect(), this.analyser.disconnect(), this.bufferSource = null, this._script = null, this.gain = null, this.analyser = null, this.context = null;
|
|
586
|
-
},
|
|
587
|
-
var
|
|
588
|
-
s.buffer =
|
|
386
|
+
}, e.prototype.cloneBufferSource = function() {
|
|
387
|
+
var t = this.bufferSource, s = this.context.audioContext.createBufferSource();
|
|
388
|
+
s.buffer = t.buffer, v.setParamValue(s.playbackRate, t.playbackRate.value), s.loop = t.loop;
|
|
589
389
|
var o = this.context.audioContext.createGain();
|
|
590
390
|
return s.connect(o), o.connect(this.destination), { source: s, gain: o };
|
|
591
|
-
}, Object.defineProperty(
|
|
391
|
+
}, Object.defineProperty(e.prototype, "bufferSize", { get: function() {
|
|
592
392
|
return this.script.bufferSize;
|
|
593
|
-
}, enumerable: !1, configurable: !0 }),
|
|
594
|
-
}(
|
|
393
|
+
}, enumerable: !1, configurable: !0 }), e.BUFFER_SIZE = 0, e;
|
|
394
|
+
}(re), xe = function() {
|
|
595
395
|
function n() {
|
|
596
396
|
}
|
|
597
|
-
return n.prototype.init = function(
|
|
598
|
-
this.parent =
|
|
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;
|
|
599
399
|
}, n.prototype.destroy = function() {
|
|
600
400
|
this.parent = null, this._nodes.destroy(), this._nodes = null;
|
|
601
401
|
try {
|
|
@@ -604,82 +404,82 @@ var J = ct.filter(function(n) {
|
|
|
604
404
|
}
|
|
605
405
|
this._source = null, this.source = null;
|
|
606
406
|
}, n.prototype.create = function() {
|
|
607
|
-
return new
|
|
407
|
+
return new ve(this);
|
|
608
408
|
}, Object.defineProperty(n.prototype, "context", { get: function() {
|
|
609
409
|
return this.parent.context;
|
|
610
410
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "isPlayable", { get: function() {
|
|
611
411
|
return !!this._source && !!this._source.buffer;
|
|
612
412
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "filters", { get: function() {
|
|
613
413
|
return this._nodes.filters;
|
|
614
|
-
}, set: function(
|
|
615
|
-
this._nodes.filters =
|
|
414
|
+
}, set: function(e) {
|
|
415
|
+
this._nodes.filters = e;
|
|
616
416
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "duration", { get: function() {
|
|
617
417
|
return this._source.buffer.duration;
|
|
618
418
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "buffer", { get: function() {
|
|
619
419
|
return this._source.buffer;
|
|
620
|
-
}, set: function(
|
|
621
|
-
this._source.buffer =
|
|
420
|
+
}, set: function(e) {
|
|
421
|
+
this._source.buffer = e;
|
|
622
422
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "nodes", { get: function() {
|
|
623
423
|
return this._nodes;
|
|
624
|
-
}, enumerable: !1, configurable: !0 }), n.prototype.load = function(
|
|
625
|
-
this.source ? this._decode(this.source,
|
|
626
|
-
}, n.prototype._loadUrl = function(
|
|
627
|
-
var
|
|
424
|
+
}, enumerable: !1, configurable: !0 }), n.prototype.load = function(e) {
|
|
425
|
+
this.source ? this._decode(this.source, e) : this.parent.url ? this._loadUrl(e) : e && e(new Error("sound.url or sound.source must be set"));
|
|
426
|
+
}, n.prototype._loadUrl = function(e) {
|
|
427
|
+
var t = this, s = new XMLHttpRequest(), o = this.parent.url;
|
|
628
428
|
s.open("GET", o, !0), s.responseType = "arraybuffer", s.onload = function() {
|
|
629
|
-
|
|
429
|
+
t.source = s.response, t._decode(s.response, e);
|
|
630
430
|
}, s.send();
|
|
631
|
-
}, n.prototype._decode = function(
|
|
632
|
-
var s = this, o = function(
|
|
633
|
-
if (
|
|
431
|
+
}, n.prototype._decode = function(e, t) {
|
|
432
|
+
var s = this, o = function(r, i) {
|
|
433
|
+
if (r) t && t(r);
|
|
634
434
|
else {
|
|
635
|
-
s.parent.isLoaded = !0, s.buffer =
|
|
636
|
-
var
|
|
637
|
-
|
|
435
|
+
s.parent.isLoaded = !0, s.buffer = i;
|
|
436
|
+
var u = s.parent.autoPlayStart();
|
|
437
|
+
t && t(null, s.parent, u);
|
|
638
438
|
}
|
|
639
439
|
};
|
|
640
|
-
|
|
440
|
+
e instanceof AudioBuffer ? o(null, e) : this.parent.context.decode(e, o);
|
|
641
441
|
}, n;
|
|
642
|
-
}(),
|
|
643
|
-
function n(
|
|
644
|
-
this.media =
|
|
645
|
-
var s =
|
|
646
|
-
this._autoPlayOptions = s ? { complete: s } : null, this.isLoaded = !1, this.isPlaying = !1, this.autoPlay =
|
|
647
|
-
}
|
|
648
|
-
return n.from = function(
|
|
649
|
-
var
|
|
650
|
-
return typeof
|
|
442
|
+
}(), N = function() {
|
|
443
|
+
function n(e, t) {
|
|
444
|
+
this.media = e, this.options = t, this._instances = [], this._sprites = {}, this.media.init(this);
|
|
445
|
+
var s = t.complete;
|
|
446
|
+
this._autoPlayOptions = s ? { complete: s } : null, this.isLoaded = !1, this.isPlaying = !1, this.autoPlay = t.autoPlay, this.singleInstance = t.singleInstance, this.preload = t.preload || this.autoPlay, this.url = t.url, this.speed = t.speed, this.volume = t.volume, this.loop = t.loop, t.sprites && this.addSprites(t.sprites), this.preload && this._preload(t.loaded);
|
|
447
|
+
}
|
|
448
|
+
return n.from = function(e) {
|
|
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);
|
|
651
451
|
}, Object.defineProperty(n.prototype, "context", { get: function() {
|
|
652
|
-
return
|
|
452
|
+
return _().context;
|
|
653
453
|
}, enumerable: !1, configurable: !0 }), n.prototype.pause = function() {
|
|
654
454
|
return this.isPlaying = !1, this.paused = !0, this;
|
|
655
455
|
}, n.prototype.resume = function() {
|
|
656
456
|
return this.isPlaying = this._instances.length > 0, this.paused = !1, this;
|
|
657
457
|
}, Object.defineProperty(n.prototype, "paused", { get: function() {
|
|
658
458
|
return this._paused;
|
|
659
|
-
}, set: function(
|
|
660
|
-
this._paused =
|
|
459
|
+
}, set: function(e) {
|
|
460
|
+
this._paused = e, this.refreshPaused();
|
|
661
461
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "speed", { get: function() {
|
|
662
462
|
return this._speed;
|
|
663
|
-
}, set: function(
|
|
664
|
-
this._speed =
|
|
463
|
+
}, set: function(e) {
|
|
464
|
+
this._speed = e, this.refresh();
|
|
665
465
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "filters", { get: function() {
|
|
666
466
|
return this.media.filters;
|
|
667
|
-
}, set: function(
|
|
668
|
-
this.media.filters =
|
|
669
|
-
}, enumerable: !1, configurable: !0 }), n.prototype.addSprites = function(
|
|
670
|
-
if (typeof
|
|
467
|
+
}, set: function(e) {
|
|
468
|
+
this.media.filters = e;
|
|
469
|
+
}, enumerable: !1, configurable: !0 }), n.prototype.addSprites = function(e, t) {
|
|
470
|
+
if (typeof e == "object") {
|
|
671
471
|
var s = {};
|
|
672
|
-
for (var o in
|
|
472
|
+
for (var o in e) s[o] = this.addSprites(o, e[o]);
|
|
673
473
|
return s;
|
|
674
474
|
}
|
|
675
|
-
var
|
|
676
|
-
return this._sprites[
|
|
475
|
+
var r = new ge(this, t);
|
|
476
|
+
return this._sprites[e] = r, r;
|
|
677
477
|
}, n.prototype.destroy = function() {
|
|
678
478
|
this._removeInstances(), this.removeSprites(), this.media.destroy(), this.media = null, this._sprites = null, this._instances = null;
|
|
679
|
-
}, n.prototype.removeSprites = function(
|
|
680
|
-
if (
|
|
681
|
-
var
|
|
682
|
-
|
|
479
|
+
}, n.prototype.removeSprites = function(e) {
|
|
480
|
+
if (e) {
|
|
481
|
+
var t = this._sprites[e];
|
|
482
|
+
t !== void 0 && (t.destroy(), delete this._sprites[e]);
|
|
683
483
|
} else for (var s in this._sprites) this.removeSprites(s);
|
|
684
484
|
return this;
|
|
685
485
|
}, Object.defineProperty(n.prototype, "isPlayable", { get: function() {
|
|
@@ -687,44 +487,44 @@ var J = ct.filter(function(n) {
|
|
|
687
487
|
}, enumerable: !1, configurable: !0 }), n.prototype.stop = function() {
|
|
688
488
|
if (!this.isPlayable) return this.autoPlay = !1, this._autoPlayOptions = null, this;
|
|
689
489
|
this.isPlaying = !1;
|
|
690
|
-
for (var
|
|
490
|
+
for (var e = this._instances.length - 1; e >= 0; e--) this._instances[e].stop();
|
|
691
491
|
return this;
|
|
692
|
-
}, n.prototype.play = function(
|
|
492
|
+
}, n.prototype.play = function(e, t) {
|
|
693
493
|
var s, o = this;
|
|
694
|
-
if (typeof
|
|
695
|
-
var
|
|
696
|
-
s.start =
|
|
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;
|
|
697
497
|
}
|
|
698
|
-
if (s.offset && (s.start = s.offset), !this.isLoaded) return new Promise(function(
|
|
699
|
-
o.autoPlay = !0, o._autoPlayOptions = s, o._preload(function(
|
|
700
|
-
|
|
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, m, y) {
|
|
500
|
+
h ? l(h) : (s.loaded && s.loaded(h, m, y), a(y));
|
|
701
501
|
});
|
|
702
502
|
});
|
|
703
503
|
(this.singleInstance || s.singleInstance) && this._removeInstances();
|
|
704
|
-
var
|
|
705
|
-
return this._instances.push(
|
|
706
|
-
s.complete && s.complete(o), o._onComplete(
|
|
707
|
-
}),
|
|
708
|
-
o._onComplete(
|
|
709
|
-
}),
|
|
504
|
+
var u = this._createInstance();
|
|
505
|
+
return this._instances.push(u), this.isPlaying = !0, u.once("end", function() {
|
|
506
|
+
s.complete && s.complete(o), o._onComplete(u);
|
|
507
|
+
}), u.once("stop", function() {
|
|
508
|
+
o._onComplete(u);
|
|
509
|
+
}), u.play(s), u;
|
|
710
510
|
}, n.prototype.refresh = function() {
|
|
711
|
-
for (var
|
|
511
|
+
for (var e = this._instances.length, t = 0; t < e; t++) this._instances[t].refresh();
|
|
712
512
|
}, n.prototype.refreshPaused = function() {
|
|
713
|
-
for (var
|
|
513
|
+
for (var e = this._instances.length, t = 0; t < e; t++) this._instances[t].refreshPaused();
|
|
714
514
|
}, Object.defineProperty(n.prototype, "volume", { get: function() {
|
|
715
515
|
return this._volume;
|
|
716
|
-
}, set: function(
|
|
717
|
-
this._volume =
|
|
516
|
+
}, set: function(e) {
|
|
517
|
+
this._volume = e, this.refresh();
|
|
718
518
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "muted", { get: function() {
|
|
719
519
|
return this._muted;
|
|
720
|
-
}, set: function(
|
|
721
|
-
this._muted =
|
|
520
|
+
}, set: function(e) {
|
|
521
|
+
this._muted = e, this.refresh();
|
|
722
522
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "loop", { get: function() {
|
|
723
523
|
return this._loop;
|
|
724
|
-
}, set: function(
|
|
725
|
-
this._loop =
|
|
726
|
-
}, enumerable: !1, configurable: !0 }), n.prototype._preload = function(
|
|
727
|
-
this.media.load(
|
|
524
|
+
}, set: function(e) {
|
|
525
|
+
this._loop = e, this.refresh();
|
|
526
|
+
}, enumerable: !1, configurable: !0 }), n.prototype._preload = function(e) {
|
|
527
|
+
this.media.load(e);
|
|
728
528
|
}, Object.defineProperty(n.prototype, "instances", { get: function() {
|
|
729
529
|
return this._instances;
|
|
730
530
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "sprites", { get: function() {
|
|
@@ -732,147 +532,147 @@ var J = ct.filter(function(n) {
|
|
|
732
532
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "duration", { get: function() {
|
|
733
533
|
return this.media.duration;
|
|
734
534
|
}, enumerable: !1, configurable: !0 }), n.prototype.autoPlayStart = function() {
|
|
735
|
-
var
|
|
736
|
-
return this.autoPlay && (
|
|
535
|
+
var e;
|
|
536
|
+
return this.autoPlay && (e = this.play(this._autoPlayOptions)), e;
|
|
737
537
|
}, n.prototype._removeInstances = function() {
|
|
738
|
-
for (var
|
|
538
|
+
for (var e = this._instances.length - 1; e >= 0; e--) this._poolInstance(this._instances[e]);
|
|
739
539
|
this._instances.length = 0;
|
|
740
|
-
}, n.prototype._onComplete = function(
|
|
540
|
+
}, n.prototype._onComplete = function(e) {
|
|
741
541
|
if (this._instances) {
|
|
742
|
-
var
|
|
743
|
-
|
|
542
|
+
var t = this._instances.indexOf(e);
|
|
543
|
+
t > -1 && this._instances.splice(t, 1), this.isPlaying = this._instances.length > 0;
|
|
744
544
|
}
|
|
745
|
-
this._poolInstance(
|
|
545
|
+
this._poolInstance(e);
|
|
746
546
|
}, n.prototype._createInstance = function() {
|
|
747
547
|
if (n._pool.length > 0) {
|
|
748
|
-
var
|
|
749
|
-
return
|
|
548
|
+
var e = n._pool.pop();
|
|
549
|
+
return e.init(this.media), e;
|
|
750
550
|
}
|
|
751
551
|
return this.media.create();
|
|
752
|
-
}, n.prototype._poolInstance = function(
|
|
753
|
-
|
|
552
|
+
}, n.prototype._poolInstance = function(e) {
|
|
553
|
+
e.destroy(), n._pool.indexOf(e) < 0 && n._pool.push(e);
|
|
754
554
|
}, n._pool = [], n;
|
|
755
|
-
}(),
|
|
756
|
-
function
|
|
757
|
-
var
|
|
758
|
-
return
|
|
555
|
+
}(), we = function(n) {
|
|
556
|
+
function e() {
|
|
557
|
+
var t = n !== null && n.apply(this, arguments) || this;
|
|
558
|
+
return t.speed = 1, t.muted = !1, t.volume = 1, t.paused = !1, t;
|
|
759
559
|
}
|
|
760
|
-
return
|
|
560
|
+
return b(e, n), e.prototype.refresh = function() {
|
|
761
561
|
this.emit("refresh");
|
|
762
|
-
},
|
|
562
|
+
}, e.prototype.refreshPaused = function() {
|
|
763
563
|
this.emit("refreshPaused");
|
|
764
|
-
}, Object.defineProperty(
|
|
564
|
+
}, Object.defineProperty(e.prototype, "filters", { get: function() {
|
|
765
565
|
return null;
|
|
766
|
-
}, set: function(
|
|
767
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
566
|
+
}, set: function(t) {
|
|
567
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "audioContext", { get: function() {
|
|
768
568
|
return null;
|
|
769
|
-
}, enumerable: !1, configurable: !0 }),
|
|
569
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.toggleMute = function() {
|
|
770
570
|
return this.muted = !this.muted, this.refresh(), this.muted;
|
|
771
|
-
},
|
|
571
|
+
}, e.prototype.togglePause = function() {
|
|
772
572
|
return this.paused = !this.paused, this.refreshPaused(), this.paused;
|
|
773
|
-
},
|
|
573
|
+
}, e.prototype.destroy = function() {
|
|
774
574
|
this.removeAllListeners();
|
|
775
|
-
},
|
|
776
|
-
}(
|
|
777
|
-
function
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
var s = window, o = new
|
|
781
|
-
return
|
|
575
|
+
}, e;
|
|
576
|
+
}(R), Y = function(n) {
|
|
577
|
+
function e() {
|
|
578
|
+
var t = n.call(this, null, null) || this;
|
|
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;
|
|
782
582
|
}
|
|
783
|
-
return
|
|
583
|
+
return b(e, n), e.prototype.onFocus = function() {
|
|
784
584
|
if (this.autoPause) {
|
|
785
|
-
var
|
|
786
|
-
|
|
585
|
+
var t = this._ctx.state;
|
|
586
|
+
t !== "suspended" && t !== "interrupted" && this._locked || (this.paused = this._pausedOnBlur, this.refreshPaused());
|
|
787
587
|
}
|
|
788
|
-
},
|
|
588
|
+
}, e.prototype.onBlur = function() {
|
|
789
589
|
this.autoPause && (this._locked || (this._pausedOnBlur = this._paused, this.paused = !0, this.refreshPaused()));
|
|
790
|
-
},
|
|
590
|
+
}, e.prototype._unlock = function() {
|
|
791
591
|
this._locked && (this.playEmptySound(), this._ctx.state === "running" && (document.removeEventListener("mousedown", this._unlock, !0), document.removeEventListener("touchend", this._unlock, !0), document.removeEventListener("touchstart", this._unlock, !0), this._locked = !1));
|
|
792
|
-
},
|
|
793
|
-
var
|
|
794
|
-
|
|
795
|
-
}, Object.defineProperty(
|
|
796
|
-
var
|
|
797
|
-
return
|
|
798
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
799
|
-
var
|
|
800
|
-
return
|
|
801
|
-
}, enumerable: !1, configurable: !0 }),
|
|
592
|
+
}, e.prototype.playEmptySound = function() {
|
|
593
|
+
var t = this._ctx.createBufferSource();
|
|
594
|
+
t.buffer = this._ctx.createBuffer(1, 1, 22050), t.connect(this._ctx.destination), t.start(0, 0, 0), t.context.state === "suspended" && t.context.resume();
|
|
595
|
+
}, Object.defineProperty(e, "AudioContext", { get: function() {
|
|
596
|
+
var t = window;
|
|
597
|
+
return t.AudioContext || t.webkitAudioContext || null;
|
|
598
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "OfflineAudioContext", { get: function() {
|
|
599
|
+
var t = window;
|
|
600
|
+
return t.OfflineAudioContext || t.webkitOfflineAudioContext || null;
|
|
601
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
|
|
802
602
|
n.prototype.destroy.call(this);
|
|
803
|
-
var
|
|
804
|
-
|
|
805
|
-
}, Object.defineProperty(
|
|
603
|
+
var t = this._ctx;
|
|
604
|
+
t.close !== void 0 && t.close(), globalThis.removeEventListener("focus", this.onFocus), globalThis.removeEventListener("blur", this.onBlur), this.events.removeAllListeners(), this.analyser.disconnect(), this.compressor.disconnect(), this.analyser = null, this.compressor = null, this.events = null, this._offlineCtx = null, this._ctx = null;
|
|
605
|
+
}, Object.defineProperty(e.prototype, "audioContext", { get: function() {
|
|
806
606
|
return this._ctx;
|
|
807
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
607
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "offlineContext", { get: function() {
|
|
808
608
|
return this._offlineCtx;
|
|
809
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
609
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "paused", { get: function() {
|
|
810
610
|
return this._paused;
|
|
811
|
-
}, set: function(
|
|
812
|
-
|
|
813
|
-
}, enumerable: !1, configurable: !0 }),
|
|
611
|
+
}, set: function(t) {
|
|
612
|
+
t && this._ctx.state === "running" ? this._ctx.suspend() : t || this._ctx.state !== "suspended" || this._ctx.resume(), this._paused = t;
|
|
613
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.refresh = function() {
|
|
814
614
|
this.events.emit("refresh");
|
|
815
|
-
},
|
|
615
|
+
}, e.prototype.refreshPaused = function() {
|
|
816
616
|
this.events.emit("refreshPaused");
|
|
817
|
-
},
|
|
617
|
+
}, e.prototype.toggleMute = function() {
|
|
818
618
|
return this.muted = !this.muted, this.refresh(), this.muted;
|
|
819
|
-
},
|
|
619
|
+
}, e.prototype.togglePause = function() {
|
|
820
620
|
return this.paused = !this.paused, this.refreshPaused(), this._paused;
|
|
821
|
-
},
|
|
822
|
-
var o = function(
|
|
823
|
-
s(new Error(
|
|
824
|
-
},
|
|
825
|
-
s(null,
|
|
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);
|
|
826
626
|
}, o);
|
|
827
|
-
|
|
828
|
-
},
|
|
829
|
-
}(
|
|
627
|
+
r && r.catch(o);
|
|
628
|
+
}, e;
|
|
629
|
+
}(re), Oe = function() {
|
|
830
630
|
function n() {
|
|
831
631
|
this.init();
|
|
832
632
|
}
|
|
833
633
|
return n.prototype.init = function() {
|
|
834
|
-
return this.supported && (this._webAudioContext = new
|
|
634
|
+
return this.supported && (this._webAudioContext = new Y()), this._htmlAudioContext = new we(), this._sounds = {}, this.useLegacy = !this.supported, this;
|
|
835
635
|
}, Object.defineProperty(n.prototype, "context", { get: function() {
|
|
836
636
|
return this._context;
|
|
837
637
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "filtersAll", { get: function() {
|
|
838
638
|
return this.useLegacy ? [] : this._context.filters;
|
|
839
|
-
}, set: function(
|
|
840
|
-
this.useLegacy || (this._context.filters =
|
|
639
|
+
}, set: function(e) {
|
|
640
|
+
this.useLegacy || (this._context.filters = e);
|
|
841
641
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "supported", { get: function() {
|
|
842
|
-
return
|
|
843
|
-
}, enumerable: !1, configurable: !0 }), n.prototype.add = function(
|
|
844
|
-
if (typeof
|
|
642
|
+
return Y.AudioContext !== null;
|
|
643
|
+
}, enumerable: !1, configurable: !0 }), n.prototype.add = function(e, t) {
|
|
644
|
+
if (typeof e == "object") {
|
|
845
645
|
var s = {};
|
|
846
|
-
for (var o in
|
|
847
|
-
var
|
|
848
|
-
s[o] = this.add(o,
|
|
646
|
+
for (var o in e) {
|
|
647
|
+
var r = this._getOptions(e[o], t);
|
|
648
|
+
s[o] = this.add(o, r);
|
|
849
649
|
}
|
|
850
650
|
return s;
|
|
851
651
|
}
|
|
852
|
-
if (
|
|
853
|
-
var
|
|
854
|
-
return this._sounds[
|
|
855
|
-
}, n.prototype._getOptions = function(
|
|
652
|
+
if (t instanceof N) return this._sounds[e] = t, t;
|
|
653
|
+
var i = this._getOptions(t), u = N.from(i);
|
|
654
|
+
return this._sounds[e] = u, u;
|
|
655
|
+
}, n.prototype._getOptions = function(e, t) {
|
|
856
656
|
var s;
|
|
857
|
-
return s = typeof
|
|
657
|
+
return s = typeof e == "string" ? { url: e } : e instanceof ArrayBuffer || e instanceof AudioBuffer || e instanceof HTMLAudioElement ? { source: e } : e, s = V(V({}, s), t || {});
|
|
858
658
|
}, Object.defineProperty(n.prototype, "useLegacy", { get: function() {
|
|
859
659
|
return this._useLegacy;
|
|
860
|
-
}, set: function(
|
|
861
|
-
|
|
660
|
+
}, set: function(e) {
|
|
661
|
+
oe.setLegacy(e), this._useLegacy = e, this._context = !e && this.supported ? this._webAudioContext : this._htmlAudioContext;
|
|
862
662
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "disableAutoPause", { get: function() {
|
|
863
663
|
return !this._webAudioContext.autoPause;
|
|
864
|
-
}, set: function(
|
|
865
|
-
this._webAudioContext.autoPause = !
|
|
866
|
-
}, enumerable: !1, configurable: !0 }), n.prototype.remove = function(
|
|
867
|
-
return this.exists(
|
|
664
|
+
}, set: function(e) {
|
|
665
|
+
this._webAudioContext.autoPause = !e;
|
|
666
|
+
}, enumerable: !1, configurable: !0 }), n.prototype.remove = function(e) {
|
|
667
|
+
return this.exists(e, !0), this._sounds[e].destroy(), delete this._sounds[e], this;
|
|
868
668
|
}, Object.defineProperty(n.prototype, "volumeAll", { get: function() {
|
|
869
669
|
return this._context.volume;
|
|
870
|
-
}, set: function(
|
|
871
|
-
this._context.volume =
|
|
670
|
+
}, set: function(e) {
|
|
671
|
+
this._context.volume = e, this._context.refresh();
|
|
872
672
|
}, enumerable: !1, configurable: !0 }), Object.defineProperty(n.prototype, "speedAll", { get: function() {
|
|
873
673
|
return this._context.speed;
|
|
874
|
-
}, set: function(
|
|
875
|
-
this._context.speed =
|
|
674
|
+
}, set: function(e) {
|
|
675
|
+
this._context.speed = e, this._context.refresh();
|
|
876
676
|
}, enumerable: !1, configurable: !0 }), n.prototype.togglePauseAll = function() {
|
|
877
677
|
return this._context.togglePause();
|
|
878
678
|
}, n.prototype.pauseAll = function() {
|
|
@@ -886,224 +686,224 @@ var J = ct.filter(function(n) {
|
|
|
886
686
|
}, n.prototype.unmuteAll = function() {
|
|
887
687
|
return this._context.muted = !1, this._context.refresh(), this;
|
|
888
688
|
}, n.prototype.removeAll = function() {
|
|
889
|
-
for (var
|
|
689
|
+
for (var e in this._sounds) this._sounds[e].destroy(), delete this._sounds[e];
|
|
890
690
|
return this;
|
|
891
691
|
}, n.prototype.stopAll = function() {
|
|
892
|
-
for (var
|
|
692
|
+
for (var e in this._sounds) this._sounds[e].stop();
|
|
893
693
|
return this;
|
|
894
|
-
}, n.prototype.exists = function(
|
|
895
|
-
return !!this._sounds[
|
|
896
|
-
}, n.prototype.find = function(
|
|
897
|
-
return this.exists(
|
|
898
|
-
}, n.prototype.play = function(
|
|
899
|
-
return this.find(
|
|
900
|
-
}, n.prototype.stop = function(
|
|
901
|
-
return this.find(
|
|
902
|
-
}, n.prototype.pause = function(
|
|
903
|
-
return this.find(
|
|
904
|
-
}, n.prototype.resume = function(
|
|
905
|
-
return this.find(
|
|
906
|
-
}, n.prototype.volume = function(
|
|
907
|
-
var s = this.find(
|
|
908
|
-
return
|
|
909
|
-
}, n.prototype.speed = function(
|
|
910
|
-
var s = this.find(
|
|
911
|
-
return
|
|
912
|
-
}, n.prototype.duration = function(
|
|
913
|
-
return this.find(
|
|
694
|
+
}, n.prototype.exists = function(e, t) {
|
|
695
|
+
return !!this._sounds[e];
|
|
696
|
+
}, n.prototype.find = function(e) {
|
|
697
|
+
return this.exists(e, !0), this._sounds[e];
|
|
698
|
+
}, n.prototype.play = function(e, t) {
|
|
699
|
+
return this.find(e).play(t);
|
|
700
|
+
}, n.prototype.stop = function(e) {
|
|
701
|
+
return this.find(e).stop();
|
|
702
|
+
}, n.prototype.pause = function(e) {
|
|
703
|
+
return this.find(e).pause();
|
|
704
|
+
}, n.prototype.resume = function(e) {
|
|
705
|
+
return this.find(e).resume();
|
|
706
|
+
}, n.prototype.volume = function(e, t) {
|
|
707
|
+
var s = this.find(e);
|
|
708
|
+
return t !== void 0 && (s.volume = t), s.volume;
|
|
709
|
+
}, n.prototype.speed = function(e, t) {
|
|
710
|
+
var s = this.find(e);
|
|
711
|
+
return t !== void 0 && (s.speed = t), s.speed;
|
|
712
|
+
}, n.prototype.duration = function(e) {
|
|
713
|
+
return this.find(e).duration;
|
|
914
714
|
}, n.prototype.close = function() {
|
|
915
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;
|
|
916
716
|
}, n;
|
|
917
|
-
}(),
|
|
918
|
-
function n(
|
|
919
|
-
this.init(
|
|
920
|
-
}
|
|
921
|
-
return n.prototype.init = function(
|
|
922
|
-
this.destination =
|
|
923
|
-
}, n.prototype.connect = function(
|
|
924
|
-
this.source.connect(
|
|
717
|
+
}(), S = function() {
|
|
718
|
+
function n(e, t) {
|
|
719
|
+
this.init(e, t);
|
|
720
|
+
}
|
|
721
|
+
return n.prototype.init = function(e, t) {
|
|
722
|
+
this.destination = e, this.source = t || e;
|
|
723
|
+
}, n.prototype.connect = function(e) {
|
|
724
|
+
this.source.connect(e);
|
|
925
725
|
}, n.prototype.disconnect = function() {
|
|
926
726
|
this.source.disconnect();
|
|
927
727
|
}, n.prototype.destroy = function() {
|
|
928
728
|
this.disconnect(), this.destination = null, this.source = null;
|
|
929
729
|
}, n;
|
|
930
|
-
}(),
|
|
931
|
-
function t
|
|
932
|
-
|
|
933
|
-
var
|
|
934
|
-
if (!
|
|
935
|
-
var
|
|
936
|
-
var p =
|
|
937
|
-
return p.type =
|
|
730
|
+
}(), B = { __proto__: null, EqualizerFilter: function(n) {
|
|
731
|
+
function e(t, s, o, r, i, u, a, l, h, m) {
|
|
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), m === void 0 && (m = 0);
|
|
733
|
+
var y = this;
|
|
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: m }].map(function($) {
|
|
736
|
+
var p = _().context.audioContext.createBiquadFilter();
|
|
737
|
+
return p.type = $.type, v.setParamValue(p.Q, 1), p.frequency.value = $.f, v.setParamValue(p.gain, $.gain), p;
|
|
938
738
|
});
|
|
939
|
-
(
|
|
940
|
-
for (var
|
|
941
|
-
var
|
|
942
|
-
|
|
739
|
+
(y = n.call(this, g[0], g[g.length - 1]) || this).bands = g, y.bandsMap = {};
|
|
740
|
+
for (var f = 0; f < y.bands.length; f++) {
|
|
741
|
+
var x = y.bands[f];
|
|
742
|
+
f > 0 && y.bands[f - 1].connect(x), y.bandsMap[x.frequency.value] = x;
|
|
943
743
|
}
|
|
944
|
-
return
|
|
744
|
+
return y;
|
|
945
745
|
}
|
|
946
|
-
|
|
947
|
-
}
|
|
948
|
-
return
|
|
949
|
-
if (s === void 0 && (s = 0), !this.bandsMap[
|
|
950
|
-
|
|
951
|
-
},
|
|
952
|
-
if (!this.bandsMap[
|
|
953
|
-
return this.bandsMap[
|
|
954
|
-
}, Object.defineProperty(
|
|
955
|
-
return this.getGain(
|
|
956
|
-
}, set: function(
|
|
957
|
-
this.setGain(
|
|
958
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
959
|
-
return this.getGain(
|
|
960
|
-
}, set: function(
|
|
961
|
-
this.setGain(
|
|
962
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
963
|
-
return this.getGain(
|
|
964
|
-
}, set: function(
|
|
965
|
-
this.setGain(
|
|
966
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
967
|
-
return this.getGain(
|
|
968
|
-
}, set: function(
|
|
969
|
-
this.setGain(
|
|
970
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
971
|
-
return this.getGain(
|
|
972
|
-
}, set: function(
|
|
973
|
-
this.setGain(
|
|
974
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
975
|
-
return this.getGain(
|
|
976
|
-
}, set: function(
|
|
977
|
-
this.setGain(
|
|
978
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
979
|
-
return this.getGain(
|
|
980
|
-
}, set: function(
|
|
981
|
-
this.setGain(
|
|
982
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
983
|
-
return this.getGain(
|
|
984
|
-
}, set: function(
|
|
985
|
-
this.setGain(
|
|
986
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
987
|
-
return this.getGain(
|
|
988
|
-
}, set: function(
|
|
989
|
-
this.setGain(
|
|
990
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
991
|
-
return this.getGain(
|
|
992
|
-
}, set: function(
|
|
993
|
-
this.setGain(
|
|
994
|
-
}, enumerable: !1, configurable: !0 }),
|
|
995
|
-
this.bands.forEach(function(
|
|
996
|
-
|
|
746
|
+
y = n.call(this, null) || this;
|
|
747
|
+
}
|
|
748
|
+
return b(e, n), e.prototype.setGain = function(t, s) {
|
|
749
|
+
if (s === void 0 && (s = 0), !this.bandsMap[t]) throw new Error("No band found for frequency ".concat(t));
|
|
750
|
+
v.setParamValue(this.bandsMap[t].gain, s);
|
|
751
|
+
}, e.prototype.getGain = function(t) {
|
|
752
|
+
if (!this.bandsMap[t]) throw new Error("No band found for frequency ".concat(t));
|
|
753
|
+
return this.bandsMap[t].gain.value;
|
|
754
|
+
}, Object.defineProperty(e.prototype, "f32", { get: function() {
|
|
755
|
+
return this.getGain(e.F32);
|
|
756
|
+
}, set: function(t) {
|
|
757
|
+
this.setGain(e.F32, t);
|
|
758
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f64", { get: function() {
|
|
759
|
+
return this.getGain(e.F64);
|
|
760
|
+
}, set: function(t) {
|
|
761
|
+
this.setGain(e.F64, t);
|
|
762
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f125", { get: function() {
|
|
763
|
+
return this.getGain(e.F125);
|
|
764
|
+
}, set: function(t) {
|
|
765
|
+
this.setGain(e.F125, t);
|
|
766
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f250", { get: function() {
|
|
767
|
+
return this.getGain(e.F250);
|
|
768
|
+
}, set: function(t) {
|
|
769
|
+
this.setGain(e.F250, t);
|
|
770
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f500", { get: function() {
|
|
771
|
+
return this.getGain(e.F500);
|
|
772
|
+
}, set: function(t) {
|
|
773
|
+
this.setGain(e.F500, t);
|
|
774
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f1k", { get: function() {
|
|
775
|
+
return this.getGain(e.F1K);
|
|
776
|
+
}, set: function(t) {
|
|
777
|
+
this.setGain(e.F1K, t);
|
|
778
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f2k", { get: function() {
|
|
779
|
+
return this.getGain(e.F2K);
|
|
780
|
+
}, set: function(t) {
|
|
781
|
+
this.setGain(e.F2K, t);
|
|
782
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f4k", { get: function() {
|
|
783
|
+
return this.getGain(e.F4K);
|
|
784
|
+
}, set: function(t) {
|
|
785
|
+
this.setGain(e.F4K, t);
|
|
786
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f8k", { get: function() {
|
|
787
|
+
return this.getGain(e.F8K);
|
|
788
|
+
}, set: function(t) {
|
|
789
|
+
this.setGain(e.F8K, t);
|
|
790
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "f16k", { get: function() {
|
|
791
|
+
return this.getGain(e.F16K);
|
|
792
|
+
}, set: function(t) {
|
|
793
|
+
this.setGain(e.F16K, t);
|
|
794
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.reset = function() {
|
|
795
|
+
this.bands.forEach(function(t) {
|
|
796
|
+
v.setParamValue(t.gain, 0);
|
|
997
797
|
});
|
|
998
|
-
},
|
|
999
|
-
this.bands.forEach(function(
|
|
1000
|
-
|
|
798
|
+
}, e.prototype.destroy = function() {
|
|
799
|
+
this.bands.forEach(function(t) {
|
|
800
|
+
t.disconnect();
|
|
1001
801
|
}), this.bands = null, this.bandsMap = null;
|
|
1002
|
-
},
|
|
1003
|
-
}(
|
|
1004
|
-
function t
|
|
1005
|
-
|
|
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) {
|
|
804
|
+
function e(t) {
|
|
805
|
+
t === void 0 && (t = 0);
|
|
1006
806
|
var s = this;
|
|
1007
|
-
if (!
|
|
1008
|
-
var o =
|
|
1009
|
-
return (s = n.call(this, o) || this)._distortion = o, s.amount =
|
|
807
|
+
if (!_().useLegacy) {
|
|
808
|
+
var o = _().context.audioContext.createWaveShaper();
|
|
809
|
+
return (s = n.call(this, o) || this)._distortion = o, s.amount = t, s;
|
|
1010
810
|
}
|
|
1011
811
|
s = n.call(this, null) || this;
|
|
1012
812
|
}
|
|
1013
|
-
return
|
|
813
|
+
return b(e, n), Object.defineProperty(e.prototype, "amount", { get: function() {
|
|
1014
814
|
return this._amount;
|
|
1015
|
-
}, set: function(
|
|
1016
|
-
this._amount =
|
|
1017
|
-
for (var s, o = 1e3 *
|
|
1018
|
-
this._distortion.curve =
|
|
1019
|
-
}, enumerable: !1, configurable: !0 }),
|
|
815
|
+
}, set: function(t) {
|
|
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";
|
|
819
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
|
|
1020
820
|
this._distortion = null, n.prototype.destroy.call(this);
|
|
1021
|
-
},
|
|
1022
|
-
}(
|
|
1023
|
-
function t
|
|
1024
|
-
|
|
821
|
+
}, e;
|
|
822
|
+
}(S), StereoFilter: function(n) {
|
|
823
|
+
function e(t) {
|
|
824
|
+
t === void 0 && (t = 0);
|
|
1025
825
|
var s = this;
|
|
1026
|
-
if (!
|
|
1027
|
-
var o,
|
|
1028
|
-
return
|
|
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;
|
|
1029
829
|
}
|
|
1030
830
|
s = n.call(this, null) || this;
|
|
1031
831
|
}
|
|
1032
|
-
return
|
|
832
|
+
return b(e, n), Object.defineProperty(e.prototype, "pan", { get: function() {
|
|
1033
833
|
return this._pan;
|
|
1034
|
-
}, set: function(
|
|
1035
|
-
this._pan =
|
|
1036
|
-
}, enumerable: !1, configurable: !0 }),
|
|
834
|
+
}, set: function(t) {
|
|
835
|
+
this._pan = t, this._stereo ? v.setParamValue(this._stereo.pan, t) : this._panner.setPosition(t, 0, 1 - Math.abs(t));
|
|
836
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
|
|
1037
837
|
n.prototype.destroy.call(this), this._stereo = null, this._panner = null;
|
|
1038
|
-
},
|
|
1039
|
-
}(
|
|
1040
|
-
function t
|
|
1041
|
-
|
|
1042
|
-
var
|
|
1043
|
-
if (!
|
|
1044
|
-
|
|
1045
|
-
}
|
|
1046
|
-
return
|
|
1047
|
-
return Math.min(o, Math.max(s,
|
|
1048
|
-
}, Object.defineProperty(
|
|
838
|
+
}, e;
|
|
839
|
+
}(S), ReverbFilter: function(n) {
|
|
840
|
+
function e(t, s, o) {
|
|
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;
|
|
845
|
+
}
|
|
846
|
+
return b(e, n), e.prototype._clamp = function(t, s, o) {
|
|
847
|
+
return Math.min(o, Math.max(s, t));
|
|
848
|
+
}, Object.defineProperty(e.prototype, "seconds", { get: function() {
|
|
1049
849
|
return this._seconds;
|
|
1050
|
-
}, set: function(
|
|
1051
|
-
this._seconds = this._clamp(
|
|
1052
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
850
|
+
}, set: function(t) {
|
|
851
|
+
this._seconds = this._clamp(t, 1, 50), this._rebuild();
|
|
852
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "decay", { get: function() {
|
|
1053
853
|
return this._decay;
|
|
1054
|
-
}, set: function(
|
|
1055
|
-
this._decay = this._clamp(
|
|
1056
|
-
}, enumerable: !1, configurable: !0 }), Object.defineProperty(
|
|
854
|
+
}, set: function(t) {
|
|
855
|
+
this._decay = this._clamp(t, 0, 100), this._rebuild();
|
|
856
|
+
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "reverse", { get: function() {
|
|
1057
857
|
return this._reverse;
|
|
1058
|
-
}, set: function(
|
|
1059
|
-
this._reverse =
|
|
1060
|
-
}, enumerable: !1, configurable: !0 }),
|
|
1061
|
-
for (var
|
|
1062
|
-
var
|
|
1063
|
-
|
|
1064
|
-
},
|
|
1065
|
-
}(
|
|
1066
|
-
function
|
|
1067
|
-
var
|
|
1068
|
-
if (!
|
|
1069
|
-
var s =
|
|
1070
|
-
return
|
|
858
|
+
}, set: function(t) {
|
|
859
|
+
this._reverse = t, this._rebuild();
|
|
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);
|
|
862
|
+
var h = _().context.audioContext.createConvolver();
|
|
863
|
+
h.buffer = i, this.init(h);
|
|
864
|
+
}, e;
|
|
865
|
+
}(S), MonoFilter: function(n) {
|
|
866
|
+
function e() {
|
|
867
|
+
var t = this;
|
|
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;
|
|
1071
871
|
}
|
|
1072
|
-
|
|
872
|
+
t = n.call(this, null) || this;
|
|
1073
873
|
}
|
|
1074
|
-
return
|
|
874
|
+
return b(e, n), e.prototype.destroy = function() {
|
|
1075
875
|
this._merger.disconnect(), this._merger = null, n.prototype.destroy.call(this);
|
|
1076
|
-
},
|
|
1077
|
-
}(
|
|
1078
|
-
function
|
|
1079
|
-
var
|
|
1080
|
-
if (!
|
|
1081
|
-
var s =
|
|
1082
|
-
return (
|
|
876
|
+
}, e;
|
|
877
|
+
}(S), StreamFilter: function(n) {
|
|
878
|
+
function e() {
|
|
879
|
+
var t = this;
|
|
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;
|
|
1083
883
|
}
|
|
1084
|
-
|
|
884
|
+
t = n.call(this, null) || this;
|
|
1085
885
|
}
|
|
1086
|
-
return
|
|
886
|
+
return b(e, n), Object.defineProperty(e.prototype, "stream", { get: function() {
|
|
1087
887
|
return this._stream;
|
|
1088
|
-
}, enumerable: !1, configurable: !0 }),
|
|
888
|
+
}, enumerable: !1, configurable: !0 }), e.prototype.destroy = function() {
|
|
1089
889
|
this._stream = null, n.prototype.destroy.call(this);
|
|
1090
|
-
},
|
|
1091
|
-
}(
|
|
1092
|
-
function
|
|
1093
|
-
if (!
|
|
1094
|
-
var
|
|
1095
|
-
return s.type = "lowpass",
|
|
890
|
+
}, e;
|
|
891
|
+
}(S), TelephoneFilter: function(n) {
|
|
892
|
+
function e() {
|
|
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;
|
|
1096
896
|
}
|
|
1097
897
|
n.call(this, null);
|
|
1098
898
|
}
|
|
1099
|
-
return
|
|
1100
|
-
}(
|
|
1101
|
-
return
|
|
1102
|
-
}(new
|
|
1103
|
-
|
|
1104
|
-
class
|
|
1105
|
-
constructor(
|
|
1106
|
-
this.fn =
|
|
899
|
+
return b(e, n), e;
|
|
900
|
+
}(S) }, Ae = { __proto__: null, supported: U }, z = function(n) {
|
|
901
|
+
return ee = n, n;
|
|
902
|
+
}(new Oe());
|
|
903
|
+
ue.add(oe);
|
|
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);
|
|
1107
907
|
}
|
|
1108
908
|
static #t = 1;
|
|
1109
909
|
stt;
|
|
@@ -1112,37 +912,37 @@ class I {
|
|
|
1112
912
|
get procID() {
|
|
1113
913
|
return this.#s;
|
|
1114
914
|
}
|
|
1115
|
-
addSnd(
|
|
1116
|
-
switch (this.loop =
|
|
1117
|
-
|
|
1118
|
-
}, this.tw = () => new
|
|
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) => {
|
|
917
|
+
e.volume = t;
|
|
918
|
+
}, this.tw = () => new pe(e), this.onPlayEnd = () => {
|
|
1119
919
|
this.stt.onPlayEnd(this.buf), this.#e();
|
|
1120
920
|
}, this.stop = () => {
|
|
1121
|
-
|
|
1122
|
-
}, this.destroy = () =>
|
|
921
|
+
e.stop(), this.#e();
|
|
922
|
+
}, this.destroy = () => e.destroy(), this.buf) {
|
|
1123
923
|
// セリフ再生中はBGM音量を絞る
|
|
1124
|
-
case
|
|
924
|
+
case Q:
|
|
1125
925
|
{
|
|
1126
|
-
const
|
|
1127
|
-
if (
|
|
1128
|
-
|
|
1129
|
-
const s =
|
|
1130
|
-
s && s.setVol(this.volume *
|
|
926
|
+
const t = Number(c.getVal("sys:sn.sound.BGM.vol_mul_talking") ?? 1);
|
|
927
|
+
if (t === 1) break;
|
|
928
|
+
j.#t = t;
|
|
929
|
+
const s = X[H];
|
|
930
|
+
s && s.setVol(this.volume * j.#t);
|
|
1131
931
|
}
|
|
1132
932
|
break;
|
|
1133
|
-
case
|
|
1134
|
-
|
|
933
|
+
case H:
|
|
934
|
+
e.volume = this.volume * j.#t;
|
|
1135
935
|
break;
|
|
1136
936
|
}
|
|
1137
937
|
}
|
|
1138
938
|
#e = () => {
|
|
1139
939
|
if (this.#e = () => {
|
|
1140
|
-
},
|
|
1141
|
-
|
|
1142
|
-
const
|
|
1143
|
-
|
|
940
|
+
}, j.#t === 1 || this.buf !== Q) return;
|
|
941
|
+
j.#t = 1;
|
|
942
|
+
const e = X[H];
|
|
943
|
+
e && e.setVol(this.volume * j.#t);
|
|
1144
944
|
};
|
|
1145
|
-
setVol(
|
|
945
|
+
setVol(e) {
|
|
1146
946
|
}
|
|
1147
947
|
tw() {
|
|
1148
948
|
}
|
|
@@ -1153,174 +953,174 @@ class I {
|
|
|
1153
953
|
destroy() {
|
|
1154
954
|
}
|
|
1155
955
|
}
|
|
1156
|
-
let
|
|
1157
|
-
const
|
|
1158
|
-
class
|
|
1159
|
-
constructor(
|
|
1160
|
-
this.hArg =
|
|
1161
|
-
const o =
|
|
956
|
+
let J, c, E, Z, X, K;
|
|
957
|
+
const H = "BGM", D = "SE", Q = "VOICE";
|
|
958
|
+
class d {
|
|
959
|
+
constructor(e, t, s) {
|
|
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);
|
|
1162
962
|
if (o < 0) throw `[playse] start_ms:${o} が負の値です`;
|
|
1163
|
-
if (
|
|
1164
|
-
if (0 <
|
|
1165
|
-
if (
|
|
1166
|
-
if (
|
|
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} は異常値です`;
|
|
1167
967
|
}
|
|
1168
|
-
const
|
|
1169
|
-
|
|
1170
|
-
const
|
|
1171
|
-
|
|
1172
|
-
const
|
|
1173
|
-
|
|
1174
|
-
const
|
|
1175
|
-
this.#e = new
|
|
968
|
+
const l = "const.sn.sound." + t + ".";
|
|
969
|
+
c.setVal_Nochk("save", l + "fn", s);
|
|
970
|
+
const h = d.getVol(e, 1);
|
|
971
|
+
c.setVal_Nochk("save", l + "volume", h);
|
|
972
|
+
const m = h * Number(c.getVal("sys:" + l + "volume", 1, !0)), y = A(e, "loop", !1);
|
|
973
|
+
y ? (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();
|
|
974
|
+
const g = z.find(s);
|
|
975
|
+
this.#e = new j(
|
|
1176
976
|
s,
|
|
1177
|
-
|
|
977
|
+
t,
|
|
1178
978
|
o,
|
|
1179
|
-
i,
|
|
1180
979
|
r,
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
980
|
+
i,
|
|
981
|
+
m,
|
|
982
|
+
u,
|
|
983
|
+
g
|
|
1184
984
|
);
|
|
1185
|
-
const
|
|
1186
|
-
loop:
|
|
1187
|
-
speed:
|
|
1188
|
-
volume:
|
|
985
|
+
const f = {
|
|
986
|
+
loop: y,
|
|
987
|
+
speed: a,
|
|
988
|
+
volume: m,
|
|
1189
989
|
loaded: (p, P) => {
|
|
1190
990
|
if (!this.#e.stt.isDestroy) {
|
|
1191
991
|
if (p) {
|
|
1192
|
-
|
|
992
|
+
E.errScript(`ロード失敗です SndBuf fn:${s} ${String(p)}`, !1);
|
|
1193
993
|
return;
|
|
1194
994
|
}
|
|
1195
|
-
P && (this.#e.addSnd(P),
|
|
995
|
+
P && (this.#e.addSnd(P), u !== 0 && (P.filters = [new B.StereoFilter(u)]), e.fnc?.());
|
|
1196
996
|
}
|
|
1197
997
|
}
|
|
1198
998
|
};
|
|
1199
|
-
let
|
|
1200
|
-
if (0 < o ||
|
|
1201
|
-
|
|
1202
|
-
const p = (
|
|
999
|
+
let x = "";
|
|
1000
|
+
if (0 < o || r < d.#s) {
|
|
1001
|
+
x = `${s};${o};${r};${i}`;
|
|
1002
|
+
const p = (f.sprites ??= {})[x] = {
|
|
1203
1003
|
start: o / 1e3,
|
|
1204
|
-
end:
|
|
1004
|
+
end: r / 1e3
|
|
1205
1005
|
};
|
|
1206
|
-
|
|
1207
|
-
const P =
|
|
1208
|
-
|
|
1006
|
+
f.preload = !0;
|
|
1007
|
+
const P = f.loaded;
|
|
1008
|
+
f.loaded = (C, O) => {
|
|
1209
1009
|
if (this.#e.stt.isDestroy) return;
|
|
1210
|
-
P(
|
|
1211
|
-
const
|
|
1212
|
-
p.end < 0 && (p.end +=
|
|
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));
|
|
1213
1013
|
};
|
|
1214
|
-
} else
|
|
1215
|
-
if (
|
|
1216
|
-
const P = p.duration,
|
|
1217
|
-
P <=
|
|
1014
|
+
} else f.autoPlay = !0;
|
|
1015
|
+
if (y ? 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({
|
|
1218
1018
|
// 一周目はループなし、なのでキャッシュされてる
|
|
1219
|
-
...
|
|
1220
|
-
start:
|
|
1019
|
+
...f,
|
|
1020
|
+
start: C,
|
|
1221
1021
|
end: O < 0 ? O + P : O,
|
|
1222
1022
|
// 負の値は末尾から
|
|
1223
1023
|
// speed, // 重複
|
|
1224
1024
|
loop: !0,
|
|
1225
1025
|
// volume, // 重複
|
|
1226
1026
|
//- muted?: boolean;
|
|
1227
|
-
filters:
|
|
1027
|
+
filters: u !== 0 ? [new B.StereoFilter(u)] : []
|
|
1228
1028
|
//- complete?: CompleteCallback;
|
|
1229
1029
|
//- loaded?: LoadedCallback;
|
|
1230
1030
|
//- singleInstance?: boolean;
|
|
1231
1031
|
});
|
|
1232
|
-
}) :
|
|
1233
|
-
|
|
1234
|
-
}, this.#n(),
|
|
1235
|
-
if (
|
|
1236
|
-
else if (
|
|
1237
|
-
const p =
|
|
1238
|
-
!(p instanceof ArrayBuffer) || p.byteLength === 0 ?
|
|
1239
|
-
...
|
|
1240
|
-
url:
|
|
1032
|
+
}) : f.complete = () => {
|
|
1033
|
+
W(this.#e, t), this.#e.onPlayEnd();
|
|
1034
|
+
}, this.#n(), g) {
|
|
1035
|
+
if (g.volume = m, x) this.#o(s, f);
|
|
1036
|
+
else if (g.isPlayable) {
|
|
1037
|
+
const p = g.options.source;
|
|
1038
|
+
!(p instanceof ArrayBuffer) || p.byteLength === 0 ? g.play(f) : this.#e.addSnd(N.from({
|
|
1039
|
+
...f,
|
|
1040
|
+
url: g.options.url,
|
|
1241
1041
|
source: p
|
|
1242
1042
|
}));
|
|
1243
1043
|
}
|
|
1244
|
-
|
|
1044
|
+
u !== 0 && (g.filters = [new B.StereoFilter(u)]), this.needLoad = !1;
|
|
1245
1045
|
return;
|
|
1246
1046
|
}
|
|
1247
|
-
if (this.needLoad =
|
|
1248
|
-
const p = this.#e.procID + `loaded buf:${
|
|
1249
|
-
|
|
1250
|
-
const P =
|
|
1251
|
-
|
|
1252
|
-
P(
|
|
1047
|
+
if (this.needLoad = A(e, "join", !0)) {
|
|
1048
|
+
const p = this.#e.procID + `loaded buf:${t} fn:${s}`;
|
|
1049
|
+
L.beginProc(p);
|
|
1050
|
+
const P = f.loaded;
|
|
1051
|
+
f.loaded = (C, O) => {
|
|
1052
|
+
P(C, O), L.endProc(p);
|
|
1253
1053
|
};
|
|
1254
1054
|
}
|
|
1255
|
-
this.#o(s,
|
|
1055
|
+
this.#o(s, f);
|
|
1256
1056
|
}
|
|
1257
1057
|
static #t = {};
|
|
1258
|
-
static init(
|
|
1259
|
-
|
|
1058
|
+
static init(e, t, s, o, r) {
|
|
1059
|
+
d.#t = {}, J = e, c = t, E = s, Z = o, X = r;
|
|
1260
1060
|
}
|
|
1261
|
-
static setEvtMng(
|
|
1262
|
-
|
|
1061
|
+
static setEvtMng(e) {
|
|
1062
|
+
K = e;
|
|
1263
1063
|
}
|
|
1264
|
-
static delLoopPlay(
|
|
1265
|
-
delete
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1064
|
+
static delLoopPlay(e) {
|
|
1065
|
+
delete d.#t[e];
|
|
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();
|
|
1268
1068
|
}
|
|
1269
|
-
static getVol(
|
|
1270
|
-
const s =
|
|
1069
|
+
static getVol(e, t) {
|
|
1070
|
+
const s = F(e, "volume", t);
|
|
1271
1071
|
return s < 0 ? 0 : s > 1 ? 1 : s;
|
|
1272
1072
|
}
|
|
1273
|
-
static xchgbuf({ buf:
|
|
1274
|
-
if (
|
|
1275
|
-
const s = "const.sn.sound." +
|
|
1276
|
-
|
|
1073
|
+
static xchgbuf({ buf: e = D, buf2: t = D }) {
|
|
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();
|
|
1277
1077
|
}
|
|
1278
1078
|
static #s = 999e3;
|
|
1279
1079
|
#e;
|
|
1280
1080
|
needLoad;
|
|
1281
1081
|
#n = () => {
|
|
1282
|
-
|
|
1082
|
+
z.volumeAll = Number(c.getVal("sys:sn.sound.global_volume", 1)), this.#n = () => {
|
|
1283
1083
|
};
|
|
1284
1084
|
};
|
|
1285
|
-
#o(
|
|
1286
|
-
const s =
|
|
1085
|
+
#o(e, t) {
|
|
1086
|
+
const s = J.searchPath(e, ae.SOUND);
|
|
1287
1087
|
if (!s.endsWith(".bin")) {
|
|
1288
|
-
|
|
1088
|
+
t.url = s, N.from(t);
|
|
1289
1089
|
return;
|
|
1290
1090
|
}
|
|
1291
|
-
new
|
|
1292
|
-
|
|
1293
|
-
o.data =
|
|
1294
|
-
}).catch((
|
|
1295
|
-
}).load((o,
|
|
1296
|
-
|
|
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);
|
|
1297
1097
|
});
|
|
1298
1098
|
}
|
|
1299
|
-
setVol(
|
|
1300
|
-
this.#e.setVol(
|
|
1099
|
+
setVol(e) {
|
|
1100
|
+
this.#e.setVol(e);
|
|
1301
1101
|
}
|
|
1302
|
-
ws = (
|
|
1303
|
-
stopse({ buf:
|
|
1304
|
-
|
|
1102
|
+
ws = (e) => this.#e.stt.ws(this.#e, e);
|
|
1103
|
+
stopse({ buf: e = D }) {
|
|
1104
|
+
W(this.#e, e), this.#e.stt.stopse(this.#e);
|
|
1305
1105
|
}
|
|
1306
|
-
fade = (
|
|
1307
|
-
wf = (
|
|
1308
|
-
stopfadese = (
|
|
1106
|
+
fade = (e) => this.#e.stt.fade(this.#e, e);
|
|
1107
|
+
wf = (e) => this.#e.stt.wf(this.#e, e);
|
|
1108
|
+
stopfadese = (e) => this.#e.stt.stopfadese(this.#e, e);
|
|
1309
1109
|
}
|
|
1310
|
-
function
|
|
1110
|
+
function W({ loop: n }, e) {
|
|
1311
1111
|
if (n) {
|
|
1312
|
-
|
|
1112
|
+
d.delLoopPlay(e);
|
|
1313
1113
|
return;
|
|
1314
1114
|
}
|
|
1315
|
-
const
|
|
1316
|
-
|
|
1115
|
+
const t = "const.sn.sound." + e + ".";
|
|
1116
|
+
c.setVal_Nochk("tmp", t + "playing", !1), c.flush();
|
|
1317
1117
|
}
|
|
1318
|
-
class
|
|
1319
|
-
onLoad(
|
|
1320
|
-
|
|
1118
|
+
class Ee {
|
|
1119
|
+
onLoad(e) {
|
|
1120
|
+
e.stt = new G(e);
|
|
1321
1121
|
}
|
|
1322
|
-
stopse(
|
|
1323
|
-
|
|
1122
|
+
stopse(e) {
|
|
1123
|
+
e.stt = new k(e, !1);
|
|
1324
1124
|
}
|
|
1325
1125
|
ws = () => !1;
|
|
1326
1126
|
onPlayEnd() {
|
|
@@ -1340,45 +1140,45 @@ class Tt {
|
|
|
1340
1140
|
isDestroy = !1;
|
|
1341
1141
|
}
|
|
1342
1142
|
class G {
|
|
1343
|
-
constructor(
|
|
1344
|
-
this.si =
|
|
1143
|
+
constructor(e) {
|
|
1144
|
+
this.si = e;
|
|
1345
1145
|
}
|
|
1346
1146
|
onLoad() {
|
|
1347
1147
|
}
|
|
1348
1148
|
// ok
|
|
1349
|
-
stopse(
|
|
1350
|
-
|
|
1351
|
-
}
|
|
1352
|
-
ws(
|
|
1353
|
-
if (
|
|
1354
|
-
|
|
1355
|
-
const s =
|
|
1356
|
-
if (s &&
|
|
1357
|
-
return o ?
|
|
1149
|
+
stopse(e) {
|
|
1150
|
+
e.stt = new k(e);
|
|
1151
|
+
}
|
|
1152
|
+
ws(e, t) {
|
|
1153
|
+
if (e.loop) return !1;
|
|
1154
|
+
e.stt = new Fe(e);
|
|
1155
|
+
const s = A(t, "canskip", !1), o = A(t, "stop", !0);
|
|
1156
|
+
if (s && K.isSkipping)
|
|
1157
|
+
return o ? e.stt.stopse(e) : e.stt.onPlayEnd = () => {
|
|
1358
1158
|
}, !1;
|
|
1359
|
-
const { buf:
|
|
1360
|
-
|
|
1159
|
+
const { buf: r = D } = t, i = () => {
|
|
1160
|
+
W(e, r), e.onPlayEnd(), o ? e.stt.stopse(e) : e.stt.onPlayEnd = () => {
|
|
1361
1161
|
};
|
|
1362
1162
|
};
|
|
1363
|
-
return
|
|
1163
|
+
return L.beginProc(e.procID + "ws", i, !0, s ? i : void 0), !0;
|
|
1364
1164
|
}
|
|
1365
1165
|
onPlayEnd() {
|
|
1366
1166
|
}
|
|
1367
1167
|
// ok
|
|
1368
|
-
fade(
|
|
1369
|
-
const { buf: s =
|
|
1370
|
-
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1373
|
-
const
|
|
1374
|
-
if (
|
|
1375
|
-
|
|
1168
|
+
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();
|
|
1173
|
+
const l = F(t, "time", NaN), h = F(t, "delay", 0);
|
|
1174
|
+
if (l === 0 && h === 0 || K.isSkipping) {
|
|
1175
|
+
e.setVol(u), e.stt = a ? new k(e) : new G(e);
|
|
1376
1176
|
return;
|
|
1377
1177
|
}
|
|
1378
|
-
const
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
}).start(),
|
|
1178
|
+
const m = e.tw();
|
|
1179
|
+
m && (ce.setTwProp(m, t).to({ volume: u }, l).onComplete(() => {
|
|
1180
|
+
he(m), e.stt.compFade(s), e.stt = a ? new k(e) : new G(e);
|
|
1181
|
+
}).start(), e.stt = new je(m, e));
|
|
1382
1182
|
}
|
|
1383
1183
|
wf = () => !1;
|
|
1384
1184
|
// ok
|
|
@@ -1390,20 +1190,20 @@ class G {
|
|
|
1390
1190
|
// ok
|
|
1391
1191
|
isDestroy = !1;
|
|
1392
1192
|
}
|
|
1393
|
-
class
|
|
1394
|
-
constructor(
|
|
1395
|
-
this.si =
|
|
1193
|
+
class Fe {
|
|
1194
|
+
constructor(e) {
|
|
1195
|
+
this.si = e;
|
|
1396
1196
|
}
|
|
1397
1197
|
onLoad() {
|
|
1398
1198
|
}
|
|
1399
1199
|
// ok
|
|
1400
|
-
stopse(
|
|
1401
|
-
|
|
1200
|
+
stopse(e) {
|
|
1201
|
+
e.stt = new k(e);
|
|
1402
1202
|
}
|
|
1403
1203
|
ws = () => !1;
|
|
1404
1204
|
// ok
|
|
1405
1205
|
onPlayEnd() {
|
|
1406
|
-
|
|
1206
|
+
L.notifyEndProc(this.si.procID + "ws");
|
|
1407
1207
|
}
|
|
1408
1208
|
fade() {
|
|
1409
1209
|
}
|
|
@@ -1418,15 +1218,15 @@ class At {
|
|
|
1418
1218
|
// ok
|
|
1419
1219
|
isDestroy = !1;
|
|
1420
1220
|
}
|
|
1421
|
-
class
|
|
1422
|
-
constructor(
|
|
1423
|
-
this.tw =
|
|
1221
|
+
class je {
|
|
1222
|
+
constructor(e, t) {
|
|
1223
|
+
this.tw = e, this.si = t;
|
|
1424
1224
|
}
|
|
1425
1225
|
onLoad() {
|
|
1426
1226
|
}
|
|
1427
1227
|
// ok
|
|
1428
|
-
stopse(
|
|
1429
|
-
this.stopfadese(),
|
|
1228
|
+
stopse(e) {
|
|
1229
|
+
this.stopfadese(), e.stt = new k(e);
|
|
1430
1230
|
}
|
|
1431
1231
|
// 順番厳守
|
|
1432
1232
|
ws = () => !1;
|
|
@@ -1437,13 +1237,13 @@ class Vt {
|
|
|
1437
1237
|
fade() {
|
|
1438
1238
|
}
|
|
1439
1239
|
// ok
|
|
1440
|
-
wf(
|
|
1441
|
-
|
|
1442
|
-
const s =
|
|
1443
|
-
if (s &&
|
|
1240
|
+
wf(e, t) {
|
|
1241
|
+
e.stt = new Se(e);
|
|
1242
|
+
const s = A(t, "canskip", !1);
|
|
1243
|
+
if (s && K.isSkipping)
|
|
1444
1244
|
return this.stopfadese(), !1;
|
|
1445
1245
|
const o = () => this.stopfadese();
|
|
1446
|
-
return
|
|
1246
|
+
return L.beginProc(e.procID + "wf", o, !0, s ? o : void 0), !0;
|
|
1447
1247
|
}
|
|
1448
1248
|
compFade() {
|
|
1449
1249
|
}
|
|
@@ -1451,15 +1251,15 @@ class Vt {
|
|
|
1451
1251
|
stopfadese = () => this.si.stop();
|
|
1452
1252
|
isDestroy = !1;
|
|
1453
1253
|
}
|
|
1454
|
-
class
|
|
1455
|
-
constructor(
|
|
1456
|
-
this.si =
|
|
1254
|
+
class Se {
|
|
1255
|
+
constructor(e) {
|
|
1256
|
+
this.si = e;
|
|
1457
1257
|
}
|
|
1458
1258
|
onLoad() {
|
|
1459
1259
|
}
|
|
1460
1260
|
// ok
|
|
1461
|
-
stopse(
|
|
1462
|
-
this.stopfadese(),
|
|
1261
|
+
stopse(e) {
|
|
1262
|
+
this.stopfadese(), e.stt = new k(e);
|
|
1463
1263
|
}
|
|
1464
1264
|
ws = () => !1;
|
|
1465
1265
|
// ok
|
|
@@ -1472,14 +1272,14 @@ class Mt {
|
|
|
1472
1272
|
wf = () => !1;
|
|
1473
1273
|
// ok
|
|
1474
1274
|
compFade() {
|
|
1475
|
-
|
|
1275
|
+
L.notifyEndProc(this.si.procID + "wf");
|
|
1476
1276
|
}
|
|
1477
1277
|
stopfadese = () => this.si.stop();
|
|
1478
1278
|
isDestroy = !1;
|
|
1479
1279
|
}
|
|
1480
|
-
class
|
|
1481
|
-
constructor(
|
|
1482
|
-
this.si =
|
|
1280
|
+
class k {
|
|
1281
|
+
constructor(e, t = !0) {
|
|
1282
|
+
this.si = e, this.stop = t, t && (e.stop(), e.loop && (e.destroy(), e.destroy = () => {
|
|
1483
1283
|
}));
|
|
1484
1284
|
}
|
|
1485
1285
|
onLoad() {
|
|
@@ -1507,13 +1307,10 @@ class M {
|
|
|
1507
1307
|
isDestroy = !0;
|
|
1508
1308
|
}
|
|
1509
1309
|
export {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
Q as T,
|
|
1516
|
-
z as a,
|
|
1517
|
-
$ as b
|
|
1310
|
+
D as B,
|
|
1311
|
+
Ae as I,
|
|
1312
|
+
z as R,
|
|
1313
|
+
d as S,
|
|
1314
|
+
H as a
|
|
1518
1315
|
};
|
|
1519
1316
|
//# sourceMappingURL=SndBuf.js.map
|