audio-mixer-ui 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/audio-mixer-ui.js +954 -899
- package/dist/audio-mixer-ui.umd.cjs +12 -12
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/audio-mixer-ui.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as x, watch as v, unref as T, onScopeDispose as QU, readonly as El, mergeModels as Sl, useCssVars as Ul, computed as J, useTemplateRef as f, useModel as $, createElementBlock as y, openBlock as N, normalizeClass as L, createElementVNode as h, createCommentVNode as _, Fragment as nl, renderList as Xl, normalizeStyle as gl, renderSlot as Ql, toDisplayString as K, onUnmounted as cl, watchEffect as kl, onMounted as bl, createVNode as C, withCtx as w, createTextVNode as Nl, withDirectives as Kl, withKeys as VU, vModelText as Hl, withModifiers as Tl, createBlock as Rl } from "vue";
|
|
2
2
|
import { defineStore as sl } from "pinia";
|
|
3
3
|
var Dl = function() {
|
|
4
4
|
if (typeof Map < "u")
|
|
5
5
|
return Map;
|
|
6
|
-
function
|
|
6
|
+
function t(l, U) {
|
|
7
7
|
var F = -1;
|
|
8
|
-
return l.some(function(d,
|
|
9
|
-
return d[0] === U ? (F =
|
|
8
|
+
return l.some(function(d, Z) {
|
|
9
|
+
return d[0] === U ? (F = Z, !0) : !1;
|
|
10
10
|
}), F;
|
|
11
11
|
}
|
|
12
12
|
return (
|
|
@@ -25,22 +25,22 @@ var Dl = function() {
|
|
|
25
25
|
enumerable: !0,
|
|
26
26
|
configurable: !0
|
|
27
27
|
}), l.prototype.get = function(U) {
|
|
28
|
-
var F =
|
|
28
|
+
var F = t(this.__entries__, U), d = this.__entries__[F];
|
|
29
29
|
return d && d[1];
|
|
30
30
|
}, l.prototype.set = function(U, F) {
|
|
31
|
-
var d =
|
|
31
|
+
var d = t(this.__entries__, U);
|
|
32
32
|
~d ? this.__entries__[d][1] = F : this.__entries__.push([U, F]);
|
|
33
33
|
}, l.prototype.delete = function(U) {
|
|
34
|
-
var F = this.__entries__, d =
|
|
34
|
+
var F = this.__entries__, d = t(F, U);
|
|
35
35
|
~d && F.splice(d, 1);
|
|
36
36
|
}, l.prototype.has = function(U) {
|
|
37
|
-
return !!~
|
|
37
|
+
return !!~t(this.__entries__, U);
|
|
38
38
|
}, l.prototype.clear = function() {
|
|
39
39
|
this.__entries__.splice(0);
|
|
40
40
|
}, l.prototype.forEach = function(U, F) {
|
|
41
41
|
F === void 0 && (F = null);
|
|
42
|
-
for (var d = 0,
|
|
43
|
-
var Q =
|
|
42
|
+
for (var d = 0, Z = this.__entries__; d < Z.length; d++) {
|
|
43
|
+
var Q = Z[d];
|
|
44
44
|
U.call(F, Q[1], Q[0]);
|
|
45
45
|
}
|
|
46
46
|
}, l;
|
|
@@ -48,25 +48,25 @@ var Dl = function() {
|
|
|
48
48
|
);
|
|
49
49
|
}(), Gl = typeof window < "u" && typeof document < "u" && window.document === document, ml = function() {
|
|
50
50
|
return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
|
|
51
|
-
}(),
|
|
52
|
-
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(ml) : function(
|
|
51
|
+
}(), aU = function() {
|
|
52
|
+
return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(ml) : function(t) {
|
|
53
53
|
return setTimeout(function() {
|
|
54
|
-
return
|
|
54
|
+
return t(Date.now());
|
|
55
55
|
}, 1e3 / 60);
|
|
56
56
|
};
|
|
57
|
-
}(),
|
|
58
|
-
function
|
|
57
|
+
}(), nU = 2;
|
|
58
|
+
function RU(t, l) {
|
|
59
59
|
var U = !1, F = !1, d = 0;
|
|
60
|
-
function
|
|
61
|
-
U && (U = !1,
|
|
60
|
+
function Z() {
|
|
61
|
+
U && (U = !1, t()), F && V();
|
|
62
62
|
}
|
|
63
63
|
function Q() {
|
|
64
|
-
|
|
64
|
+
aU(Z);
|
|
65
65
|
}
|
|
66
66
|
function V() {
|
|
67
67
|
var a = Date.now();
|
|
68
68
|
if (U) {
|
|
69
|
-
if (a - d <
|
|
69
|
+
if (a - d < nU)
|
|
70
70
|
return;
|
|
71
71
|
F = !0;
|
|
72
72
|
} else
|
|
@@ -75,108 +75,108 @@ function nU(Z, l) {
|
|
|
75
75
|
}
|
|
76
76
|
return V;
|
|
77
77
|
}
|
|
78
|
-
var
|
|
78
|
+
var mU = 20, eU = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], WU = typeof MutationObserver < "u", cU = (
|
|
79
79
|
/** @class */
|
|
80
80
|
function() {
|
|
81
|
-
function
|
|
82
|
-
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh =
|
|
81
|
+
function t() {
|
|
82
|
+
this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = RU(this.refresh.bind(this), mU);
|
|
83
83
|
}
|
|
84
|
-
return
|
|
84
|
+
return t.prototype.addObserver = function(l) {
|
|
85
85
|
~this.observers_.indexOf(l) || this.observers_.push(l), this.connected_ || this.connect_();
|
|
86
|
-
},
|
|
86
|
+
}, t.prototype.removeObserver = function(l) {
|
|
87
87
|
var U = this.observers_, F = U.indexOf(l);
|
|
88
88
|
~F && U.splice(F, 1), !U.length && this.connected_ && this.disconnect_();
|
|
89
|
-
},
|
|
89
|
+
}, t.prototype.refresh = function() {
|
|
90
90
|
var l = this.updateObservers_();
|
|
91
91
|
l && this.refresh();
|
|
92
|
-
},
|
|
92
|
+
}, t.prototype.updateObservers_ = function() {
|
|
93
93
|
var l = this.observers_.filter(function(U) {
|
|
94
94
|
return U.gatherActive(), U.hasActive();
|
|
95
95
|
});
|
|
96
96
|
return l.forEach(function(U) {
|
|
97
97
|
return U.broadcastActive();
|
|
98
98
|
}), l.length > 0;
|
|
99
|
-
},
|
|
100
|
-
!Gl || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh),
|
|
99
|
+
}, t.prototype.connect_ = function() {
|
|
100
|
+
!Gl || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), WU ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
|
|
101
101
|
attributes: !0,
|
|
102
102
|
childList: !0,
|
|
103
103
|
characterData: !0,
|
|
104
104
|
subtree: !0
|
|
105
105
|
})) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
|
|
106
|
-
},
|
|
106
|
+
}, t.prototype.disconnect_ = function() {
|
|
107
107
|
!Gl || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
|
|
108
|
-
},
|
|
109
|
-
var U = l.propertyName, F = U === void 0 ? "" : U, d =
|
|
110
|
-
return !!~F.indexOf(
|
|
108
|
+
}, t.prototype.onTransitionEnd_ = function(l) {
|
|
109
|
+
var U = l.propertyName, F = U === void 0 ? "" : U, d = eU.some(function(Z) {
|
|
110
|
+
return !!~F.indexOf(Z);
|
|
111
111
|
});
|
|
112
112
|
d && this.refresh();
|
|
113
|
-
},
|
|
114
|
-
return this.instance_ || (this.instance_ = new
|
|
115
|
-
},
|
|
113
|
+
}, t.getInstance = function() {
|
|
114
|
+
return this.instance_ || (this.instance_ = new t()), this.instance_;
|
|
115
|
+
}, t.instance_ = null, t;
|
|
116
116
|
}()
|
|
117
|
-
), jl = function(
|
|
117
|
+
), jl = function(t, l) {
|
|
118
118
|
for (var U = 0, F = Object.keys(l); U < F.length; U++) {
|
|
119
119
|
var d = F[U];
|
|
120
|
-
Object.defineProperty(
|
|
120
|
+
Object.defineProperty(t, d, {
|
|
121
121
|
value: l[d],
|
|
122
122
|
enumerable: !1,
|
|
123
123
|
writable: !1,
|
|
124
124
|
configurable: !0
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
return
|
|
128
|
-
}, Zl = function(
|
|
129
|
-
var l =
|
|
127
|
+
return t;
|
|
128
|
+
}, Zl = function(t) {
|
|
129
|
+
var l = t && t.ownerDocument && t.ownerDocument.defaultView;
|
|
130
130
|
return l || ml;
|
|
131
131
|
}, ql = hl(0, 0, 0, 0);
|
|
132
|
-
function el(
|
|
133
|
-
return parseFloat(
|
|
132
|
+
function el(t) {
|
|
133
|
+
return parseFloat(t) || 0;
|
|
134
134
|
}
|
|
135
|
-
function rl(
|
|
135
|
+
function rl(t) {
|
|
136
136
|
for (var l = [], U = 1; U < arguments.length; U++)
|
|
137
137
|
l[U - 1] = arguments[U];
|
|
138
138
|
return l.reduce(function(F, d) {
|
|
139
|
-
var
|
|
140
|
-
return F + el(
|
|
139
|
+
var Z = t["border-" + d + "-width"];
|
|
140
|
+
return F + el(Z);
|
|
141
141
|
}, 0);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function bU(t) {
|
|
144
144
|
for (var l = ["top", "right", "bottom", "left"], U = {}, F = 0, d = l; F < d.length; F++) {
|
|
145
|
-
var
|
|
146
|
-
U[
|
|
145
|
+
var Z = d[F], Q = t["padding-" + Z];
|
|
146
|
+
U[Z] = el(Q);
|
|
147
147
|
}
|
|
148
148
|
return U;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
var l =
|
|
150
|
+
function sU(t) {
|
|
151
|
+
var l = t.getBBox();
|
|
152
152
|
return hl(0, 0, l.width, l.height);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
var l =
|
|
154
|
+
function hU(t) {
|
|
155
|
+
var l = t.clientWidth, U = t.clientHeight;
|
|
156
156
|
if (!l && !U)
|
|
157
157
|
return ql;
|
|
158
|
-
var F = Zl(
|
|
159
|
-
if (F.boxSizing === "border-box" && (Math.round(V +
|
|
160
|
-
var n = Math.round(V +
|
|
158
|
+
var F = Zl(t).getComputedStyle(t), d = bU(F), Z = d.left + d.right, Q = d.top + d.bottom, V = el(F.width), a = el(F.height);
|
|
159
|
+
if (F.boxSizing === "border-box" && (Math.round(V + Z) !== l && (V -= rl(F, "left", "right") + Z), Math.round(a + Q) !== U && (a -= rl(F, "top", "bottom") + Q)), !iU(t)) {
|
|
160
|
+
var n = Math.round(V + Z) - l, R = Math.round(a + Q) - U;
|
|
161
161
|
Math.abs(n) !== 1 && (V -= n), Math.abs(R) !== 1 && (a -= R);
|
|
162
162
|
}
|
|
163
163
|
return hl(d.left, d.top, V, a);
|
|
164
164
|
}
|
|
165
|
-
var
|
|
166
|
-
return typeof SVGGraphicsElement < "u" ? function(
|
|
167
|
-
return
|
|
168
|
-
} : function(
|
|
169
|
-
return
|
|
165
|
+
var BU = /* @__PURE__ */ function() {
|
|
166
|
+
return typeof SVGGraphicsElement < "u" ? function(t) {
|
|
167
|
+
return t instanceof Zl(t).SVGGraphicsElement;
|
|
168
|
+
} : function(t) {
|
|
169
|
+
return t instanceof Zl(t).SVGElement && typeof t.getBBox == "function";
|
|
170
170
|
};
|
|
171
171
|
}();
|
|
172
|
-
function
|
|
173
|
-
return
|
|
172
|
+
function iU(t) {
|
|
173
|
+
return t === Zl(t).document.documentElement;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
return Gl ?
|
|
175
|
+
function uU(t) {
|
|
176
|
+
return Gl ? BU(t) ? sU(t) : hU(t) : ql;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
var l =
|
|
178
|
+
function JU(t) {
|
|
179
|
+
var l = t.x, U = t.y, F = t.width, d = t.height, Z = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, Q = Object.create(Z.prototype);
|
|
180
180
|
return jl(Q, {
|
|
181
181
|
x: l,
|
|
182
182
|
y: U,
|
|
@@ -188,50 +188,50 @@ function uU(Z) {
|
|
|
188
188
|
left: l
|
|
189
189
|
}), Q;
|
|
190
190
|
}
|
|
191
|
-
function hl(
|
|
192
|
-
return { x:
|
|
191
|
+
function hl(t, l, U, F) {
|
|
192
|
+
return { x: t, y: l, width: U, height: F };
|
|
193
193
|
}
|
|
194
|
-
var
|
|
194
|
+
var GU = (
|
|
195
195
|
/** @class */
|
|
196
196
|
function() {
|
|
197
|
-
function
|
|
197
|
+
function t(l) {
|
|
198
198
|
this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = hl(0, 0, 0, 0), this.target = l;
|
|
199
199
|
}
|
|
200
|
-
return
|
|
201
|
-
var l =
|
|
200
|
+
return t.prototype.isActive = function() {
|
|
201
|
+
var l = uU(this.target);
|
|
202
202
|
return this.contentRect_ = l, l.width !== this.broadcastWidth || l.height !== this.broadcastHeight;
|
|
203
|
-
},
|
|
203
|
+
}, t.prototype.broadcastRect = function() {
|
|
204
204
|
var l = this.contentRect_;
|
|
205
205
|
return this.broadcastWidth = l.width, this.broadcastHeight = l.height, l;
|
|
206
|
-
},
|
|
206
|
+
}, t;
|
|
207
207
|
}()
|
|
208
|
-
),
|
|
208
|
+
), oU = (
|
|
209
209
|
/** @class */
|
|
210
210
|
/* @__PURE__ */ function() {
|
|
211
|
-
function
|
|
212
|
-
var F =
|
|
211
|
+
function t(l, U) {
|
|
212
|
+
var F = JU(U);
|
|
213
213
|
jl(this, { target: l, contentRect: F });
|
|
214
214
|
}
|
|
215
|
-
return
|
|
215
|
+
return t;
|
|
216
216
|
}()
|
|
217
|
-
),
|
|
217
|
+
), SU = (
|
|
218
218
|
/** @class */
|
|
219
219
|
function() {
|
|
220
|
-
function
|
|
220
|
+
function t(l, U, F) {
|
|
221
221
|
if (this.activeObservations_ = [], this.observations_ = new Dl(), typeof l != "function")
|
|
222
222
|
throw new TypeError("The callback provided as parameter 1 is not a function.");
|
|
223
223
|
this.callback_ = l, this.controller_ = U, this.callbackCtx_ = F;
|
|
224
224
|
}
|
|
225
|
-
return
|
|
225
|
+
return t.prototype.observe = function(l) {
|
|
226
226
|
if (!arguments.length)
|
|
227
227
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
228
228
|
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
229
229
|
if (!(l instanceof Zl(l).Element))
|
|
230
230
|
throw new TypeError('parameter 1 is not of type "Element".');
|
|
231
231
|
var U = this.observations_;
|
|
232
|
-
U.has(l) || (U.set(l, new
|
|
232
|
+
U.has(l) || (U.set(l, new GU(l)), this.controller_.addObserver(this), this.controller_.refresh());
|
|
233
233
|
}
|
|
234
|
-
},
|
|
234
|
+
}, t.prototype.unobserve = function(l) {
|
|
235
235
|
if (!arguments.length)
|
|
236
236
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
237
237
|
if (!(typeof Element > "u" || !(Element instanceof Object))) {
|
|
@@ -240,83 +240,83 @@ var JU = (
|
|
|
240
240
|
var U = this.observations_;
|
|
241
241
|
U.has(l) && (U.delete(l), U.size || this.controller_.removeObserver(this));
|
|
242
242
|
}
|
|
243
|
-
},
|
|
243
|
+
}, t.prototype.disconnect = function() {
|
|
244
244
|
this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
|
|
245
|
-
},
|
|
245
|
+
}, t.prototype.gatherActive = function() {
|
|
246
246
|
var l = this;
|
|
247
247
|
this.clearActive(), this.observations_.forEach(function(U) {
|
|
248
248
|
U.isActive() && l.activeObservations_.push(U);
|
|
249
249
|
});
|
|
250
|
-
},
|
|
250
|
+
}, t.prototype.broadcastActive = function() {
|
|
251
251
|
if (this.hasActive()) {
|
|
252
252
|
var l = this.callbackCtx_, U = this.activeObservations_.map(function(F) {
|
|
253
|
-
return new
|
|
253
|
+
return new oU(F.target, F.broadcastRect());
|
|
254
254
|
});
|
|
255
255
|
this.callback_.call(l, U, l), this.clearActive();
|
|
256
256
|
}
|
|
257
|
-
},
|
|
257
|
+
}, t.prototype.clearActive = function() {
|
|
258
258
|
this.activeObservations_.splice(0);
|
|
259
|
-
},
|
|
259
|
+
}, t.prototype.hasActive = function() {
|
|
260
260
|
return this.activeObservations_.length > 0;
|
|
261
|
-
},
|
|
261
|
+
}, t;
|
|
262
262
|
}()
|
|
263
263
|
), Pl = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new Dl(), wl = (
|
|
264
264
|
/** @class */
|
|
265
265
|
/* @__PURE__ */ function() {
|
|
266
|
-
function
|
|
267
|
-
if (!(this instanceof
|
|
266
|
+
function t(l) {
|
|
267
|
+
if (!(this instanceof t))
|
|
268
268
|
throw new TypeError("Cannot call a class as a function.");
|
|
269
269
|
if (!arguments.length)
|
|
270
270
|
throw new TypeError("1 argument required, but only 0 present.");
|
|
271
|
-
var U =
|
|
271
|
+
var U = cU.getInstance(), F = new SU(l, U, this);
|
|
272
272
|
Pl.set(this, F);
|
|
273
273
|
}
|
|
274
|
-
return
|
|
274
|
+
return t;
|
|
275
275
|
}()
|
|
276
276
|
);
|
|
277
277
|
[
|
|
278
278
|
"observe",
|
|
279
279
|
"unobserve",
|
|
280
280
|
"disconnect"
|
|
281
|
-
].forEach(function(
|
|
282
|
-
wl.prototype[
|
|
281
|
+
].forEach(function(t) {
|
|
282
|
+
wl.prototype[t] = function() {
|
|
283
283
|
var l;
|
|
284
|
-
return (l = Pl.get(this))[
|
|
284
|
+
return (l = Pl.get(this))[t].apply(l, arguments);
|
|
285
285
|
};
|
|
286
286
|
});
|
|
287
|
-
var
|
|
287
|
+
var XU = function() {
|
|
288
288
|
return typeof ml.ResizeObserver < "u" ? ml.ResizeObserver : wl;
|
|
289
289
|
}();
|
|
290
|
-
function
|
|
291
|
-
const l =
|
|
290
|
+
function Fl(t) {
|
|
291
|
+
const l = x(0), U = x(0);
|
|
292
292
|
let F = null;
|
|
293
293
|
const d = () => {
|
|
294
294
|
F && (F.disconnect(), F = null);
|
|
295
295
|
};
|
|
296
|
-
return
|
|
296
|
+
return v(() => T(t), () => {
|
|
297
297
|
d();
|
|
298
|
-
const Q =
|
|
298
|
+
const Q = T(t);
|
|
299
299
|
if (!Q) return;
|
|
300
|
-
F = new
|
|
300
|
+
F = new XU((a) => {
|
|
301
301
|
const n = a[0];
|
|
302
302
|
n && (l.value = n.contentRect.width, U.value = n.contentRect.height);
|
|
303
303
|
}), F.observe(Q);
|
|
304
304
|
const V = Q.getBoundingClientRect();
|
|
305
305
|
l.value = V.width, U.value = V.height;
|
|
306
|
-
}, { immediate: !0 }),
|
|
306
|
+
}, { immediate: !0 }), QU(d), {
|
|
307
307
|
width: El(l),
|
|
308
308
|
height: El(U)
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
|
-
const
|
|
312
|
-
const U =
|
|
311
|
+
const H = (t, l) => {
|
|
312
|
+
const U = t.__vccOpts || t;
|
|
313
313
|
for (const [F, d] of l)
|
|
314
314
|
U[F] = d;
|
|
315
315
|
return U;
|
|
316
|
-
},
|
|
316
|
+
}, NU = {
|
|
317
317
|
key: 0,
|
|
318
318
|
class: "level"
|
|
319
|
-
},
|
|
319
|
+
}, pU = {
|
|
320
320
|
__name: "AudioSlider",
|
|
321
321
|
props: /* @__PURE__ */ Sl({
|
|
322
322
|
min: { type: Number, default: 0 },
|
|
@@ -332,72 +332,72 @@ const j = (Z, l) => {
|
|
|
332
332
|
valueModifiers: {}
|
|
333
333
|
}),
|
|
334
334
|
emits: ["update:value"],
|
|
335
|
-
setup(
|
|
336
|
-
|
|
335
|
+
setup(t) {
|
|
336
|
+
Ul((G) => ({
|
|
337
337
|
"083f3e45": c.value,
|
|
338
338
|
d4833630: e.value,
|
|
339
|
-
d6eaa016:
|
|
340
|
-
12894835:
|
|
341
|
-
"3e9a6a44":
|
|
339
|
+
d6eaa016: u.value,
|
|
340
|
+
12894835: b.value,
|
|
341
|
+
"3e9a6a44": B.value
|
|
342
342
|
}));
|
|
343
|
-
const l =
|
|
343
|
+
const l = t, U = f("root"), { width: F, height: d } = Fl(U), Z = J(() => Math.min(F.value, d.value)), Q = J(() => Math.max(F.value, d.value)), V = J(() => F.value > d.value), a = J(() => V.value ? "h-slide" : "v-slide"), n = $(t, "value"), R = J(() => Z.value * 0.8), m = J(() => Z.value * l.thumbLength * 0.8), e = J(() => (V.value ? m : R).value + "px"), c = J(() => (V.value ? R : m).value + "px"), b = J(() => Z.value * 0.1 + "px"), B = J(() => (Q.value - m.value) * (n.value - l.min) / (l.max - l.min) + "px"), u = J(() => V.value ? "90deg" : "0deg"), X = x(!1), E = x(0), z = (G) => {
|
|
344
344
|
if (!U.value) return n.value;
|
|
345
|
-
const
|
|
346
|
-
let
|
|
345
|
+
const M = U.value.getBoundingClientRect(), O = G.touches ? G.touches[0].clientX : G.clientX, i = G.touches ? G.touches[0].clientY : G.clientY;
|
|
346
|
+
let o;
|
|
347
347
|
if (V.value) {
|
|
348
|
-
const
|
|
349
|
-
|
|
348
|
+
const I = O - M.left - R.value / 2, A = M.width - R.value;
|
|
349
|
+
o = Math.max(0, Math.min(1, I / A));
|
|
350
350
|
} else {
|
|
351
|
-
const
|
|
352
|
-
|
|
351
|
+
const I = M.bottom - i - R.value / 2, A = M.height - R.value;
|
|
352
|
+
o = Math.max(0, Math.min(1, I / A));
|
|
353
353
|
}
|
|
354
|
-
const k = l.min +
|
|
354
|
+
const k = l.min + o * (l.max - l.min);
|
|
355
355
|
return l.step > 0 ? Math.round(k / l.step) * l.step : k;
|
|
356
|
-
},
|
|
357
|
-
|
|
358
|
-
},
|
|
359
|
-
X.value && (
|
|
360
|
-
},
|
|
356
|
+
}, D = (G) => {
|
|
357
|
+
G.preventDefault(), X.value = !0, E.value = n.value, n.value = z(G), U.value && U.value.setPointerCapture && U.value.setPointerCapture(G.pointerId), document.addEventListener("mousemove", g), document.addEventListener("mouseup", j);
|
|
358
|
+
}, g = (G) => {
|
|
359
|
+
X.value && (G.preventDefault(), n.value = z(G));
|
|
360
|
+
}, j = (G) => {
|
|
361
361
|
if (X.value) {
|
|
362
|
-
if (
|
|
362
|
+
if (G.preventDefault(), X.value = !1, U.value && U.value.releasePointerCapture)
|
|
363
363
|
try {
|
|
364
|
-
U.value.releasePointerCapture(
|
|
364
|
+
U.value.releasePointerCapture(G.pointerId);
|
|
365
365
|
} catch {
|
|
366
366
|
}
|
|
367
|
-
document.removeEventListener("mousemove",
|
|
367
|
+
document.removeEventListener("mousemove", g), document.removeEventListener("mouseup", j);
|
|
368
368
|
}
|
|
369
|
-
},
|
|
370
|
-
|
|
371
|
-
},
|
|
372
|
-
X.value && (
|
|
373
|
-
},
|
|
374
|
-
X.value && (
|
|
375
|
-
}, q = (
|
|
376
|
-
return (
|
|
377
|
-
class:
|
|
369
|
+
}, Y = (G) => {
|
|
370
|
+
G.preventDefault(), G.touches.length === 1 && (X.value = !0, E.value = n.value, n.value = z(G), document.addEventListener("touchmove", p, { passive: !1 }), document.addEventListener("touchend", r), document.addEventListener("touchcancel", r));
|
|
371
|
+
}, p = (G) => {
|
|
372
|
+
X.value && (G.preventDefault(), G.touches.length === 1 && (n.value = z(G)));
|
|
373
|
+
}, r = (G) => {
|
|
374
|
+
X.value && (G.preventDefault(), X.value = !1, document.removeEventListener("touchmove", p), document.removeEventListener("touchend", r), document.removeEventListener("touchcancel", r));
|
|
375
|
+
}, q = (G) => Math.min(1, Math.max(0, l.level * 10 - G + 1));
|
|
376
|
+
return (G, M) => (N(), y("div", {
|
|
377
|
+
class: L(a.value),
|
|
378
378
|
ref_key: "root",
|
|
379
379
|
ref: U,
|
|
380
|
-
onMousedown:
|
|
381
|
-
onTouchstart:
|
|
380
|
+
onMousedown: D,
|
|
381
|
+
onTouchstart: Y,
|
|
382
382
|
style: { userSelect: "none", touchAction: "none" }
|
|
383
383
|
}, [
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
(
|
|
387
|
-
class:
|
|
384
|
+
M[0] || (M[0] = h("div", { class: "track" }, null, -1)),
|
|
385
|
+
t.showLevel ? (N(), y("div", NU, [
|
|
386
|
+
(N(), y(nl, null, Xl(10, (O) => h("div", {
|
|
387
|
+
class: L(["led", "led" + O])
|
|
388
388
|
}, [
|
|
389
389
|
h("div", {
|
|
390
390
|
class: "on",
|
|
391
|
-
style: gl({ opacity: q(
|
|
391
|
+
style: gl({ opacity: q(O) })
|
|
392
392
|
}, null, 4)
|
|
393
393
|
], 2)), 64))
|
|
394
|
-
])) :
|
|
394
|
+
])) : _("", !0),
|
|
395
395
|
h("div", {
|
|
396
|
-
class:
|
|
396
|
+
class: L(["thumb", { dragging: X.value, [t.colour]: !0, [t.style]: !0 }])
|
|
397
397
|
}, null, 2)
|
|
398
398
|
], 34));
|
|
399
399
|
}
|
|
400
|
-
}, Wl = /* @__PURE__ */
|
|
400
|
+
}, Wl = /* @__PURE__ */ H(pU, [["__scopeId", "data-v-ab2e7b69"]]), yU = {
|
|
401
401
|
__name: "TitleText",
|
|
402
402
|
props: {
|
|
403
403
|
align: {
|
|
@@ -405,24 +405,24 @@ const j = (Z, l) => {
|
|
|
405
405
|
default: "left"
|
|
406
406
|
}
|
|
407
407
|
},
|
|
408
|
-
setup(
|
|
409
|
-
|
|
408
|
+
setup(t) {
|
|
409
|
+
Ul((V) => ({
|
|
410
410
|
"5fddb56d": Q.value
|
|
411
411
|
}));
|
|
412
|
-
const l =
|
|
413
|
-
return (V, a) => (
|
|
412
|
+
const l = f("el"), { width: U, height: F } = Fl(l), d = J(() => Math.min(U.value, F.value)), Z = J(() => U.value > F.value ? "h-text" : "v-text"), Q = J(() => d.value * 3 / 4 + "px");
|
|
413
|
+
return (V, a) => (N(), y("div", {
|
|
414
414
|
ref_key: "el",
|
|
415
415
|
ref: l,
|
|
416
416
|
class: "outer"
|
|
417
417
|
}, [
|
|
418
418
|
h("div", {
|
|
419
|
-
class:
|
|
419
|
+
class: L({ [Z.value]: !0, [t.align]: !0 })
|
|
420
420
|
}, [
|
|
421
|
-
|
|
421
|
+
Ql(V.$slots, "default", {}, void 0, !0)
|
|
422
422
|
], 2)
|
|
423
423
|
], 512));
|
|
424
424
|
}
|
|
425
|
-
}, Ol = /* @__PURE__ */
|
|
425
|
+
}, Ol = /* @__PURE__ */ H(yU, [["__scopeId", "data-v-3ce29e77"]]), YU = {
|
|
426
426
|
__name: "TriState",
|
|
427
427
|
props: {
|
|
428
428
|
mute: { default: !1 },
|
|
@@ -431,38 +431,38 @@ const j = (Z, l) => {
|
|
|
431
431
|
soloModifiers: {}
|
|
432
432
|
},
|
|
433
433
|
emits: ["update:mute", "update:solo"],
|
|
434
|
-
setup(
|
|
435
|
-
const l = $(
|
|
434
|
+
setup(t) {
|
|
435
|
+
const l = $(t, "mute"), U = $(t, "solo"), F = f("outer"), { width: d, height: Z } = Fl(F), Q = J(() => d.value > Z.value * 1.9);
|
|
436
436
|
function V() {
|
|
437
437
|
l.value = !l.value, U.value = !1;
|
|
438
438
|
}
|
|
439
439
|
function a() {
|
|
440
440
|
U.value = !U.value, l.value = !1;
|
|
441
441
|
}
|
|
442
|
-
return (n, R) => (
|
|
442
|
+
return (n, R) => (N(), y("div", {
|
|
443
443
|
class: "outer",
|
|
444
444
|
ref_key: "outer",
|
|
445
445
|
ref: F
|
|
446
446
|
}, [
|
|
447
447
|
h("div", {
|
|
448
|
-
class:
|
|
448
|
+
class: L(["solo", { on: U.value }]),
|
|
449
449
|
onClick: a
|
|
450
450
|
}, null, 2),
|
|
451
451
|
h("div", {
|
|
452
452
|
class: "s-label",
|
|
453
453
|
onClick: a
|
|
454
|
-
},
|
|
454
|
+
}, K(Q.value ? "SOLO" : "S"), 1),
|
|
455
455
|
h("div", {
|
|
456
|
-
class:
|
|
456
|
+
class: L(["mute", { on: l.value }]),
|
|
457
457
|
onClick: V
|
|
458
458
|
}, null, 2),
|
|
459
459
|
h("div", {
|
|
460
460
|
class: "m-label",
|
|
461
461
|
onClick: V
|
|
462
|
-
},
|
|
462
|
+
}, K(Q.value ? "MUTE" : "M"), 1)
|
|
463
463
|
], 512));
|
|
464
464
|
}
|
|
465
|
-
},
|
|
465
|
+
}, EU = /* @__PURE__ */ H(YU, [["__scopeId", "data-v-5eda54eb"]]), ol = {
|
|
466
466
|
// Enable development UI features (animations, random data, etc.)
|
|
467
467
|
enabled: !1,
|
|
468
468
|
// Specific feature flags
|
|
@@ -474,7 +474,7 @@ const j = (Z, l) => {
|
|
|
474
474
|
// Enable other debug/dev features as needed
|
|
475
475
|
debugMode: !1
|
|
476
476
|
}
|
|
477
|
-
}, KF = () => ol.enabled, Al = (
|
|
477
|
+
}, KF = () => ol.enabled, Al = (t) => ol.enabled && ol.features[t], dl = sl("audioState", {
|
|
478
478
|
state: () => ({
|
|
479
479
|
// Playback state
|
|
480
480
|
isPlaying: !1,
|
|
@@ -502,81 +502,81 @@ const j = (Z, l) => {
|
|
|
502
502
|
}),
|
|
503
503
|
getters: {
|
|
504
504
|
// Format current time as MM:SS
|
|
505
|
-
formattedTime: (
|
|
506
|
-
const l = Math.floor(
|
|
505
|
+
formattedTime: (t) => {
|
|
506
|
+
const l = Math.floor(t.currentTime / 60), U = Math.floor(t.currentTime % 60);
|
|
507
507
|
return `${l}:${U.toString().padStart(2, "0")}`;
|
|
508
508
|
},
|
|
509
509
|
// Get volume for a specific part
|
|
510
|
-
getPartVolume: (
|
|
510
|
+
getPartVolume: (t) => (l) => t.partVolumes[l] ?? 0.75,
|
|
511
511
|
// Check if part is muted
|
|
512
|
-
isPartMuted: (
|
|
512
|
+
isPartMuted: (t) => (l) => t.partMuted[l] ?? !1,
|
|
513
513
|
// Check if part is solo
|
|
514
|
-
isPartSolo: (
|
|
514
|
+
isPartSolo: (t) => (l) => t.partSolo[l] ?? !1,
|
|
515
515
|
// Check if any part has solo enabled (global solo state)
|
|
516
|
-
isAnySolo: (
|
|
516
|
+
isAnySolo: (t) => Object.values(t.partSolo).some((l) => l === !0),
|
|
517
517
|
// Current musical position as string
|
|
518
|
-
currentPosition: (
|
|
519
|
-
let l = `${
|
|
520
|
-
return
|
|
518
|
+
currentPosition: (t) => {
|
|
519
|
+
let l = `${t.currentBar}.${t.currentBeat}`;
|
|
520
|
+
return t.currentRepeat > 0 && (l += ` (R${t.currentRepeat})`), l;
|
|
521
521
|
}
|
|
522
522
|
},
|
|
523
523
|
actions: {
|
|
524
524
|
// Playback state updates
|
|
525
|
-
setPlaybackState(
|
|
526
|
-
this.isPlaying =
|
|
525
|
+
setPlaybackState(t) {
|
|
526
|
+
this.isPlaying = t;
|
|
527
527
|
},
|
|
528
|
-
setCurrentTime(
|
|
529
|
-
this.currentTime =
|
|
528
|
+
setCurrentTime(t) {
|
|
529
|
+
this.currentTime = t;
|
|
530
530
|
},
|
|
531
|
-
setPlaybackSpeed(
|
|
532
|
-
this.playbackSpeed =
|
|
531
|
+
setPlaybackSpeed(t) {
|
|
532
|
+
this.playbackSpeed = t;
|
|
533
533
|
},
|
|
534
534
|
// Musical position updates
|
|
535
|
-
setCurrentBar(
|
|
536
|
-
typeof
|
|
535
|
+
setCurrentBar(t, l = 1, U = 0) {
|
|
536
|
+
typeof t == "number" && (this.currentBar = t), typeof l == "number" && (this.currentBeat = l), typeof U == "number" && (this.currentRepeat = U);
|
|
537
537
|
},
|
|
538
538
|
// Volume controls
|
|
539
|
-
setMasterVolume(
|
|
540
|
-
this.masterVolume = Math.max(0, Math.min(1,
|
|
539
|
+
setMasterVolume(t) {
|
|
540
|
+
this.masterVolume = Math.max(0, Math.min(1, t));
|
|
541
541
|
},
|
|
542
|
-
setMetronomeVolume(
|
|
543
|
-
this.metronomeVolume = Math.max(0, Math.min(1,
|
|
542
|
+
setMetronomeVolume(t) {
|
|
543
|
+
this.metronomeVolume = Math.max(0, Math.min(1, t));
|
|
544
544
|
},
|
|
545
|
-
setPartVolume(
|
|
546
|
-
this.partVolumes[
|
|
545
|
+
setPartVolume(t, l) {
|
|
546
|
+
this.partVolumes[t] = Math.max(0, Math.min(1, l));
|
|
547
547
|
},
|
|
548
|
-
setPartMuted(
|
|
549
|
-
this.partMuted[
|
|
548
|
+
setPartMuted(t, l) {
|
|
549
|
+
this.partMuted[t] = l;
|
|
550
550
|
},
|
|
551
|
-
setPartSolo(
|
|
552
|
-
this.partSolo[
|
|
551
|
+
setPartSolo(t, l) {
|
|
552
|
+
this.partSolo[t] = l;
|
|
553
553
|
},
|
|
554
554
|
// Transport features
|
|
555
|
-
setLeadInActive(
|
|
556
|
-
this.isLeadInActive =
|
|
555
|
+
setLeadInActive(t, l = 1) {
|
|
556
|
+
this.isLeadInActive = t, this.leadInBars = l;
|
|
557
557
|
},
|
|
558
|
-
setStartingNotesActive(
|
|
559
|
-
this.isStartingNotesActive =
|
|
558
|
+
setStartingNotesActive(t) {
|
|
559
|
+
this.isStartingNotesActive = t;
|
|
560
560
|
},
|
|
561
561
|
// Feature toggles
|
|
562
|
-
setMetronomeEnabled(
|
|
563
|
-
this.metronomeEnabled =
|
|
562
|
+
setMetronomeEnabled(t) {
|
|
563
|
+
this.metronomeEnabled = t;
|
|
564
564
|
},
|
|
565
|
-
setLeadInEnabled(
|
|
566
|
-
this.leadInEnabled =
|
|
565
|
+
setLeadInEnabled(t) {
|
|
566
|
+
this.leadInEnabled = t;
|
|
567
567
|
},
|
|
568
568
|
// Initialize part states
|
|
569
|
-
initializeParts(
|
|
570
|
-
this.partVolumes = {}, this.partMuted = {}, this.partSolo = {},
|
|
569
|
+
initializeParts(t) {
|
|
570
|
+
this.partVolumes = {}, this.partMuted = {}, this.partSolo = {}, t.forEach((l) => {
|
|
571
571
|
this.partVolumes[l.name] = l.volume || 0.75, this.partMuted[l.name] = !1, this.partSolo[l.name] = !1;
|
|
572
572
|
});
|
|
573
573
|
},
|
|
574
574
|
// Initialization state (for blur overlay)
|
|
575
|
-
setLoaded(
|
|
576
|
-
this.isLoaded =
|
|
575
|
+
setLoaded(t) {
|
|
576
|
+
this.isLoaded = t;
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
}),
|
|
579
|
+
}), ll = sl("musicData", {
|
|
580
580
|
state: () => ({
|
|
581
581
|
// Musical structure
|
|
582
582
|
beats: [],
|
|
@@ -592,30 +592,30 @@ const j = (Z, l) => {
|
|
|
592
592
|
}),
|
|
593
593
|
getters: {
|
|
594
594
|
// Get practice mark letters as array
|
|
595
|
-
practiceMarkLetters: (
|
|
595
|
+
practiceMarkLetters: (t) => Object.keys(t.practiceMarks).sort(),
|
|
596
596
|
// Get bar number for practice mark
|
|
597
|
-
getBarForMark: (
|
|
597
|
+
getBarForMark: (t) => (l) => t.practiceMarks[l],
|
|
598
598
|
// Get all unique bar numbers
|
|
599
|
-
allBars: (
|
|
599
|
+
allBars: (t) => {
|
|
600
600
|
const l = /* @__PURE__ */ new Set();
|
|
601
|
-
return
|
|
601
|
+
return t.beats.forEach((U) => {
|
|
602
602
|
U.beat === 1 && l.add(U.bar);
|
|
603
603
|
}), Array.from(l).sort((U, F) => U - F);
|
|
604
604
|
},
|
|
605
605
|
// Check if a bar has repeats
|
|
606
|
-
hasRepeats: (
|
|
606
|
+
hasRepeats: (t) => (l) => t.beats.some((U) => U.bar === l && U.repeat > 0),
|
|
607
607
|
// Get the number of repeats for a specific bar
|
|
608
|
-
getRepeatCountForBar: (
|
|
608
|
+
getRepeatCountForBar: (t) => (l) => {
|
|
609
609
|
const U = /* @__PURE__ */ new Set();
|
|
610
|
-
return
|
|
610
|
+
return t.beats.forEach((F) => {
|
|
611
611
|
F.bar === l && U.add(F.repeat);
|
|
612
612
|
}), U.size;
|
|
613
613
|
}
|
|
614
614
|
},
|
|
615
615
|
actions: {
|
|
616
616
|
// Load musical data
|
|
617
|
-
loadMusicData(
|
|
618
|
-
this.title =
|
|
617
|
+
loadMusicData(t) {
|
|
618
|
+
this.title = t.title || "Untitled", this.beats = t.beats || [], this.practiceMarks = t.practiceMarks || t.marks || {}, this.parts = (t.parts || []).map((l) => ({
|
|
619
619
|
...l,
|
|
620
620
|
solo: l.solo || !1,
|
|
621
621
|
mute: l.mute || !1
|
|
@@ -623,38 +623,38 @@ const j = (Z, l) => {
|
|
|
623
623
|
},
|
|
624
624
|
// Calculate total duration from beats
|
|
625
625
|
calculateDuration() {
|
|
626
|
-
this.beats.length > 0 && (this.totalDuration = Math.max(...this.beats.map((
|
|
626
|
+
this.beats.length > 0 && (this.totalDuration = Math.max(...this.beats.map((t) => t.time)));
|
|
627
627
|
},
|
|
628
628
|
// Find the highest bar number
|
|
629
629
|
calculateMaxBar() {
|
|
630
|
-
this.beats.length > 0 && (this.maxBar = Math.max(...this.beats.map((
|
|
630
|
+
this.beats.length > 0 && (this.maxBar = Math.max(...this.beats.map((t) => t.bar)));
|
|
631
631
|
},
|
|
632
632
|
// Extract time signature from first beat
|
|
633
633
|
extractTimeSignature() {
|
|
634
634
|
this.beats.length > 0 && this.beats[0].timeSig && (this.timeSignature = this.beats[0].timeSig), this.beats.length > 0 && this.beats[0].tempo && (this.baseTempo = this.beats[0].tempo);
|
|
635
635
|
},
|
|
636
636
|
// Update practice marks
|
|
637
|
-
setPracticeMark(
|
|
638
|
-
this.practiceMarks[
|
|
637
|
+
setPracticeMark(t, l) {
|
|
638
|
+
this.practiceMarks[t] = l;
|
|
639
639
|
},
|
|
640
|
-
removePracticeMark(
|
|
641
|
-
delete this.practiceMarks[
|
|
640
|
+
removePracticeMark(t) {
|
|
641
|
+
delete this.practiceMarks[t];
|
|
642
642
|
},
|
|
643
643
|
// Update beats data (for when MIDI parser provides new beat information)
|
|
644
|
-
updateBeats(
|
|
645
|
-
console.log("Updating beats in music data store"), this.beats =
|
|
644
|
+
updateBeats(t) {
|
|
645
|
+
console.log("Updating beats in music data store"), this.beats = t, this.calculateDuration(), this.calculateMaxBar(), this.extractTimeSignature();
|
|
646
646
|
},
|
|
647
647
|
// Update total duration (for when audio engine provides actual duration)
|
|
648
|
-
setTotalDuration(
|
|
649
|
-
console.log("Setting total duration in music data store to:",
|
|
648
|
+
setTotalDuration(t) {
|
|
649
|
+
console.log("Setting total duration in music data store to:", t), this.totalDuration = t;
|
|
650
650
|
},
|
|
651
651
|
// Validate bar number
|
|
652
|
-
isValidBar(
|
|
653
|
-
return this.beats.some((U) => U.bar ===
|
|
652
|
+
isValidBar(t, l = 0) {
|
|
653
|
+
return this.beats.some((U) => U.bar === t && U.repeat === l);
|
|
654
654
|
},
|
|
655
655
|
// Update parts (for when audio engine discovers parts from MIDI)
|
|
656
|
-
setParts(
|
|
657
|
-
this.parts =
|
|
656
|
+
setParts(t) {
|
|
657
|
+
this.parts = t.map((l) => ({
|
|
658
658
|
name: l.name,
|
|
659
659
|
volume: l.volume || 0.75,
|
|
660
660
|
solo: l.solo || !1,
|
|
@@ -662,7 +662,7 @@ const j = (Z, l) => {
|
|
|
662
662
|
}));
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
|
-
}),
|
|
665
|
+
}), fl = sl("playbackState", {
|
|
666
666
|
state: () => ({
|
|
667
667
|
// Transport state
|
|
668
668
|
transportState: "stopped",
|
|
@@ -687,24 +687,36 @@ const j = (Z, l) => {
|
|
|
687
687
|
showNavigationControls: !0,
|
|
688
688
|
// Last positions for convenience
|
|
689
689
|
lastBarPosition: 1,
|
|
690
|
-
lastPracticeMarkUsed: null
|
|
690
|
+
lastPracticeMarkUsed: null,
|
|
691
|
+
// Navigation history
|
|
692
|
+
lastPlayStartBar: null,
|
|
693
|
+
lastPlayStartRepeat: null,
|
|
694
|
+
lastPlayStartTime: null,
|
|
695
|
+
lastNavigationAction: null,
|
|
696
|
+
// 'pause' | 'play' | 'manual' | null
|
|
697
|
+
// Fixed navigation points (computed once on load)
|
|
698
|
+
fixedNavigationPoints: [],
|
|
699
|
+
// Combined navigation points (recomputed when play start changes)
|
|
700
|
+
navigationPoints: []
|
|
691
701
|
}),
|
|
692
702
|
getters: {
|
|
693
703
|
// Check if currently playing
|
|
694
|
-
isPlaying: (
|
|
704
|
+
isPlaying: (t) => t.transportState === "playing",
|
|
695
705
|
// Check if paused
|
|
696
|
-
isPaused: (
|
|
706
|
+
isPaused: (t) => t.transportState === "paused",
|
|
697
707
|
// Check if stopped
|
|
698
|
-
isStopped: (
|
|
708
|
+
isStopped: (t) => t.transportState === "stopped",
|
|
699
709
|
// Check if loop is configured
|
|
700
|
-
isLoopConfigured: (
|
|
710
|
+
isLoopConfigured: (t) => t.loopEnabled && t.loopStart && t.loopEnd && t.loopEnd > t.loopStart,
|
|
701
711
|
// Get loop range as string
|
|
702
|
-
loopRange: (
|
|
712
|
+
loopRange: (t) => !t.loopEnabled || !t.loopStart || !t.loopEnd ? null : `${t.loopStart}-${t.loopEnd}`,
|
|
713
|
+
// Get navigation points list
|
|
714
|
+
getNavigationPoints: (t) => t.navigationPoints
|
|
703
715
|
},
|
|
704
716
|
actions: {
|
|
705
717
|
// Transport controls
|
|
706
|
-
setTransportState(
|
|
707
|
-
["stopped", "playing", "paused"].includes(
|
|
718
|
+
setTransportState(t) {
|
|
719
|
+
["stopped", "playing", "paused"].includes(t) && (this.transportState = t);
|
|
708
720
|
},
|
|
709
721
|
play() {
|
|
710
722
|
this.setTransportState("playing");
|
|
@@ -716,55 +728,98 @@ const j = (Z, l) => {
|
|
|
716
728
|
this.setTransportState("stopped");
|
|
717
729
|
},
|
|
718
730
|
// Navigation settings
|
|
719
|
-
setAutoPlay(
|
|
720
|
-
this.autoPlay =
|
|
731
|
+
setAutoPlay(t) {
|
|
732
|
+
this.autoPlay = t;
|
|
721
733
|
},
|
|
722
|
-
setLoop(
|
|
723
|
-
this.loopEnabled =
|
|
734
|
+
setLoop(t, l = null, U = null) {
|
|
735
|
+
this.loopEnabled = t, l !== null && (this.loopStart = l), U !== null && (this.loopEnd = U);
|
|
724
736
|
},
|
|
725
|
-
setLoopStart(
|
|
726
|
-
this.loopStart =
|
|
737
|
+
setLoopStart(t) {
|
|
738
|
+
this.loopStart = t, this.loopEnd && this.loopEnd <= t && (this.loopEnd = t + 4);
|
|
727
739
|
},
|
|
728
|
-
setLoopEnd(
|
|
729
|
-
this.loopEnd =
|
|
740
|
+
setLoopEnd(t) {
|
|
741
|
+
this.loopEnd = t, this.loopStart && this.loopStart >= t && (this.loopStart = Math.max(1, t - 4));
|
|
730
742
|
},
|
|
731
743
|
// Lead-in settings
|
|
732
|
-
setLeadInEnabled(
|
|
733
|
-
this.leadInEnabled =
|
|
744
|
+
setLeadInEnabled(t) {
|
|
745
|
+
this.leadInEnabled = t;
|
|
734
746
|
},
|
|
735
|
-
setLeadInBars(
|
|
736
|
-
this.leadInBars = Math.max(1, Math.min(4,
|
|
747
|
+
setLeadInBars(t) {
|
|
748
|
+
this.leadInBars = Math.max(1, Math.min(4, t));
|
|
737
749
|
},
|
|
738
750
|
// Starting notes settings
|
|
739
|
-
setStartingNotesEnabled(
|
|
740
|
-
this.startingNotesEnabled =
|
|
751
|
+
setStartingNotesEnabled(t) {
|
|
752
|
+
this.startingNotesEnabled = t;
|
|
741
753
|
},
|
|
742
|
-
setStartingNotesSequential(
|
|
743
|
-
this.startingNotesSequential =
|
|
754
|
+
setStartingNotesSequential(t) {
|
|
755
|
+
this.startingNotesSequential = t;
|
|
744
756
|
},
|
|
745
757
|
// Metronome settings
|
|
746
|
-
setMetronomeEnabled(
|
|
747
|
-
this.metronomeEnabled =
|
|
758
|
+
setMetronomeEnabled(t) {
|
|
759
|
+
this.metronomeEnabled = t;
|
|
748
760
|
},
|
|
749
|
-
setMetronomeVolume(
|
|
750
|
-
this.metronomeVolume = Math.max(0, Math.min(1,
|
|
761
|
+
setMetronomeVolume(t) {
|
|
762
|
+
this.metronomeVolume = Math.max(0, Math.min(1, t));
|
|
751
763
|
},
|
|
752
764
|
// UI visibility controls
|
|
753
|
-
setTransportControlsVisible(
|
|
754
|
-
this.showTransportControls =
|
|
765
|
+
setTransportControlsVisible(t) {
|
|
766
|
+
this.showTransportControls = t;
|
|
755
767
|
},
|
|
756
|
-
setPartControlsVisible(
|
|
757
|
-
this.showPartControls =
|
|
768
|
+
setPartControlsVisible(t) {
|
|
769
|
+
this.showPartControls = t;
|
|
758
770
|
},
|
|
759
|
-
setNavigationControlsVisible(
|
|
760
|
-
this.showNavigationControls =
|
|
771
|
+
setNavigationControlsVisible(t) {
|
|
772
|
+
this.showNavigationControls = t;
|
|
761
773
|
},
|
|
762
774
|
// Position tracking
|
|
763
|
-
updateLastBarPosition(
|
|
764
|
-
this.lastBarPosition =
|
|
775
|
+
updateLastBarPosition(t) {
|
|
776
|
+
this.lastBarPosition = t;
|
|
777
|
+
},
|
|
778
|
+
updateLastPracticeMarkUsed(t) {
|
|
779
|
+
this.lastPracticeMarkUsed = t;
|
|
780
|
+
},
|
|
781
|
+
// Navigation points management
|
|
782
|
+
buildFixedNavigationPoints() {
|
|
783
|
+
const t = [], l = ll();
|
|
784
|
+
t.push({ time: 0, bar: 1, repeat: 1, label: "Start" });
|
|
785
|
+
const U = l.beats.filter((F) => F.beat === 1);
|
|
786
|
+
for (const [F, d] of Object.entries(l.practiceMarks))
|
|
787
|
+
U.filter((Z) => Z.bar === d).forEach((Z) => {
|
|
788
|
+
t.push({
|
|
789
|
+
time: Z.time,
|
|
790
|
+
bar: Z.bar,
|
|
791
|
+
repeat: Z.repeat,
|
|
792
|
+
label: `Mark ${F}`
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
if (l.beats.length > 0) {
|
|
796
|
+
const F = Math.max(...l.beats.map((d) => d.time));
|
|
797
|
+
t.push({ time: F, label: "End" });
|
|
798
|
+
}
|
|
799
|
+
this.fixedNavigationPoints = t.sort((F, d) => F.time - d.time), this.navigationPoints = [...this.fixedNavigationPoints];
|
|
765
800
|
},
|
|
766
|
-
|
|
767
|
-
|
|
801
|
+
rebuildNavigationPoints() {
|
|
802
|
+
setTimeout(() => {
|
|
803
|
+
const t = ll(), l = [...this.fixedNavigationPoints];
|
|
804
|
+
this.lastPlayStartBar !== null && t.beats.filter((d) => d.beat === 1 && d.bar === this.lastPlayStartBar).forEach((d) => {
|
|
805
|
+
l.push({
|
|
806
|
+
time: d.time,
|
|
807
|
+
bar: d.bar,
|
|
808
|
+
repeat: d.repeat,
|
|
809
|
+
label: "Last Play Start"
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
const U = l.sort((F, d) => F.time - d.time);
|
|
813
|
+
this.navigationPoints = U.filter(
|
|
814
|
+
(F, d, Z) => d === 0 || F.time !== Z[d - 1].time
|
|
815
|
+
);
|
|
816
|
+
}, 50);
|
|
817
|
+
},
|
|
818
|
+
setLastPlayStart(t, l, U) {
|
|
819
|
+
this.lastPlayStartBar = t, this.lastPlayStartRepeat = l, this.lastPlayStartTime = U, this.rebuildNavigationPoints();
|
|
820
|
+
},
|
|
821
|
+
setNavigationAction(t) {
|
|
822
|
+
this.lastNavigationAction = t;
|
|
768
823
|
},
|
|
769
824
|
// Reset to defaults
|
|
770
825
|
resetToDefaults() {
|
|
@@ -772,34 +827,34 @@ const j = (Z, l) => {
|
|
|
772
827
|
}
|
|
773
828
|
}
|
|
774
829
|
});
|
|
775
|
-
function
|
|
776
|
-
return { all:
|
|
777
|
-
var F =
|
|
778
|
-
F ? F.push(U) :
|
|
830
|
+
function _l(t) {
|
|
831
|
+
return { all: t = t || /* @__PURE__ */ new Map(), on: function(l, U) {
|
|
832
|
+
var F = t.get(l);
|
|
833
|
+
F ? F.push(U) : t.set(l, [U]);
|
|
779
834
|
}, off: function(l, U) {
|
|
780
|
-
var F =
|
|
781
|
-
F && (U ? F.splice(F.indexOf(U) >>> 0, 1) :
|
|
835
|
+
var F = t.get(l);
|
|
836
|
+
F && (U ? F.splice(F.indexOf(U) >>> 0, 1) : t.set(l, []));
|
|
782
837
|
}, emit: function(l, U) {
|
|
783
|
-
var F =
|
|
838
|
+
var F = t.get(l);
|
|
784
839
|
F && F.slice().map(function(d) {
|
|
785
840
|
d(U);
|
|
786
|
-
}), (F =
|
|
841
|
+
}), (F = t.get("*")) && F.slice().map(function(d) {
|
|
787
842
|
d(l, U);
|
|
788
843
|
});
|
|
789
844
|
} };
|
|
790
845
|
}
|
|
791
|
-
function pl(
|
|
792
|
-
return { all:
|
|
793
|
-
var F =
|
|
794
|
-
F ? F.push(U) :
|
|
846
|
+
function pl(t) {
|
|
847
|
+
return { all: t = t || /* @__PURE__ */ new Map(), on: function(l, U) {
|
|
848
|
+
var F = t.get(l);
|
|
849
|
+
F ? F.push(U) : t.set(l, [U]);
|
|
795
850
|
}, off: function(l, U) {
|
|
796
|
-
var F =
|
|
797
|
-
F && (U ? F.splice(F.indexOf(U) >>> 0, 1) :
|
|
851
|
+
var F = t.get(l);
|
|
852
|
+
F && (U ? F.splice(F.indexOf(U) >>> 0, 1) : t.set(l, []));
|
|
798
853
|
}, emit: function(l, U) {
|
|
799
|
-
var F =
|
|
854
|
+
var F = t.get(l);
|
|
800
855
|
F && F.slice().map(function(d) {
|
|
801
856
|
d(U);
|
|
802
|
-
}), (F =
|
|
857
|
+
}), (F = t.get("*")) && F.slice().map(function(d) {
|
|
803
858
|
d(l, U);
|
|
804
859
|
});
|
|
805
860
|
} };
|
|
@@ -891,14 +946,14 @@ class Bl {
|
|
|
891
946
|
console.warn("Metronome buffer not available");
|
|
892
947
|
return;
|
|
893
948
|
}
|
|
894
|
-
const
|
|
895
|
-
|
|
949
|
+
const Z = this.audioContext.createBufferSource();
|
|
950
|
+
Z.buffer = d;
|
|
896
951
|
const Q = this.audioContext.createGain();
|
|
897
|
-
Q.gain.value = F,
|
|
952
|
+
Q.gain.value = F, Z.connect(Q);
|
|
898
953
|
const V = this.getMetronomeOutput();
|
|
899
954
|
V ? Q.connect(V) : Q.connect(this.audioContext.destination);
|
|
900
955
|
const a = Math.max(l, this.audioContext.currentTime);
|
|
901
|
-
|
|
956
|
+
Z.start(a);
|
|
902
957
|
} catch (d) {
|
|
903
958
|
console.warn("Buffer metronome playback failed:", d);
|
|
904
959
|
}
|
|
@@ -933,11 +988,11 @@ class Bl {
|
|
|
933
988
|
]), [F, d] = await Promise.all([
|
|
934
989
|
l.arrayBuffer(),
|
|
935
990
|
U.arrayBuffer()
|
|
936
|
-
]), [
|
|
991
|
+
]), [Z, Q] = await Promise.all([
|
|
937
992
|
this.audioContext.decodeAudioData(F),
|
|
938
993
|
this.audioContext.decodeAudioData(d)
|
|
939
994
|
]);
|
|
940
|
-
this.regularTickBuffer =
|
|
995
|
+
this.regularTickBuffer = Z, this.accentTickBuffer = Q;
|
|
941
996
|
return;
|
|
942
997
|
}
|
|
943
998
|
} catch (l) {
|
|
@@ -1030,15 +1085,15 @@ class il {
|
|
|
1030
1085
|
*/
|
|
1031
1086
|
playNote(l, U, F, d) {
|
|
1032
1087
|
this._validateActive();
|
|
1033
|
-
const
|
|
1088
|
+
const Z = this.engine.audioContext.currentTime, Q = `${this.partId}_${l}_${U}_${Date.now()}`;
|
|
1034
1089
|
let V = l, a = d;
|
|
1035
|
-
if (l <
|
|
1036
|
-
const c =
|
|
1037
|
-
V =
|
|
1090
|
+
if (l < Z) {
|
|
1091
|
+
const c = Z - l;
|
|
1092
|
+
V = Z, a = Math.max(0, d - c);
|
|
1038
1093
|
}
|
|
1039
1094
|
if (a <= 0)
|
|
1040
1095
|
return Q;
|
|
1041
|
-
const n = Math.max(0, (V -
|
|
1096
|
+
const n = Math.max(0, (V - Z) * 1e3), R = setTimeout(() => {
|
|
1042
1097
|
this.noteOn(U, F), this.scheduledEvents.delete(`${Q}_on`);
|
|
1043
1098
|
}, n), m = n + a * 1e3, e = setTimeout(() => {
|
|
1044
1099
|
this.noteOff(U), this.scheduledEvents.delete(`${Q}_off`);
|
|
@@ -1056,9 +1111,9 @@ class il {
|
|
|
1056
1111
|
*/
|
|
1057
1112
|
playPreviewNote(l, U = {}) {
|
|
1058
1113
|
this._validateActive();
|
|
1059
|
-
const F = U.startTime ?? this.engine.audioContext.currentTime + 0.01, d = U.duration ?? 0.5,
|
|
1114
|
+
const F = U.startTime ?? this.engine.audioContext.currentTime + 0.01, d = U.duration ?? 0.5, Z = U.velocity ?? 100;
|
|
1060
1115
|
let Q = null;
|
|
1061
|
-
U.instrument !== void 0 && (Q = this.getInstrument(), this.setInstrument(U.instrument)), this.playNote(F, l,
|
|
1116
|
+
U.instrument !== void 0 && (Q = this.getInstrument(), this.setInstrument(U.instrument)), this.playNote(F, l, Z, d), Q !== null && setTimeout(() => {
|
|
1062
1117
|
this.isDestroyed || this.setInstrument(Q);
|
|
1063
1118
|
}, (d + 0.1) * 1e3);
|
|
1064
1119
|
}
|
|
@@ -1154,7 +1209,7 @@ class il {
|
|
|
1154
1209
|
throw new Error("AudioEngine is not initialized");
|
|
1155
1210
|
}
|
|
1156
1211
|
}
|
|
1157
|
-
const
|
|
1212
|
+
const $l = {
|
|
1158
1213
|
// Piano family (0-7)
|
|
1159
1214
|
piano: 0,
|
|
1160
1215
|
bright_piano: 1,
|
|
@@ -1304,8 +1359,8 @@ const _l = {
|
|
|
1304
1359
|
helicopter: 125,
|
|
1305
1360
|
applause: 126,
|
|
1306
1361
|
gunshot: 127
|
|
1307
|
-
}, rU = Object.entries(
|
|
1308
|
-
class
|
|
1362
|
+
}, rU = Object.entries($l).reduce((t, [l, U]) => (t[U] = l, t), {});
|
|
1363
|
+
class lU {
|
|
1309
1364
|
/**
|
|
1310
1365
|
* Map common instrument names to MIDI program numbers
|
|
1311
1366
|
* @param {string|number} instrument - Instrument name or program number
|
|
@@ -1313,7 +1368,7 @@ class $l {
|
|
|
1313
1368
|
*/
|
|
1314
1369
|
static getInstrumentProgram(l) {
|
|
1315
1370
|
if (typeof l == "number") return l;
|
|
1316
|
-
const U =
|
|
1371
|
+
const U = $l[l.toLowerCase()];
|
|
1317
1372
|
return U !== void 0 ? U : 0;
|
|
1318
1373
|
}
|
|
1319
1374
|
/**
|
|
@@ -1366,7 +1421,7 @@ class LU extends il {
|
|
|
1366
1421
|
}
|
|
1367
1422
|
async setInstrument(l) {
|
|
1368
1423
|
this._validateActive();
|
|
1369
|
-
const U =
|
|
1424
|
+
const U = lU.getInstrumentProgram(l);
|
|
1370
1425
|
this.currentInstrument = l;
|
|
1371
1426
|
const F = this.engine._getSynthesizer();
|
|
1372
1427
|
F && F.programChange ? F.programChange(this.midiChannel, U) : console.warn("Cannot set instrument: synthesizer not available or no programChange method");
|
|
@@ -1406,7 +1461,7 @@ class LU extends il {
|
|
|
1406
1461
|
*/
|
|
1407
1462
|
playNote(l, U, F, d) {
|
|
1408
1463
|
this._validateActive();
|
|
1409
|
-
const
|
|
1464
|
+
const Z = `${this.partId}_${l}_${U}_${Date.now()}`, Q = this.engine._getSynthesizer();
|
|
1410
1465
|
if (Q && Q.post) {
|
|
1411
1466
|
const V = Math.round(F * this.currentVolume);
|
|
1412
1467
|
Q.post({
|
|
@@ -1436,7 +1491,7 @@ class LU extends il {
|
|
|
1436
1491
|
});
|
|
1437
1492
|
} else
|
|
1438
1493
|
return super.playNote(l, U, F, d);
|
|
1439
|
-
return
|
|
1494
|
+
return Z;
|
|
1440
1495
|
}
|
|
1441
1496
|
/**
|
|
1442
1497
|
* Override allNotesOff to use SpessaSynth messaging system
|
|
@@ -1607,11 +1662,11 @@ class xU extends Bl {
|
|
|
1607
1662
|
const F = U.headers.get("content-length"), d = F ? parseInt(F, 10) : null;
|
|
1608
1663
|
if (!d || !U.body)
|
|
1609
1664
|
return await U.arrayBuffer();
|
|
1610
|
-
const
|
|
1665
|
+
const Z = U.body.getReader();
|
|
1611
1666
|
let Q = 0;
|
|
1612
1667
|
const V = [];
|
|
1613
1668
|
for (; ; ) {
|
|
1614
|
-
const { done: R, value: m } = await
|
|
1669
|
+
const { done: R, value: m } = await Z.read();
|
|
1615
1670
|
if (R) break;
|
|
1616
1671
|
V.push(m), Q += m.length;
|
|
1617
1672
|
const e = Q / d, c = Math.round(e * 100);
|
|
@@ -1669,11 +1724,11 @@ class xU extends Bl {
|
|
|
1669
1724
|
*/
|
|
1670
1725
|
async playMetronomeTick(l, U, F) {
|
|
1671
1726
|
try {
|
|
1672
|
-
const d = this.getMetronomeChannel(),
|
|
1673
|
-
if (!d || !
|
|
1727
|
+
const d = this.getMetronomeChannel(), Z = this._getSynthesizer();
|
|
1728
|
+
if (!d || !Z)
|
|
1674
1729
|
return super.playMetronomeTick(l, U, F);
|
|
1675
1730
|
const Q = 15, V = U ? 86 : 60, a = Math.round(Math.min(127, Math.max(0, F * (U ? 127 : 100)))), n = this.audioContext.currentTime, R = Math.max(l, n), m = R - n;
|
|
1676
|
-
|
|
1731
|
+
Z.post ? (Z.post({
|
|
1677
1732
|
channelNumber: Q,
|
|
1678
1733
|
type: "midiMessage",
|
|
1679
1734
|
data: {
|
|
@@ -1685,7 +1740,7 @@ class xU extends Bl {
|
|
|
1685
1740
|
// Sample-accurate metronome timing!
|
|
1686
1741
|
}
|
|
1687
1742
|
}
|
|
1688
|
-
}),
|
|
1743
|
+
}), Z.post({
|
|
1689
1744
|
channelNumber: Q,
|
|
1690
1745
|
type: "midiMessage",
|
|
1691
1746
|
data: {
|
|
@@ -1697,11 +1752,11 @@ class xU extends Bl {
|
|
|
1697
1752
|
// Precise tick duration!
|
|
1698
1753
|
}
|
|
1699
1754
|
}
|
|
1700
|
-
})) : m <= 0.01 ? (
|
|
1701
|
-
|
|
1755
|
+
})) : m <= 0.01 ? (Z.noteOn && Z.noteOn(Q, V, a), setTimeout(() => {
|
|
1756
|
+
Z.noteOff && Z.noteOff(Q, V);
|
|
1702
1757
|
}, 100)) : setTimeout(() => {
|
|
1703
|
-
|
|
1704
|
-
|
|
1758
|
+
Z.noteOn && Z.noteOn(Q, V, a), setTimeout(() => {
|
|
1759
|
+
Z.noteOff && Z.noteOff(Q, V);
|
|
1705
1760
|
}, 100);
|
|
1706
1761
|
}, m * 1e3);
|
|
1707
1762
|
} catch (d) {
|
|
@@ -1759,13 +1814,13 @@ class MU extends il {
|
|
|
1759
1814
|
console.warn(`No samples available for instrument ${this.currentInstrument}`);
|
|
1760
1815
|
return;
|
|
1761
1816
|
}
|
|
1762
|
-
const d = this.engine._midiNoteToName(l),
|
|
1763
|
-
if (!
|
|
1817
|
+
const d = this.engine._midiNoteToName(l), Z = F.get(d);
|
|
1818
|
+
if (!Z) {
|
|
1764
1819
|
console.warn(`No sample found for note ${d} (pitch ${l})`);
|
|
1765
1820
|
return;
|
|
1766
1821
|
}
|
|
1767
1822
|
const Q = this.engine.audioContext.createBufferSource();
|
|
1768
|
-
Q.buffer =
|
|
1823
|
+
Q.buffer = Z, Q.loop = Z._shouldLoop || !1, Q.loop && (Q.loopStart = 0.4, Q.loopEnd = Z.duration);
|
|
1769
1824
|
const V = this.engine.audioContext.createGain(), a = U / 127;
|
|
1770
1825
|
V.gain.value = a * this.currentVolume, Q.connect(V), V.connect(this.outputGain), this.activeSources.has(l) || this.activeSources.set(l, /* @__PURE__ */ new Set()), this.activeSources.get(l).add(Q), Q.onended = () => {
|
|
1771
1826
|
V.disconnect();
|
|
@@ -1785,8 +1840,8 @@ class MU extends il {
|
|
|
1785
1840
|
if (F.loop)
|
|
1786
1841
|
F.stop();
|
|
1787
1842
|
else {
|
|
1788
|
-
const d = this.engine.audioContext.currentTime,
|
|
1789
|
-
|
|
1843
|
+
const d = this.engine.audioContext.currentTime, Z = F._velocityGain;
|
|
1844
|
+
Z && Z.gain.linearRampToValueAtTime(0, d + 0.05), F.stop(d + 0.05);
|
|
1790
1845
|
}
|
|
1791
1846
|
} catch {
|
|
1792
1847
|
}
|
|
@@ -1803,12 +1858,12 @@ class MU extends il {
|
|
|
1803
1858
|
const d = await this.engine._getTinySynth();
|
|
1804
1859
|
if (this.tinySynthChannel === null) {
|
|
1805
1860
|
this.tinySynthChannel = this._allocateTinySynthChannel(), d.setProgram(this.tinySynthChannel, this.currentInstrument);
|
|
1806
|
-
const
|
|
1807
|
-
d.setChVol(this.tinySynthChannel,
|
|
1861
|
+
const Z = Math.round(this.currentVolume * 127);
|
|
1862
|
+
d.setChVol(this.tinySynthChannel, Z);
|
|
1808
1863
|
}
|
|
1809
1864
|
if (F) {
|
|
1810
|
-
const
|
|
1811
|
-
d.noteOn(this.tinySynthChannel, l,
|
|
1865
|
+
const Z = Math.round(U * this.currentVolume);
|
|
1866
|
+
d.noteOn(this.tinySynthChannel, l, Z);
|
|
1812
1867
|
} else
|
|
1813
1868
|
d.noteOff(this.tinySynthChannel, l);
|
|
1814
1869
|
}
|
|
@@ -1829,7 +1884,7 @@ class MU extends il {
|
|
|
1829
1884
|
}
|
|
1830
1885
|
async setInstrument(l) {
|
|
1831
1886
|
this._validateActive();
|
|
1832
|
-
const U =
|
|
1887
|
+
const U = lU.getInstrumentProgram(l);
|
|
1833
1888
|
this.currentInstrument = U;
|
|
1834
1889
|
const F = this.engine._getSamplesForInstrument(U), d = this.synthMode;
|
|
1835
1890
|
this.synthMode = F ? "sample" : "synth", d !== this.synthMode && this.allNotesOff(), this.synthMode === "synth" && this.tinySynthChannel !== null && (await this.engine._getTinySynth()).setProgram(this.tinySynthChannel, U), console.log(`Channel ${this.partId}: Instrument ${l} (${U}) -> ${this.synthMode} mode`);
|
|
@@ -1894,14 +1949,14 @@ class KU extends Bl {
|
|
|
1894
1949
|
const d = await F.json();
|
|
1895
1950
|
if (!d || typeof d != "object")
|
|
1896
1951
|
throw new Error("Invalid sample data format");
|
|
1897
|
-
const
|
|
1952
|
+
const Z = /* @__PURE__ */ new Map(), Q = Object.keys(d);
|
|
1898
1953
|
for (let V = 0; V < Q.length; V++) {
|
|
1899
1954
|
const a = Q[V], n = d[a], R = await this._decodeBase64Audio(n, U);
|
|
1900
|
-
|
|
1955
|
+
Z.set(a, R);
|
|
1901
1956
|
const m = (V + 1) / Q.length;
|
|
1902
1957
|
this._emitProgress("loading-samples", `Loaded ${V + 1}/${Q.length} samples`, m);
|
|
1903
1958
|
}
|
|
1904
|
-
return
|
|
1959
|
+
return Z;
|
|
1905
1960
|
} catch (F) {
|
|
1906
1961
|
throw console.error("Failed to load sample file:", F), F;
|
|
1907
1962
|
}
|
|
@@ -1914,10 +1969,10 @@ class KU extends Bl {
|
|
|
1914
1969
|
* @private
|
|
1915
1970
|
*/
|
|
1916
1971
|
async _decodeBase64Audio(l, U) {
|
|
1917
|
-
const F = l.split(",")[1], d = atob(F),
|
|
1972
|
+
const F = l.split(",")[1], d = atob(F), Z = new Uint8Array(d.length);
|
|
1918
1973
|
for (let V = 0; V < d.length; V++)
|
|
1919
|
-
|
|
1920
|
-
const Q = await this.audioContext.decodeAudioData(
|
|
1974
|
+
Z[V] = d.charCodeAt(V);
|
|
1975
|
+
const Q = await this.audioContext.decodeAudioData(Z.buffer);
|
|
1921
1976
|
return Q._shouldLoop = U, Q;
|
|
1922
1977
|
}
|
|
1923
1978
|
/**
|
|
@@ -1927,12 +1982,12 @@ class KU extends Bl {
|
|
|
1927
1982
|
async _loadEmbeddedMetronomeSounds() {
|
|
1928
1983
|
try {
|
|
1929
1984
|
const l = atob(vU), U = new Uint8Array(l.length);
|
|
1930
|
-
for (let
|
|
1931
|
-
U[
|
|
1985
|
+
for (let Z = 0; Z < l.length; Z++)
|
|
1986
|
+
U[Z] = l.charCodeAt(Z);
|
|
1932
1987
|
this.regularTickBuffer = await this.audioContext.decodeAudioData(U.buffer);
|
|
1933
1988
|
const F = atob(gU), d = new Uint8Array(F.length);
|
|
1934
|
-
for (let
|
|
1935
|
-
d[
|
|
1989
|
+
for (let Z = 0; Z < F.length; Z++)
|
|
1990
|
+
d[Z] = F.charCodeAt(Z);
|
|
1936
1991
|
this.accentTickBuffer = await this.audioContext.decodeAudioData(d.buffer);
|
|
1937
1992
|
} catch (l) {
|
|
1938
1993
|
console.warn("Failed to load embedded metronome sounds:", l), this.regularTickBuffer = this.audioContext.createBuffer(2, 1024, this.audioContext.sampleRate), this.accentTickBuffer = this.audioContext.createBuffer(2, 1024, this.audioContext.sampleRate);
|
|
@@ -2097,8 +2152,8 @@ class HU {
|
|
|
2097
2152
|
for (const F of l) {
|
|
2098
2153
|
if (!F.name || !F.url)
|
|
2099
2154
|
continue;
|
|
2100
|
-
const d = F.name.toLowerCase(),
|
|
2101
|
-
|
|
2155
|
+
const d = F.name.toLowerCase(), Z = this._parseUrlParams(F.url), Q = {};
|
|
2156
|
+
Z.track !== void 0 && (Q.channel = parseInt(Z.track, 10)), Z.prog !== void 0 && (Q.instrument = parseInt(Z.prog, 10)), Q.channel !== void 0 && (U[d] = Q);
|
|
2102
2157
|
}
|
|
2103
2158
|
return U;
|
|
2104
2159
|
}
|
|
@@ -2113,8 +2168,8 @@ class HU {
|
|
|
2113
2168
|
if (F === -1)
|
|
2114
2169
|
return U;
|
|
2115
2170
|
const d = l.substring(F + 1).split("&");
|
|
2116
|
-
for (const
|
|
2117
|
-
const [Q, V] =
|
|
2171
|
+
for (const Z of d) {
|
|
2172
|
+
const [Q, V] = Z.split("=");
|
|
2118
2173
|
Q && V !== void 0 && (U[Q] = V);
|
|
2119
2174
|
}
|
|
2120
2175
|
return U;
|
|
@@ -2127,14 +2182,14 @@ class HU {
|
|
|
2127
2182
|
const U = new Uint8Array(l);
|
|
2128
2183
|
if (!(U[0] === 77 && U[1] === 84 && U[2] === 104 && U[3] === 100))
|
|
2129
2184
|
throw new Error("Not a valid MIDI file");
|
|
2130
|
-
const F = this._bytesToNumber(U.slice(4, 8)), d = this._bytesToNumber(U.slice(8, 10)),
|
|
2185
|
+
const F = this._bytesToNumber(U.slice(4, 8)), d = this._bytesToNumber(U.slice(8, 10)), Z = this._bytesToNumber(U.slice(10, 12)), Q = this._bytesToNumber(U.slice(12, 14)), V = Q & 32768 ? null : Q, a = {
|
|
2131
2186
|
format: d,
|
|
2132
2187
|
ticksPerBeat: V,
|
|
2133
2188
|
tracks: [],
|
|
2134
2189
|
duration: 0
|
|
2135
2190
|
};
|
|
2136
2191
|
let n = 8 + F;
|
|
2137
|
-
for (let R = 0; R <
|
|
2192
|
+
for (let R = 0; R < Z; R++)
|
|
2138
2193
|
if (U[n] === 77 && U[n + 1] === 84 && U[n + 2] === 114 && U[n + 3] === 107) {
|
|
2139
2194
|
const m = this._bytesToNumber(U.slice(n + 4, n + 8)), e = U.slice(n + 8, n + 8 + m), c = this._parseTrack(e);
|
|
2140
2195
|
a.tracks.push(c), n += 8 + m;
|
|
@@ -2154,7 +2209,7 @@ class HU {
|
|
|
2154
2209
|
events: [],
|
|
2155
2210
|
duration: 0
|
|
2156
2211
|
};
|
|
2157
|
-
let F = 0, d = 0,
|
|
2212
|
+
let F = 0, d = 0, Z = null;
|
|
2158
2213
|
for (; F < l.length; ) {
|
|
2159
2214
|
let Q = 0, V = 0;
|
|
2160
2215
|
do
|
|
@@ -2163,11 +2218,11 @@ class HU {
|
|
|
2163
2218
|
d += Q, V = l[F++];
|
|
2164
2219
|
let a = V;
|
|
2165
2220
|
if (V & 128)
|
|
2166
|
-
|
|
2221
|
+
Z = a;
|
|
2167
2222
|
else {
|
|
2168
|
-
if (
|
|
2223
|
+
if (Z === null)
|
|
2169
2224
|
throw new Error("Running status byte encountered before status byte");
|
|
2170
|
-
a =
|
|
2225
|
+
a = Z, F--;
|
|
2171
2226
|
}
|
|
2172
2227
|
if (a === 255) {
|
|
2173
2228
|
const n = l[F++], R = this._readVariableLengthValue(l, F);
|
|
@@ -2295,13 +2350,13 @@ class HU {
|
|
|
2295
2350
|
ticksPerBeat: l.ticksPerBeat
|
|
2296
2351
|
};
|
|
2297
2352
|
l.tracks.forEach((F, d) => {
|
|
2298
|
-
if (F.name && !U.title && (U.title = F.name), F.events.filter((
|
|
2299
|
-
const Q =
|
|
2300
|
-
(Q.includes("compos") || Q.includes("by")) && !U.composer && (U.composer =
|
|
2353
|
+
if (F.name && !U.title && (U.title = F.name), F.events.filter((Z) => Z.type === "text").forEach((Z) => {
|
|
2354
|
+
const Q = Z.text.toLowerCase();
|
|
2355
|
+
(Q.includes("compos") || Q.includes("by")) && !U.composer && (U.composer = Z.text);
|
|
2301
2356
|
}), F.name) {
|
|
2302
|
-
const
|
|
2357
|
+
const Z = F.name.toLowerCase();
|
|
2303
2358
|
for (const Q of this.partNames)
|
|
2304
|
-
if (
|
|
2359
|
+
if (Z.includes(Q)) {
|
|
2305
2360
|
U.partNames.push({
|
|
2306
2361
|
index: d,
|
|
2307
2362
|
name: F.name
|
|
@@ -2331,7 +2386,7 @@ class HU {
|
|
|
2331
2386
|
m.type === "noteOff" && m.tick > d && (d = m.tick);
|
|
2332
2387
|
});
|
|
2333
2388
|
}), d === 0 && (d = U * 8);
|
|
2334
|
-
const
|
|
2389
|
+
const Z = [], Q = F.filter((R) => R.type === "timeSignature").sort((R, m) => R.tick - m.tick);
|
|
2335
2390
|
let V = { numerator: 4, denominator: 4 }, a = 0, n = 0;
|
|
2336
2391
|
for (; a < d; ) {
|
|
2337
2392
|
for (; n < Q.length && Q[n].tick <= a; )
|
|
@@ -2339,16 +2394,16 @@ class HU {
|
|
|
2339
2394
|
let R;
|
|
2340
2395
|
R = a + U * 4 * V.numerator / V.denominator;
|
|
2341
2396
|
const m = V.numerator, e = [], c = U * (4 / V.denominator);
|
|
2342
|
-
for (let
|
|
2343
|
-
const
|
|
2344
|
-
e.push(
|
|
2397
|
+
for (let b = 0; b < m; b++) {
|
|
2398
|
+
const B = a + b * c, u = this._ticksToTime(B, l);
|
|
2399
|
+
e.push(u);
|
|
2345
2400
|
}
|
|
2346
|
-
|
|
2401
|
+
Z.push({
|
|
2347
2402
|
sig: [V.numerator, V.denominator],
|
|
2348
2403
|
beats: e
|
|
2349
2404
|
}), a = R;
|
|
2350
2405
|
}
|
|
2351
|
-
this.parsedData.barStructure =
|
|
2406
|
+
this.parsedData.barStructure = Z;
|
|
2352
2407
|
}
|
|
2353
2408
|
/**
|
|
2354
2409
|
* Extract notes for each voice part
|
|
@@ -2357,27 +2412,27 @@ class HU {
|
|
|
2357
2412
|
_extractParts(l) {
|
|
2358
2413
|
const U = {}, F = l.ticksPerBeat;
|
|
2359
2414
|
if (this.metadataOverrides.parts)
|
|
2360
|
-
for (const [d,
|
|
2361
|
-
if (
|
|
2362
|
-
if (
|
|
2415
|
+
for (const [d, Z] of Object.entries(this.metadataOverrides.parts)) {
|
|
2416
|
+
if (Z.channel !== void 0 && Z.channel !== null) {
|
|
2417
|
+
if (Z.channel === 15) {
|
|
2363
2418
|
console.error(`Part "${d}" uses channel 15 which is reserved for metronome. Skipping.`);
|
|
2364
2419
|
continue;
|
|
2365
2420
|
}
|
|
2366
|
-
if (
|
|
2367
|
-
console.error(`Part "${d}" has invalid channel ${
|
|
2421
|
+
if (Z.channel === 9 && console.warn(`Part "${d}" uses channel 9 (drums/percussion). This may not be appropriate for vocal parts.`), Z.channel < 0 || Z.channel > 15) {
|
|
2422
|
+
console.error(`Part "${d}" has invalid channel ${Z.channel}. MIDI channels must be 0-15. Skipping.`);
|
|
2368
2423
|
continue;
|
|
2369
2424
|
}
|
|
2370
2425
|
}
|
|
2371
|
-
if (
|
|
2426
|
+
if (Z.channel === void 0 && !Z.trackIndex && Z.trackIndex !== 0 && !Z.trackName)
|
|
2372
2427
|
continue;
|
|
2373
2428
|
let Q;
|
|
2374
|
-
if (
|
|
2375
|
-
if (Q = this._extractPartDataByChannel(
|
|
2376
|
-
console.warn(`Part "${d}" specified channel ${
|
|
2429
|
+
if (Z.channel !== void 0 && Z.channel !== null) {
|
|
2430
|
+
if (Q = this._extractPartDataByChannel(Z.channel, l, F), !Q || Q.notes.length === 0) {
|
|
2431
|
+
console.warn(`Part "${d}" specified channel ${Z.channel} but no notes found on that channel. Skipping.`);
|
|
2377
2432
|
continue;
|
|
2378
2433
|
}
|
|
2379
|
-
} else if (
|
|
2380
|
-
const V =
|
|
2434
|
+
} else if (Z.trackIndex !== void 0 && Z.trackIndex !== null) {
|
|
2435
|
+
const V = Z.trackIndex;
|
|
2381
2436
|
if (V >= 0 && V < l.tracks.length) {
|
|
2382
2437
|
const a = l.tracks[V];
|
|
2383
2438
|
Q = this._extractPartDataFromTrack(a, V, l, F);
|
|
@@ -2385,20 +2440,20 @@ class HU {
|
|
|
2385
2440
|
console.warn(`Part "${d}" specified trackIndex ${V} but track not found. Skipping.`);
|
|
2386
2441
|
continue;
|
|
2387
2442
|
}
|
|
2388
|
-
} else if (
|
|
2389
|
-
const V = l.tracks.findIndex((a) => a.name ===
|
|
2443
|
+
} else if (Z.trackName) {
|
|
2444
|
+
const V = l.tracks.findIndex((a) => a.name === Z.trackName);
|
|
2390
2445
|
if (V !== -1) {
|
|
2391
2446
|
const a = l.tracks[V];
|
|
2392
2447
|
Q = this._extractPartDataFromTrack(a, V, l, F);
|
|
2393
2448
|
} else {
|
|
2394
|
-
console.warn(`Part "${d}" specified trackName "${
|
|
2449
|
+
console.warn(`Part "${d}" specified trackName "${Z.trackName}" but track not found. Skipping.`);
|
|
2395
2450
|
continue;
|
|
2396
2451
|
}
|
|
2397
2452
|
}
|
|
2398
|
-
Q && (
|
|
2453
|
+
Q && (Z.instrument !== void 0 && Z.instrument !== null && (Q.defaultInstrument = this._resolveInstrument(Z.instrument), Q.programChanges = []), U[d] = Q);
|
|
2399
2454
|
}
|
|
2400
2455
|
else
|
|
2401
|
-
l.tracks.forEach((d,
|
|
2456
|
+
l.tracks.forEach((d, Z) => {
|
|
2402
2457
|
if (!d.notes.length) return;
|
|
2403
2458
|
let Q = null;
|
|
2404
2459
|
if (d.name) {
|
|
@@ -2414,11 +2469,11 @@ class HU {
|
|
|
2414
2469
|
break;
|
|
2415
2470
|
}
|
|
2416
2471
|
}
|
|
2417
|
-
Q || (Q = d.name || `Track ${
|
|
2472
|
+
Q || (Q = d.name || `Track ${Z + 1}`), Q === "s" && (Q = "soprano"), Q === "a" && (Q = "alto"), Q === "t" && (Q = "tenor"), Q === "b" && (Q = "bass");
|
|
2418
2473
|
let V = Q, a = 2;
|
|
2419
2474
|
for (; U[V]; )
|
|
2420
2475
|
V = `${Q} ${a}`, a++;
|
|
2421
|
-
Q = V, U[Q] = this._extractPartDataFromTrack(d,
|
|
2476
|
+
Q = V, U[Q] = this._extractPartDataFromTrack(d, Z, l, F);
|
|
2422
2477
|
});
|
|
2423
2478
|
this.parsedData.parts = U;
|
|
2424
2479
|
}
|
|
@@ -2427,7 +2482,7 @@ class HU {
|
|
|
2427
2482
|
* @private
|
|
2428
2483
|
*/
|
|
2429
2484
|
_extractPartDataByChannel(l, U, F) {
|
|
2430
|
-
const d = [],
|
|
2485
|
+
const d = [], Z = [], Q = [], V = [];
|
|
2431
2486
|
U.tracks.forEach((n, R) => {
|
|
2432
2487
|
const m = {};
|
|
2433
2488
|
n.notes.forEach((e) => {
|
|
@@ -2438,13 +2493,13 @@ class HU {
|
|
|
2438
2493
|
velocity: e.velocity
|
|
2439
2494
|
};
|
|
2440
2495
|
else if (e.type === "noteOff" && m[e.noteNumber]) {
|
|
2441
|
-
const c = m[e.noteNumber],
|
|
2496
|
+
const c = m[e.noteNumber], b = e.tick - c.tick;
|
|
2442
2497
|
d.push({
|
|
2443
2498
|
pitch: e.noteNumber,
|
|
2444
2499
|
name: this._midiNoteToName(e.noteNumber),
|
|
2445
2500
|
startTick: c.tick,
|
|
2446
2501
|
endTick: e.tick,
|
|
2447
|
-
duration:
|
|
2502
|
+
duration: b,
|
|
2448
2503
|
startTime: this._ticksToTime(c.tick, U),
|
|
2449
2504
|
endTime: this._ticksToTime(e.tick, U),
|
|
2450
2505
|
velocity: c.velocity,
|
|
@@ -2454,7 +2509,7 @@ class HU {
|
|
|
2454
2509
|
}
|
|
2455
2510
|
}
|
|
2456
2511
|
}), n.lyrics.forEach((e) => {
|
|
2457
|
-
|
|
2512
|
+
Z.push({
|
|
2458
2513
|
text: e.text,
|
|
2459
2514
|
tick: e.tick,
|
|
2460
2515
|
time: e.tick / F
|
|
@@ -2467,11 +2522,11 @@ class HU {
|
|
|
2467
2522
|
sourceTrackIndex: R
|
|
2468
2523
|
});
|
|
2469
2524
|
}), n.notes.some((e) => e.channel === l) && V.push(R);
|
|
2470
|
-
}), d.sort((n, R) => n.startTick - R.startTick),
|
|
2525
|
+
}), d.sort((n, R) => n.startTick - R.startTick), Z.sort((n, R) => n.tick - R.tick), Q.sort((n, R) => n.tick - R.tick);
|
|
2471
2526
|
const a = Q.length > 0 ? Q[0].programNumber : 0;
|
|
2472
2527
|
return {
|
|
2473
2528
|
notes: d,
|
|
2474
|
-
lyrics:
|
|
2529
|
+
lyrics: Z,
|
|
2475
2530
|
channel: l,
|
|
2476
2531
|
trackIndices: V,
|
|
2477
2532
|
// All track indices that contributed
|
|
@@ -2484,7 +2539,7 @@ class HU {
|
|
|
2484
2539
|
* @private
|
|
2485
2540
|
*/
|
|
2486
2541
|
_extractPartDataFromTrack(l, U, F, d) {
|
|
2487
|
-
const
|
|
2542
|
+
const Z = [], Q = {};
|
|
2488
2543
|
l.notes.forEach((R) => {
|
|
2489
2544
|
if (R.type === "noteOn")
|
|
2490
2545
|
Q[R.noteNumber] = {
|
|
@@ -2494,7 +2549,7 @@ class HU {
|
|
|
2494
2549
|
};
|
|
2495
2550
|
else if (R.type === "noteOff" && Q[R.noteNumber]) {
|
|
2496
2551
|
const m = Q[R.noteNumber], e = R.tick - m.tick;
|
|
2497
|
-
|
|
2552
|
+
Z.push({
|
|
2498
2553
|
pitch: R.noteNumber,
|
|
2499
2554
|
name: this._midiNoteToName(R.noteNumber),
|
|
2500
2555
|
startTick: m.tick,
|
|
@@ -2515,14 +2570,14 @@ class HU {
|
|
|
2515
2570
|
time: R.tick / d
|
|
2516
2571
|
// Time in quarter notes
|
|
2517
2572
|
}));
|
|
2518
|
-
|
|
2573
|
+
Z.sort((R, m) => R.startTick - m.startTick);
|
|
2519
2574
|
const a = l.events.filter((R) => R.type === "programChange").map((R) => ({
|
|
2520
2575
|
programNumber: R.programNumber,
|
|
2521
2576
|
tick: R.tick,
|
|
2522
2577
|
time: this._ticksToTime(R.tick, F)
|
|
2523
2578
|
})).sort((R, m) => R.tick - m.tick), n = a.length > 0 ? a[0].programNumber : 0;
|
|
2524
2579
|
return {
|
|
2525
|
-
notes:
|
|
2580
|
+
notes: Z,
|
|
2526
2581
|
lyrics: V,
|
|
2527
2582
|
trackIndex: U,
|
|
2528
2583
|
programChanges: a,
|
|
@@ -2584,11 +2639,11 @@ class HU {
|
|
|
2584
2639
|
* @private
|
|
2585
2640
|
*/
|
|
2586
2641
|
_readVariableLengthValue(l, U) {
|
|
2587
|
-
let F = 0, d,
|
|
2642
|
+
let F = 0, d, Z = 0;
|
|
2588
2643
|
do
|
|
2589
|
-
d = l[U +
|
|
2644
|
+
d = l[U + Z++], F = F << 7 | d & 127;
|
|
2590
2645
|
while (d & 128);
|
|
2591
|
-
return { value: F, bytesRead:
|
|
2646
|
+
return { value: F, bytesRead: Z };
|
|
2592
2647
|
}
|
|
2593
2648
|
/**
|
|
2594
2649
|
* Convert ticks to time in seconds considering tempo changes within bars
|
|
@@ -2601,20 +2656,20 @@ class HU {
|
|
|
2601
2656
|
n.type === "tempo" && d.push(n);
|
|
2602
2657
|
});
|
|
2603
2658
|
}), d.sort((a, n) => a.tick - n.tick);
|
|
2604
|
-
let
|
|
2659
|
+
let Z = 0, Q = 0, V = 120;
|
|
2605
2660
|
for (const a of d) {
|
|
2606
2661
|
if (a.tick > l) break;
|
|
2607
2662
|
if (a.tick > Q) {
|
|
2608
2663
|
const n = (a.tick - Q) / F * (60 / V);
|
|
2609
|
-
|
|
2664
|
+
Z += n, Q = a.tick;
|
|
2610
2665
|
}
|
|
2611
2666
|
V = a.bpm;
|
|
2612
2667
|
}
|
|
2613
2668
|
if (l > Q) {
|
|
2614
2669
|
const a = (l - Q) / F * (60 / V);
|
|
2615
|
-
|
|
2670
|
+
Z += a;
|
|
2616
2671
|
}
|
|
2617
|
-
return
|
|
2672
|
+
return Z;
|
|
2618
2673
|
}
|
|
2619
2674
|
}
|
|
2620
2675
|
class DU {
|
|
@@ -2642,18 +2697,18 @@ class DU {
|
|
|
2642
2697
|
*/
|
|
2643
2698
|
generateBarOrder(l, U) {
|
|
2644
2699
|
const F = [], d = {};
|
|
2645
|
-
for (const
|
|
2646
|
-
const Q = l[
|
|
2700
|
+
for (const Z of U) {
|
|
2701
|
+
const Q = l[Z.section];
|
|
2647
2702
|
if (!Q)
|
|
2648
|
-
throw new Error(`Invalid section index: ${
|
|
2649
|
-
const V =
|
|
2703
|
+
throw new Error(`Invalid section index: ${Z.section}`);
|
|
2704
|
+
const V = Z.section;
|
|
2650
2705
|
d[V] || (d[V] = 0), d[V]++;
|
|
2651
|
-
const a = d[V], n =
|
|
2706
|
+
const a = d[V], n = Z.from !== void 0 ? Z.from : this._getSectionStartBar(l, Z.section), R = Z.to !== void 0 ? Z.to : Q.to, m = Z.as || 1;
|
|
2652
2707
|
for (let e = n; e <= R; e++)
|
|
2653
2708
|
this._shouldPlayBar(Q, e, m) && F.push({
|
|
2654
2709
|
barNumber: e,
|
|
2655
2710
|
repeat: a,
|
|
2656
|
-
sectionIndex:
|
|
2711
|
+
sectionIndex: Z.section,
|
|
2657
2712
|
voltaTime: m
|
|
2658
2713
|
});
|
|
2659
2714
|
}
|
|
@@ -2667,13 +2722,13 @@ class DU {
|
|
|
2667
2722
|
*/
|
|
2668
2723
|
generateBarOrderFromLegacyBars(l, U) {
|
|
2669
2724
|
const F = [];
|
|
2670
|
-
let d = 1,
|
|
2725
|
+
let d = 1, Z = 0, Q;
|
|
2671
2726
|
for (const V of l) {
|
|
2672
|
-
V.from !== void 0 && (d = V.from === -1 ? 0 : V.from,
|
|
2727
|
+
V.from !== void 0 && (d = V.from === -1 ? 0 : V.from, Z = 0), V.timeSig !== void 0 && (Q = V.timeSig);
|
|
2673
2728
|
const a = V.repeat || 1;
|
|
2674
2729
|
let n = V.beats;
|
|
2675
2730
|
for (; n > 0; ) {
|
|
2676
|
-
const R = (Q !== void 0 ? Q : this._getBeatsPerBar(d, U)) -
|
|
2731
|
+
const R = (Q !== void 0 ? Q : this._getBeatsPerBar(d, U)) - Z;
|
|
2677
2732
|
n >= R ? (F.push({
|
|
2678
2733
|
barNumber: d,
|
|
2679
2734
|
repeat: a,
|
|
@@ -2681,10 +2736,10 @@ class DU {
|
|
|
2681
2736
|
// Legacy format doesn't have sections
|
|
2682
2737
|
voltaTime: 1
|
|
2683
2738
|
// Legacy format doesn't have voltas
|
|
2684
|
-
}), n -= R,
|
|
2739
|
+
}), n -= R, Z = 0, d === 0 ? d = 1 : d++) : (Z += n, n = 0);
|
|
2685
2740
|
}
|
|
2686
2741
|
}
|
|
2687
|
-
return
|
|
2742
|
+
return Z > 0 && F.push({
|
|
2688
2743
|
barNumber: d,
|
|
2689
2744
|
repeat: 1,
|
|
2690
2745
|
sectionIndex: 0,
|
|
@@ -2718,8 +2773,8 @@ class DU {
|
|
|
2718
2773
|
let d;
|
|
2719
2774
|
if (F ? d = l : d = l - 1, d < 0 || d >= U.length)
|
|
2720
2775
|
return 4;
|
|
2721
|
-
const
|
|
2722
|
-
return
|
|
2776
|
+
const Z = U[d];
|
|
2777
|
+
return Z.sig ? Z.sig[0] : 4;
|
|
2723
2778
|
}
|
|
2724
2779
|
/**
|
|
2725
2780
|
* Generate beat table from bar order and MIDI bar structure
|
|
@@ -2730,44 +2785,44 @@ class DU {
|
|
|
2730
2785
|
*/
|
|
2731
2786
|
generateBeatTable(l, U) {
|
|
2732
2787
|
const F = [], d = {};
|
|
2733
|
-
let
|
|
2788
|
+
let Z = 0, Q = 0;
|
|
2734
2789
|
const V = [...U];
|
|
2735
|
-
for (; Q < l.length &&
|
|
2790
|
+
for (; Q < l.length && Z < V.length; ) {
|
|
2736
2791
|
const a = l[Q], n = a.barNumber;
|
|
2737
2792
|
if (d[n] === void 0) {
|
|
2738
|
-
const c = V[
|
|
2793
|
+
const c = V[Z];
|
|
2739
2794
|
if (!c || !c.sig)
|
|
2740
|
-
throw new Error(`Invalid MIDI bar structure at index ${
|
|
2795
|
+
throw new Error(`Invalid MIDI bar structure at index ${Z}`);
|
|
2741
2796
|
d[n] = c.sig[0];
|
|
2742
2797
|
}
|
|
2743
2798
|
const R = d[n];
|
|
2744
|
-
let m = V[
|
|
2745
|
-
for (; e < R &&
|
|
2746
|
-
const c = V[
|
|
2799
|
+
let m = V[Z], e = m.sig[0];
|
|
2800
|
+
for (; e < R && Z + 1 < V.length; ) {
|
|
2801
|
+
const c = V[Z + 1], b = [
|
|
2747
2802
|
m.sig[0] + c.sig[0],
|
|
2748
2803
|
// Total beats
|
|
2749
2804
|
m.sig[1]
|
|
2750
2805
|
// Keep original note value
|
|
2751
|
-
],
|
|
2806
|
+
], B = [
|
|
2752
2807
|
...m.beats || [],
|
|
2753
2808
|
...c.beats || []
|
|
2754
2809
|
];
|
|
2755
2810
|
m = {
|
|
2756
|
-
sig:
|
|
2757
|
-
beats:
|
|
2758
|
-
}, V[
|
|
2811
|
+
sig: b,
|
|
2812
|
+
beats: B
|
|
2813
|
+
}, V[Z] = m, V.splice(Z + 1, 1), e = b[0];
|
|
2759
2814
|
}
|
|
2760
2815
|
if (e > R) {
|
|
2761
|
-
const c = R,
|
|
2816
|
+
const c = R, b = e - R, B = m.beats ? m.beats.slice(0, c) : [], u = m.beats ? m.beats.slice(c) : [], X = {
|
|
2762
2817
|
sig: [c, m.sig[1]],
|
|
2763
|
-
beats: u
|
|
2764
|
-
}, T = {
|
|
2765
|
-
sig: [s, m.sig[1]],
|
|
2766
2818
|
beats: B
|
|
2819
|
+
}, E = {
|
|
2820
|
+
sig: [b, m.sig[1]],
|
|
2821
|
+
beats: u
|
|
2767
2822
|
};
|
|
2768
|
-
V[
|
|
2823
|
+
V[Z] = X, V.splice(Z + 1, 0, E), m = X;
|
|
2769
2824
|
}
|
|
2770
|
-
this._generateBeatsForBar(F, a, m, R),
|
|
2825
|
+
this._generateBeatsForBar(F, a, m, R), Z++, Q++;
|
|
2771
2826
|
}
|
|
2772
2827
|
if (Q < l.length) {
|
|
2773
2828
|
const a = F.length > 0 ? F[F.length - 1] : null;
|
|
@@ -2780,15 +2835,15 @@ class DU {
|
|
|
2780
2835
|
for (; Q < l.length; ) {
|
|
2781
2836
|
const m = l[Q], e = m.barNumber, c = d[e] !== void 0 ? d[e] : 4;
|
|
2782
2837
|
d[e] === void 0 && (d[e] = c);
|
|
2783
|
-
const
|
|
2784
|
-
for (let
|
|
2785
|
-
|
|
2786
|
-
const
|
|
2838
|
+
const b = [];
|
|
2839
|
+
for (let u = 0; u < c; u++)
|
|
2840
|
+
b.push(R), R += n;
|
|
2841
|
+
const B = {
|
|
2787
2842
|
sig: [c, 4],
|
|
2788
2843
|
// Default to quarter notes
|
|
2789
|
-
beats:
|
|
2844
|
+
beats: b
|
|
2790
2845
|
};
|
|
2791
|
-
this._generateBeatsForBar(F, m,
|
|
2846
|
+
this._generateBeatsForBar(F, m, B, c), Q++;
|
|
2792
2847
|
}
|
|
2793
2848
|
}
|
|
2794
2849
|
return F;
|
|
@@ -2798,10 +2853,10 @@ class DU {
|
|
|
2798
2853
|
* @private
|
|
2799
2854
|
*/
|
|
2800
2855
|
_generateBeatsForBar(l, U, F, d) {
|
|
2801
|
-
const { beats:
|
|
2802
|
-
if (!
|
|
2856
|
+
const { beats: Z } = F;
|
|
2857
|
+
if (!Z || !Array.isArray(Z))
|
|
2803
2858
|
throw new Error(`Invalid MIDI bar: missing beats array. Got: ${JSON.stringify(F)}`);
|
|
2804
|
-
const Q =
|
|
2859
|
+
const Q = Z.slice(0, d);
|
|
2805
2860
|
for (let V = 1; V <= d; V++) {
|
|
2806
2861
|
const a = {
|
|
2807
2862
|
time: Q[V - 1],
|
|
@@ -2843,8 +2898,8 @@ class Jl {
|
|
|
2843
2898
|
if (!U)
|
|
2844
2899
|
throw new Error("Parsed MIDI data is required");
|
|
2845
2900
|
this.audioEngine = l, this._audioEngineReady = !!(l && l.isInitialized), this.instrumentMap = F || {}, this.parsedData = U, this._isPlaying = !1, this._currentTime = 0, this._totalDuration = 0, this.playbackSpeed = 1, this.partChannels = /* @__PURE__ */ new Map(), this.partOutputs = /* @__PURE__ */ new Map(), this.playbackStartTime = 0, this.lookAheadTime = 0.05, this.scheduleInterval = null, this.partNotePointers = /* @__PURE__ */ new Map(), this.partProgramPointers = /* @__PURE__ */ new Map(), this.eventBus = pl(), this.beatMapper = new DU(), this.beats = [], this.structureMetadata = d, this._calculateTotalDuration();
|
|
2846
|
-
const
|
|
2847
|
-
this.beats = this.beatMapper.mapBeats(U,
|
|
2901
|
+
const Z = d || this._createDefaultStructureMetadata();
|
|
2902
|
+
this.beats = this.beatMapper.mapBeats(U, Z), this._audioEngineReady && (this._setupPartChannels(), this._resetNotePointers(), this._resetProgramPointers());
|
|
2848
2903
|
}
|
|
2849
2904
|
// ========================================
|
|
2850
2905
|
// PUBLIC API - Initialization Methods
|
|
@@ -3028,8 +3083,8 @@ class Jl {
|
|
|
3028
3083
|
*/
|
|
3029
3084
|
getAllNextNotes(l) {
|
|
3030
3085
|
const U = l ?? this.getCurrentTime(), F = {};
|
|
3031
|
-
for (const [d,
|
|
3032
|
-
const Q =
|
|
3086
|
+
for (const [d, Z] of Object.entries(this.parsedData.parts)) {
|
|
3087
|
+
const Q = Z.notes.find((V) => V.startTime >= U);
|
|
3033
3088
|
F[d] = Q ? {
|
|
3034
3089
|
pitch: Q.pitch,
|
|
3035
3090
|
startTime: Q.startTime
|
|
@@ -3073,17 +3128,17 @@ class Jl {
|
|
|
3073
3128
|
Object.keys(this.parsedData.parts).forEach((l) => {
|
|
3074
3129
|
const U = this.parsedData.parts[l], F = this.instrumentMap[l] || {}, d = F.instrument !== void 0 ? F.instrument : U.defaultInstrument !== void 0 ? U.defaultInstrument : 0;
|
|
3075
3130
|
try {
|
|
3076
|
-
const
|
|
3131
|
+
const Z = this.audioEngine.createChannel(l, {
|
|
3077
3132
|
instrument: d,
|
|
3078
3133
|
initialVolume: F.volume || 1
|
|
3079
3134
|
});
|
|
3080
|
-
this.partChannels.set(l,
|
|
3135
|
+
this.partChannels.set(l, Z);
|
|
3081
3136
|
const Q = this.audioEngine.audioContext.createGain();
|
|
3082
3137
|
Q.gain.value = 1;
|
|
3083
|
-
const V =
|
|
3138
|
+
const V = Z.getOutputNode();
|
|
3084
3139
|
V && V.connect(Q), this.partOutputs.set(l, Q);
|
|
3085
|
-
} catch (
|
|
3086
|
-
console.error(`Failed to create channel for part '${l}':`,
|
|
3140
|
+
} catch (Z) {
|
|
3141
|
+
console.error(`Failed to create channel for part '${l}':`, Z), this._emitEvent("error", Z);
|
|
3087
3142
|
}
|
|
3088
3143
|
});
|
|
3089
3144
|
}
|
|
@@ -3115,11 +3170,11 @@ class Jl {
|
|
|
3115
3170
|
if (!this._isPlaying) return;
|
|
3116
3171
|
const l = (this.audioEngine.audioContext.currentTime - this.playbackStartTime) * this.playbackSpeed, U = l + this.lookAheadTime;
|
|
3117
3172
|
for (const [F, d] of this.partChannels) {
|
|
3118
|
-
const
|
|
3119
|
-
if (
|
|
3120
|
-
if (
|
|
3173
|
+
const Z = this.parsedData.parts[F];
|
|
3174
|
+
if (Z) {
|
|
3175
|
+
if (Z.programChanges && Z.programChanges.length > 0) {
|
|
3121
3176
|
let Q = this.partProgramPointers.get(F) || 0;
|
|
3122
|
-
const V =
|
|
3177
|
+
const V = Z.programChanges;
|
|
3123
3178
|
for (; Q < V.length && V[Q].time < l; )
|
|
3124
3179
|
Q++;
|
|
3125
3180
|
for (; Q < V.length && V[Q].time <= U; ) {
|
|
@@ -3128,9 +3183,9 @@ class Jl {
|
|
|
3128
3183
|
}
|
|
3129
3184
|
this.partProgramPointers.set(F, Q);
|
|
3130
3185
|
}
|
|
3131
|
-
if (
|
|
3186
|
+
if (Z.notes) {
|
|
3132
3187
|
let Q = this.partNotePointers.get(F) || 0;
|
|
3133
|
-
const V =
|
|
3188
|
+
const V = Z.notes;
|
|
3134
3189
|
for (; Q < V.length && V[Q].endTime < l; )
|
|
3135
3190
|
Q++;
|
|
3136
3191
|
for (; Q < V.length && V[Q].startTime <= U; ) {
|
|
@@ -3174,10 +3229,10 @@ class Jl {
|
|
|
3174
3229
|
this.partProgramPointers.set(U, 0);
|
|
3175
3230
|
continue;
|
|
3176
3231
|
}
|
|
3177
|
-
let
|
|
3178
|
-
for (;
|
|
3179
|
-
Q = d.programChanges[
|
|
3180
|
-
F.setInstrument(Q), this.partProgramPointers.set(U,
|
|
3232
|
+
let Z = 0, Q = d.defaultInstrument;
|
|
3233
|
+
for (; Z < d.programChanges.length && d.programChanges[Z].time <= l; )
|
|
3234
|
+
Q = d.programChanges[Z].programNumber, Z++;
|
|
3235
|
+
F.setInstrument(Q), this.partProgramPointers.set(U, Z);
|
|
3181
3236
|
}
|
|
3182
3237
|
}
|
|
3183
3238
|
/**
|
|
@@ -3628,7 +3683,7 @@ class jU {
|
|
|
3628
3683
|
throw new Error("Audio engine not ready. Call setAudioEngine() first.");
|
|
3629
3684
|
if (this.isCalibrating)
|
|
3630
3685
|
throw new Error("Calibration already in progress");
|
|
3631
|
-
const U = l.measurements || 5, F = l.sampleIntervalMs || 10, d = l.threshold || 0.01,
|
|
3686
|
+
const U = l.measurements || 5, F = l.sampleIntervalMs || 10, d = l.threshold || 0.01, Z = l.timeout || 3e3, Q = l.silent !== void 0 ? l.silent : !0, V = l.updateBaseline !== void 0 ? l.updateBaseline : !0;
|
|
3632
3687
|
this.isCalibrating = !0;
|
|
3633
3688
|
try {
|
|
3634
3689
|
Q && await this._setupSilentCalibration();
|
|
@@ -3636,7 +3691,7 @@ class jU {
|
|
|
3636
3691
|
U,
|
|
3637
3692
|
F,
|
|
3638
3693
|
d,
|
|
3639
|
-
|
|
3694
|
+
Z
|
|
3640
3695
|
);
|
|
3641
3696
|
this.measuredLatencyMs = a, V && await this._updateBaselineLatency(a);
|
|
3642
3697
|
const n = this.hasLatencyDrift();
|
|
@@ -3745,11 +3800,11 @@ class jU {
|
|
|
3745
3800
|
previewNextNotes(l = {}) {
|
|
3746
3801
|
if (!this.midiPlayer)
|
|
3747
3802
|
throw new Error("No MIDI data loaded");
|
|
3748
|
-
const U = l.delayBetweenParts ?? 0.3, F = l.duration ?? 0.5, d = l.velocity ?? 100,
|
|
3803
|
+
const U = l.delayBetweenParts ?? 0.3, F = l.duration ?? 0.5, d = l.velocity ?? 100, Z = this.midiPlayer.getAllNextNotes(), Q = l.partOrder ?? this.getPartNames();
|
|
3749
3804
|
let V = this.audioEngine.audioContext.currentTime + 0.01;
|
|
3750
3805
|
const a = [];
|
|
3751
3806
|
for (const n of Q) {
|
|
3752
|
-
const R =
|
|
3807
|
+
const R = Z[n];
|
|
3753
3808
|
if (!R) continue;
|
|
3754
3809
|
const m = this.midiPlayer.getPartChannel(n);
|
|
3755
3810
|
if (!m) continue;
|
|
@@ -3886,11 +3941,11 @@ class jU {
|
|
|
3886
3941
|
startBeat: { bar: 1, beat: 1, timeSig: 4 }
|
|
3887
3942
|
};
|
|
3888
3943
|
const l = this.midiPlayer.beats, U = this.frozenTime, F = this.leadInConfig.bars;
|
|
3889
|
-
let d = l.length - 1,
|
|
3944
|
+
let d = l.length - 1, Z = 0.5;
|
|
3890
3945
|
for (; l[d].time > U; ) d--;
|
|
3891
3946
|
const Q = l[d], V = l[d + 1];
|
|
3892
|
-
V ?
|
|
3893
|
-
const a = this.midiPlayer && this.midiPlayer.playbackSpeed || 1, n =
|
|
3947
|
+
V ? Z = V.time - Q.time : d > 0 && (Z = Q.time - l[d - 1].time);
|
|
3948
|
+
const a = this.midiPlayer && this.midiPlayer.playbackSpeed || 1, n = Z / a, R = Q.timeSig === 1, m = R && V ? V.timeSig : Q.timeSig, e = R ? m - 1 : Q.beat > 1 ? Q.beat - 1 : 0, c = F * m + e;
|
|
3894
3949
|
return {
|
|
3895
3950
|
totalBeats: c,
|
|
3896
3951
|
duration: c * n,
|
|
@@ -3909,14 +3964,14 @@ class jU {
|
|
|
3909
3964
|
*/
|
|
3910
3965
|
_generateBeatSequence(l, U, F) {
|
|
3911
3966
|
const d = [];
|
|
3912
|
-
for (let
|
|
3913
|
-
const Q =
|
|
3967
|
+
for (let Z = 0; Z < l; Z++) {
|
|
3968
|
+
const Q = Z % F + 1;
|
|
3914
3969
|
d.push({
|
|
3915
3970
|
beat: Q,
|
|
3916
3971
|
isAccent: Q === 1,
|
|
3917
|
-
time:
|
|
3972
|
+
time: Z * U,
|
|
3918
3973
|
// Relative time from start of lead-in playback
|
|
3919
|
-
absoluteTime: this.leadInStartTime +
|
|
3974
|
+
absoluteTime: this.leadInStartTime + Z * U
|
|
3920
3975
|
// Absolute time (includes startup delay)
|
|
3921
3976
|
});
|
|
3922
3977
|
}
|
|
@@ -3933,7 +3988,7 @@ class jU {
|
|
|
3933
3988
|
this.leadInStartTime = this.audioEngine.audioContext.currentTime, this.leadInInterval = setInterval(() => {
|
|
3934
3989
|
const d = this.audioEngine.audioContext.currentTime - this.leadInStartTime;
|
|
3935
3990
|
for (this.leadInProgress = Math.min(1, d / this.leadInData.duration); this.leadInBeatIndex < U.length; ) {
|
|
3936
|
-
const
|
|
3991
|
+
const Z = U[this.leadInBeatIndex], Q = Z.time - d;
|
|
3937
3992
|
if (Q > 0.05)
|
|
3938
3993
|
break;
|
|
3939
3994
|
if (!this.leadInScheduledBeats.has(this.leadInBeatIndex) && Q >= -0.05 && Q <= 0.05) {
|
|
@@ -3941,10 +3996,10 @@ class jU {
|
|
|
3941
3996
|
// Add small offset for immediate beats
|
|
3942
3997
|
this.audioEngine.audioContext.currentTime + Q
|
|
3943
3998
|
);
|
|
3944
|
-
this._scheduleTickAtTime(V,
|
|
3999
|
+
this._scheduleTickAtTime(V, Z.isAccent);
|
|
3945
4000
|
const a = {
|
|
3946
4001
|
bar: Math.floor(this.leadInBeatIndex / this.leadInData.beatsPerBar) + 1,
|
|
3947
|
-
beat:
|
|
4002
|
+
beat: Z.beat,
|
|
3948
4003
|
repeat: 1,
|
|
3949
4004
|
time: this.frozenTime,
|
|
3950
4005
|
isLeadIn: !0
|
|
@@ -3993,8 +4048,8 @@ class jU {
|
|
|
3993
4048
|
if (this.state === "playing")
|
|
3994
4049
|
try {
|
|
3995
4050
|
this.midiPlayer.play(), l && this._startMetronome();
|
|
3996
|
-
} catch (
|
|
3997
|
-
this.state = "stopped", this._emitEvent("error",
|
|
4051
|
+
} catch (Z) {
|
|
4052
|
+
this.state = "stopped", this._emitEvent("error", Z);
|
|
3998
4053
|
}
|
|
3999
4054
|
};
|
|
4000
4055
|
F ? d() : setTimeout(d, this.startupConfig.delayMs), this.timeUpdateInterval || this._startTimeUpdateLoop();
|
|
@@ -4037,13 +4092,13 @@ class jU {
|
|
|
4037
4092
|
if (!U || U.length === 0)
|
|
4038
4093
|
return;
|
|
4039
4094
|
const F = this.midiPlayer.getCurrentTime(), d = 0.1;
|
|
4040
|
-
for (let
|
|
4041
|
-
const Q = U[
|
|
4095
|
+
for (let Z = this.nextBeatIndex; Z < U.length; Z++) {
|
|
4096
|
+
const Q = U[Z], V = this.midiPlayer.playbackSpeed || 1, a = l + (Q.time - F) / V;
|
|
4042
4097
|
if (a > this.audioEngine.audioContext.currentTime + d)
|
|
4043
4098
|
break;
|
|
4044
4099
|
if (a >= this.audioEngine.audioContext.currentTime - 0.01) {
|
|
4045
4100
|
const n = Math.max(a, this.audioEngine.audioContext.currentTime + 1e-3), R = Q.isDownbeat || Q.beat === 1;
|
|
4046
|
-
this._scheduleTickAtTime(n, R), this.nextBeatIndex =
|
|
4101
|
+
this._scheduleTickAtTime(n, R), this.nextBeatIndex = Z + 1;
|
|
4047
4102
|
}
|
|
4048
4103
|
}
|
|
4049
4104
|
}
|
|
@@ -4060,11 +4115,11 @@ class jU {
|
|
|
4060
4115
|
this.nextBeatIndex++;
|
|
4061
4116
|
const F = l + 0.15;
|
|
4062
4117
|
for (; this.nextBeatIndex < U.length; ) {
|
|
4063
|
-
const d = U[this.nextBeatIndex],
|
|
4118
|
+
const d = U[this.nextBeatIndex], Z = d.time - l;
|
|
4064
4119
|
if (d.time > F)
|
|
4065
4120
|
break;
|
|
4066
|
-
if (
|
|
4067
|
-
const Q = this.audioEngine.audioContext.currentTime + 5e-3, V = this.audioEngine.audioContext.currentTime + Math.max(
|
|
4121
|
+
if (Z >= -0.025 && Z <= 0.15) {
|
|
4122
|
+
const Q = this.audioEngine.audioContext.currentTime + 5e-3, V = this.audioEngine.audioContext.currentTime + Math.max(Z, 5e-3), a = Math.max(Q, V), n = d.beat === 1;
|
|
4068
4123
|
this._scheduleTickAtTime(a, n);
|
|
4069
4124
|
}
|
|
4070
4125
|
this.nextBeatIndex++;
|
|
@@ -4240,8 +4295,8 @@ class jU {
|
|
|
4240
4295
|
*/
|
|
4241
4296
|
_completeMidiPlayerSetup() {
|
|
4242
4297
|
this._partOutputsMap.clear(), Object.keys(this.midiPlayer.parsedData.parts).sort((l, U) => {
|
|
4243
|
-
const F = this.midiPlayer.parsedData.parts[l], d = this.midiPlayer.parsedData.parts[U],
|
|
4244
|
-
return
|
|
4298
|
+
const F = this.midiPlayer.parsedData.parts[l], d = this.midiPlayer.parsedData.parts[U], Z = F.channel !== void 0 ? F.channel : F.trackIndex, Q = d.channel !== void 0 ? d.channel : d.trackIndex;
|
|
4299
|
+
return Z - Q;
|
|
4245
4300
|
}).forEach((l) => {
|
|
4246
4301
|
const U = this.midiPlayer.getPartOutput(l);
|
|
4247
4302
|
U && this._partOutputsMap.set(l, U);
|
|
@@ -4266,10 +4321,10 @@ class jU {
|
|
|
4266
4321
|
trumpet: { instrument: "trumpet", volume: 0.7 }
|
|
4267
4322
|
};
|
|
4268
4323
|
return Object.keys(l).forEach((d) => {
|
|
4269
|
-
const
|
|
4270
|
-
if (
|
|
4324
|
+
const Z = l[d];
|
|
4325
|
+
if (Z.defaultInstrument !== void 0)
|
|
4271
4326
|
U[d] = {
|
|
4272
|
-
instrument:
|
|
4327
|
+
instrument: Z.defaultInstrument,
|
|
4273
4328
|
volume: 1
|
|
4274
4329
|
};
|
|
4275
4330
|
else {
|
|
@@ -4298,16 +4353,16 @@ class jU {
|
|
|
4298
4353
|
const U = this.audioEngine.getMetronomeAnalyser();
|
|
4299
4354
|
if (!U)
|
|
4300
4355
|
throw new Error("Metronome analyser not available for signal capture");
|
|
4301
|
-
const F = l.sampleIntervalMs || 2, d = l.captureDurationMs || 1500,
|
|
4302
|
-
await this.audioEngine.playMetronomeTick(
|
|
4356
|
+
const F = l.sampleIntervalMs || 2, d = l.captureDurationMs || 1500, Z = this.audioEngine.audioContext.currentTime + 0.1;
|
|
4357
|
+
await this.audioEngine.playMetronomeTick(Z, !0, 1);
|
|
4303
4358
|
const Q = await this._captureAnalyserTimeSeries(
|
|
4304
4359
|
U,
|
|
4305
|
-
|
|
4360
|
+
Z,
|
|
4306
4361
|
F,
|
|
4307
4362
|
d
|
|
4308
4363
|
);
|
|
4309
4364
|
return {
|
|
4310
|
-
scheduledTime:
|
|
4365
|
+
scheduledTime: Z,
|
|
4311
4366
|
samples: Q,
|
|
4312
4367
|
sampleIntervalMs: F,
|
|
4313
4368
|
captureDurationMs: d
|
|
@@ -4323,8 +4378,8 @@ class jU {
|
|
|
4323
4378
|
* @private
|
|
4324
4379
|
*/
|
|
4325
4380
|
async _performLatencyMeasurement(l, U, F, d) {
|
|
4326
|
-
const
|
|
4327
|
-
if (!
|
|
4381
|
+
const Z = this.audioEngine.getMetronomeAnalyser();
|
|
4382
|
+
if (!Z)
|
|
4328
4383
|
throw new Error("Metronome analyser not available for latency measurement");
|
|
4329
4384
|
const Q = this.audioEngine.audioContext, V = [];
|
|
4330
4385
|
console.log(`Starting calibration: ${l} measurements, ${U}ms sampling, ${F} threshold`);
|
|
@@ -4332,18 +4387,18 @@ class jU {
|
|
|
4332
4387
|
const e = Q.currentTime + 0.15;
|
|
4333
4388
|
await this.audioEngine.playMetronomeTick(e, !0, 1);
|
|
4334
4389
|
const c = await this._detectOnsetByThreshold(
|
|
4335
|
-
|
|
4390
|
+
Z,
|
|
4336
4391
|
e,
|
|
4337
4392
|
U,
|
|
4338
4393
|
F,
|
|
4339
4394
|
d
|
|
4340
4395
|
);
|
|
4341
4396
|
if (c) {
|
|
4342
|
-
const
|
|
4343
|
-
V.push(
|
|
4397
|
+
const b = c.latencyMs;
|
|
4398
|
+
V.push(b), console.log(`Measurement ${m + 1}/${l}: ${b.toFixed(1)}ms (RMS: ${c.rms.toFixed(4)}, peak: ${c.peak.toFixed(4)})`);
|
|
4344
4399
|
} else
|
|
4345
4400
|
console.warn(`Measurement ${m + 1}/${l}: detection timeout (no signal above ${F} threshold)`);
|
|
4346
|
-
await new Promise((
|
|
4401
|
+
await new Promise((b) => setTimeout(b, 300));
|
|
4347
4402
|
}
|
|
4348
4403
|
if (V.length === 0)
|
|
4349
4404
|
throw new Error(`Failed to detect any metronome onsets. Try lowering threshold (current: ${F}) or check audio routing.`);
|
|
@@ -4373,31 +4428,31 @@ class jU {
|
|
|
4373
4428
|
* @returns {Promise<Object|null>} Detection result {latencyMs, rms, peak} or null if timeout
|
|
4374
4429
|
* @private
|
|
4375
4430
|
*/
|
|
4376
|
-
async _detectOnsetByThreshold(l, U, F, d,
|
|
4431
|
+
async _detectOnsetByThreshold(l, U, F, d, Z) {
|
|
4377
4432
|
const Q = this.audioEngine.audioContext, V = l.fftSize, a = new Float32Array(V), n = Math.max(0, (U - Q.currentTime) * 1e3 - 20);
|
|
4378
4433
|
await new Promise((m) => setTimeout(m, n));
|
|
4379
4434
|
const R = performance.now();
|
|
4380
4435
|
return new Promise((m) => {
|
|
4381
4436
|
const e = setInterval(() => {
|
|
4382
|
-
if (performance.now() - R >
|
|
4437
|
+
if (performance.now() - R > Z) {
|
|
4383
4438
|
clearInterval(e), m(null);
|
|
4384
4439
|
return;
|
|
4385
4440
|
}
|
|
4386
4441
|
l.getFloatTimeDomainData(a);
|
|
4387
|
-
let c = 0,
|
|
4388
|
-
for (let
|
|
4389
|
-
const X = Math.abs(a[
|
|
4390
|
-
c += a[
|
|
4442
|
+
let c = 0, b = 0;
|
|
4443
|
+
for (let u = 0; u < V; u++) {
|
|
4444
|
+
const X = Math.abs(a[u]);
|
|
4445
|
+
c += a[u] * a[u], X > b && (b = X);
|
|
4391
4446
|
}
|
|
4392
|
-
const
|
|
4393
|
-
if (
|
|
4447
|
+
const B = Math.sqrt(c / V);
|
|
4448
|
+
if (B >= d) {
|
|
4394
4449
|
clearInterval(e);
|
|
4395
|
-
const
|
|
4450
|
+
const u = Q.currentTime, X = (u - U) * 1e3;
|
|
4396
4451
|
m({
|
|
4397
4452
|
latencyMs: X,
|
|
4398
|
-
rms:
|
|
4399
|
-
peak:
|
|
4400
|
-
detectedTime:
|
|
4453
|
+
rms: B,
|
|
4454
|
+
peak: b,
|
|
4455
|
+
detectedTime: u
|
|
4401
4456
|
});
|
|
4402
4457
|
}
|
|
4403
4458
|
}, F);
|
|
@@ -4413,7 +4468,7 @@ class jU {
|
|
|
4413
4468
|
* @private
|
|
4414
4469
|
*/
|
|
4415
4470
|
async _captureAnalyserTimeSeries(l, U, F, d) {
|
|
4416
|
-
const
|
|
4471
|
+
const Z = this.audioEngine.audioContext, Q = l.fftSize, V = new Float32Array(Q), a = [], n = performance.now(), R = Math.max(0, (U - Z.currentTime) * 1e3 - 20);
|
|
4417
4472
|
return await new Promise((m) => setTimeout(m, R)), new Promise((m) => {
|
|
4418
4473
|
const e = setInterval(() => {
|
|
4419
4474
|
if (performance.now() - n - R >= d) {
|
|
@@ -4421,18 +4476,18 @@ class jU {
|
|
|
4421
4476
|
return;
|
|
4422
4477
|
}
|
|
4423
4478
|
l.getFloatTimeDomainData(V);
|
|
4424
|
-
let c = 0,
|
|
4479
|
+
let c = 0, b = 0;
|
|
4425
4480
|
for (let X = 0; X < Q; X++) {
|
|
4426
|
-
const
|
|
4427
|
-
c += V[X] * V[X],
|
|
4481
|
+
const E = Math.abs(V[X]);
|
|
4482
|
+
c += V[X] * V[X], E > b && (b = E);
|
|
4428
4483
|
}
|
|
4429
|
-
const
|
|
4484
|
+
const B = Math.sqrt(c / Q), u = Z.currentTime;
|
|
4430
4485
|
a.push({
|
|
4431
|
-
time:
|
|
4432
|
-
relativeTime: (
|
|
4486
|
+
time: u,
|
|
4487
|
+
relativeTime: (u - U) * 1e3,
|
|
4433
4488
|
// ms relative to scheduled time
|
|
4434
|
-
rms:
|
|
4435
|
-
peak:
|
|
4489
|
+
rms: B,
|
|
4490
|
+
peak: b
|
|
4436
4491
|
});
|
|
4437
4492
|
}, F);
|
|
4438
4493
|
});
|
|
@@ -4472,7 +4527,7 @@ class qU {
|
|
|
4472
4527
|
const PU = new qU();
|
|
4473
4528
|
class wU {
|
|
4474
4529
|
constructor() {
|
|
4475
|
-
this.eventBus =
|
|
4530
|
+
this.eventBus = _l(), this.currentTime = 0, this.isPlaying = !1, this.playbackSpeed = 1, this.masterVolume = 0.75, this.metronomeVolume = 0.7, this.parts = /* @__PURE__ */ new Map(), this.playbackTimer = null, this.lastTimestamp = 0, this.audioContext = null, this.audioEngine = null, this.playbackManager = null, this.musicData = null, this.beats = [], this.practiceMarks = {}, this.songDuration = 0, this.maxBar = 0, this.masterGain = null, this.metronomeGain = null, this.partGainNodes = /* @__PURE__ */ new Map(), this.partAnalyserNodes = /* @__PURE__ */ new Map(), this.isInitialized = !1;
|
|
4476
4531
|
}
|
|
4477
4532
|
// Sanitize part names to ensure consistent lookup
|
|
4478
4533
|
// Remove non-printable characters, convert to lowercase, trim whitespace
|
|
@@ -4492,20 +4547,20 @@ class wU {
|
|
|
4492
4547
|
"/FluidR3_GM.sf2",
|
|
4493
4548
|
"/soundfont.sf2"
|
|
4494
4549
|
];
|
|
4495
|
-
let d = !1,
|
|
4550
|
+
let d = !1, Z = null;
|
|
4496
4551
|
for (const Q of F)
|
|
4497
4552
|
try {
|
|
4498
4553
|
await this.audioEngine.initialize(Q), console.log(`Loaded soundfont: ${Q}`), d = !0;
|
|
4499
4554
|
break;
|
|
4500
4555
|
} catch (V) {
|
|
4501
|
-
console.warn(`Failed to load soundfont ${Q}:`, V.message),
|
|
4556
|
+
console.warn(`Failed to load soundfont ${Q}:`, V.message), Z = V;
|
|
4502
4557
|
}
|
|
4503
4558
|
if (!d) {
|
|
4504
4559
|
const Q = "No soundfont could be loaded";
|
|
4505
4560
|
throw this.eventBus.emit("initProgress", {
|
|
4506
4561
|
stage: "error",
|
|
4507
4562
|
message: Q,
|
|
4508
|
-
error:
|
|
4563
|
+
error: Z
|
|
4509
4564
|
}), new Error(Q);
|
|
4510
4565
|
}
|
|
4511
4566
|
} else
|
|
@@ -4532,7 +4587,7 @@ class wU {
|
|
|
4532
4587
|
else {
|
|
4533
4588
|
if (this.beats = l.beats || [], this.practiceMarks = l.marks || l.practiceMarks || {}, this.beats.length > 0) {
|
|
4534
4589
|
const F = this.beats[this.beats.length - 1], d = F.tempo > 0 ? 60 / F.tempo : 0.75;
|
|
4535
|
-
this.songDuration = F.time + d, this.maxBar = Math.max(...this.beats.map((
|
|
4590
|
+
this.songDuration = F.time + d, this.maxBar = Math.max(...this.beats.map((Z) => Z.bar));
|
|
4536
4591
|
} else
|
|
4537
4592
|
this.songDuration = 0, this.maxBar = 0;
|
|
4538
4593
|
this.setupLegacyParts(l.parts || []), this.eventBus.emit("initialized", { parts: Array.from(this.parts.values()) });
|
|
@@ -4599,8 +4654,8 @@ class wU {
|
|
|
4599
4654
|
F.gain.value = 1;
|
|
4600
4655
|
const d = this.audioContext.createAnalyser();
|
|
4601
4656
|
d.fftSize = 256, d.smoothingTimeConstant = 0.3, U.connect(F), F.connect(d), d.connect(this.masterGain);
|
|
4602
|
-
const
|
|
4603
|
-
this.partGainNodes.set(
|
|
4657
|
+
const Z = this.sanitizePartName(l);
|
|
4658
|
+
this.partGainNodes.set(Z, F), this.partAnalyserNodes.set(Z, d), console.log(`Audio routing established for part: ${l}`);
|
|
4604
4659
|
}
|
|
4605
4660
|
}
|
|
4606
4661
|
// Set up metronome audio routing (separate from parts)
|
|
@@ -4648,8 +4703,8 @@ class wU {
|
|
|
4648
4703
|
setupPlaybackManagerEventDelegation() {
|
|
4649
4704
|
this.playbackManager.on("timeupdate", ({ audioTime: l, leadInProgress: U }) => {
|
|
4650
4705
|
this.currentTime = l, this.eventBus.emit("timeChanged", { currentTime: l, leadInProgress: U });
|
|
4651
|
-
}), this.playbackManager.on("beatAudible", ({ bar: l, beat: U, isLeadIn: F, repeat: d, time:
|
|
4652
|
-
this.eventBus.emit("barChanged", { bar: l, beat: U, repeat: d, time:
|
|
4706
|
+
}), this.playbackManager.on("beatAudible", ({ bar: l, beat: U, isLeadIn: F, repeat: d, time: Z }) => {
|
|
4707
|
+
this.eventBus.emit("barChanged", { bar: l, beat: U, repeat: d, time: Z, isLeadIn: F });
|
|
4653
4708
|
}), this.playbackManager.on("leadInStarted", ({ totalBeats: l, duration: U, bars: F }) => {
|
|
4654
4709
|
this.eventBus.emit("leadInStarted", { bars: F, totalBeats: l, duration: U });
|
|
4655
4710
|
}), this.playbackManager.on("leadInEnded", () => {
|
|
@@ -4774,7 +4829,7 @@ class wU {
|
|
|
4774
4829
|
// Helper method to determine if a part should be effectively muted
|
|
4775
4830
|
isPartEffectivelyMuted(l) {
|
|
4776
4831
|
const U = this.sanitizePartName(l), F = this.parts.get(U);
|
|
4777
|
-
return !F || F.muted ? !0 : Array.from(this.parts.values()).some((
|
|
4832
|
+
return !F || F.muted ? !0 : Array.from(this.parts.values()).some((Z) => Z.solo) && !F.solo;
|
|
4778
4833
|
}
|
|
4779
4834
|
// Update audio state for a specific part
|
|
4780
4835
|
updatePartAudioState(l) {
|
|
@@ -4798,11 +4853,11 @@ class wU {
|
|
|
4798
4853
|
if (!F)
|
|
4799
4854
|
return 0;
|
|
4800
4855
|
try {
|
|
4801
|
-
const d = F.frequencyBinCount,
|
|
4802
|
-
F.getByteFrequencyData(
|
|
4856
|
+
const d = F.frequencyBinCount, Z = new Uint8Array(d);
|
|
4857
|
+
F.getByteFrequencyData(Z);
|
|
4803
4858
|
let Q = 0;
|
|
4804
4859
|
for (let a = 0; a < d; a++) {
|
|
4805
|
-
const n =
|
|
4860
|
+
const n = Z[a] / 255;
|
|
4806
4861
|
Q += n * n;
|
|
4807
4862
|
}
|
|
4808
4863
|
const V = Math.sqrt(Q / d);
|
|
@@ -4861,6 +4916,12 @@ class wU {
|
|
|
4861
4916
|
this.playbackManager.pause();
|
|
4862
4917
|
} catch {
|
|
4863
4918
|
}
|
|
4919
|
+
if (this.playbackManager && this.metronomeGain)
|
|
4920
|
+
try {
|
|
4921
|
+
const l = this.playbackManager.getMetronomeOutput();
|
|
4922
|
+
l && l.disconnect(this.metronomeGain);
|
|
4923
|
+
} catch {
|
|
4924
|
+
}
|
|
4864
4925
|
if (this.partGainNodes.forEach((l) => {
|
|
4865
4926
|
try {
|
|
4866
4927
|
l.disconnect();
|
|
@@ -4885,11 +4946,11 @@ class wU {
|
|
|
4885
4946
|
this.cleanup(), this.audioEngine && this.audioEngine.destroy(), this.audioContext && this.audioContext.state !== "closed" && this.audioContext.close(), this.eventBus.all.clear();
|
|
4886
4947
|
}
|
|
4887
4948
|
}
|
|
4888
|
-
const
|
|
4889
|
-
function Vl(
|
|
4890
|
-
const l =
|
|
4891
|
-
soundfontUrl:
|
|
4892
|
-
},
|
|
4949
|
+
const s = new wU();
|
|
4950
|
+
function Vl(t = {}) {
|
|
4951
|
+
const l = dl(), U = ll(), F = fl(), d = {
|
|
4952
|
+
soundfontUrl: t.soundfontUrl
|
|
4953
|
+
}, Z = ({ currentTime: W }) => {
|
|
4893
4954
|
l.setCurrentTime(W);
|
|
4894
4955
|
}, Q = ({ isPlaying: W }) => {
|
|
4895
4956
|
l.setPlaybackState(W), F.setTransportState(W ? "playing" : "stopped");
|
|
@@ -4899,139 +4960,140 @@ function Vl(Z = {}) {
|
|
|
4899
4960
|
l.setPlaybackSpeed(W);
|
|
4900
4961
|
}, n = ({ volume: W }) => {
|
|
4901
4962
|
l.setMasterVolume(W);
|
|
4902
|
-
}, R = ({ partName: W, volume:
|
|
4903
|
-
l.setPartVolume(W,
|
|
4904
|
-
}, m = ({ partName: W, muted:
|
|
4905
|
-
l.setPartMuted(W,
|
|
4906
|
-
}, e = ({ partName: W, solo:
|
|
4907
|
-
l.setPartSolo(W,
|
|
4963
|
+
}, R = ({ partName: W, volume: S }) => {
|
|
4964
|
+
l.setPartVolume(W, S);
|
|
4965
|
+
}, m = ({ partName: W, muted: S }) => {
|
|
4966
|
+
l.setPartMuted(W, S);
|
|
4967
|
+
}, e = ({ partName: W, solo: S }) => {
|
|
4968
|
+
l.setPartSolo(W, S);
|
|
4908
4969
|
}, c = ({ bars: W }) => {
|
|
4909
4970
|
l.setLeadInActive(!0, W);
|
|
4910
|
-
},
|
|
4971
|
+
}, b = () => {
|
|
4911
4972
|
l.setLeadInActive(!1);
|
|
4912
|
-
}, u = () => {
|
|
4913
|
-
l.setStartingNotesActive(!0);
|
|
4914
4973
|
}, B = () => {
|
|
4974
|
+
l.setStartingNotesActive(!0);
|
|
4975
|
+
}, u = () => {
|
|
4915
4976
|
l.setStartingNotesActive(!1);
|
|
4916
4977
|
}, X = ({ mark: W }) => {
|
|
4917
4978
|
F.updateLastPracticeMarkUsed(W);
|
|
4918
|
-
},
|
|
4979
|
+
}, E = ({ parts: W }) => {
|
|
4919
4980
|
l.initializeParts(W), U.setParts(W);
|
|
4920
|
-
},
|
|
4981
|
+
}, z = ({ finalTime: W }) => {
|
|
4921
4982
|
l.setPlaybackState(!1), F.setTransportState("stopped"), console.log(`Song ended at time: ${W}`);
|
|
4922
|
-
},
|
|
4983
|
+
}, D = ({ duration: W }) => {
|
|
4923
4984
|
console.log("Updating total duration in store to:", W), U.setTotalDuration(W);
|
|
4924
|
-
},
|
|
4925
|
-
console.log(`Updating music data store with ${W.length} beats and ${Object.keys(
|
|
4926
|
-
},
|
|
4927
|
-
|
|
4928
|
-
},
|
|
4929
|
-
|
|
4985
|
+
}, g = ({ beats: W, practiceMarks: S, maxBar: P }) => {
|
|
4986
|
+
console.log(`Updating music data store with ${W.length} beats and ${Object.keys(S).length} practice marks`), U.updateBeats(W), U.practiceMarks = S, U.maxBar = P;
|
|
4987
|
+
}, j = () => {
|
|
4988
|
+
s.on("timeChanged", Z), s.on("playbackStateChanged", Q), s.on("barChanged", V), s.on("speedChanged", a), s.on("masterVolumeChanged", n), s.on("partVolumeChanged", R), s.on("partMutedChanged", m), s.on("partSoloChanged", e), s.on("leadInStarted", c), s.on("leadInCompleted", b), s.on("startingNotesStarted", B), s.on("startingNotesCompleted", u), s.on("practiceMarkChanged", X), s.on("initialized", E), s.on("songEnded", z), s.on("durationUpdated", D), s.on("musicDataExtracted", g);
|
|
4989
|
+
}, Y = () => {
|
|
4990
|
+
s.off("timeChanged", Z), s.off("playbackStateChanged", Q), s.off("barChanged", V), s.off("speedChanged", a), s.off("masterVolumeChanged", n), s.off("partVolumeChanged", R), s.off("partMutedChanged", m), s.off("partSoloChanged", e), s.off("leadInStarted", c), s.off("leadInCompleted", b), s.off("startingNotesStarted", B), s.off("startingNotesCompleted", u), s.off("practiceMarkChanged", X), s.off("initialized", E), s.off("songEnded", z), s.off("durationUpdated", D), s.off("musicDataExtracted", g);
|
|
4930
4991
|
};
|
|
4931
4992
|
(() => {
|
|
4932
4993
|
kl(() => {
|
|
4933
4994
|
const W = l.masterVolume;
|
|
4934
4995
|
try {
|
|
4935
|
-
|
|
4936
|
-
} catch (
|
|
4937
|
-
console.warn("Master volume sync skipped during initialization:",
|
|
4996
|
+
s.getMasterVolume() !== W && s.setMasterVolume(W);
|
|
4997
|
+
} catch (S) {
|
|
4998
|
+
console.warn("Master volume sync skipped during initialization:", S.message);
|
|
4938
4999
|
}
|
|
4939
5000
|
}), kl(() => {
|
|
4940
5001
|
const W = l.metronomeVolume;
|
|
4941
5002
|
try {
|
|
4942
|
-
|
|
4943
|
-
} catch (
|
|
4944
|
-
console.warn("Metronome volume sync skipped during initialization:",
|
|
5003
|
+
s.getMetronomeVolume() !== W && s.setMetronomeVolume(W);
|
|
5004
|
+
} catch (S) {
|
|
5005
|
+
console.warn("Metronome volume sync skipped during initialization:", S.message);
|
|
4945
5006
|
}
|
|
4946
5007
|
});
|
|
4947
5008
|
})();
|
|
4948
|
-
const
|
|
5009
|
+
const r = async (W) => {
|
|
4949
5010
|
try {
|
|
4950
|
-
if (l.setLoaded(!1),
|
|
4951
|
-
const
|
|
4952
|
-
l.setCurrentBar(
|
|
5011
|
+
if (l.setLoaded(!1), j(), U.loadMusicData(W), await s.initialize(W, d), F.buildFixedNavigationPoints(), !W.midiData && W.beats && W.beats.length > 0) {
|
|
5012
|
+
const S = W.beats[0];
|
|
5013
|
+
l.setCurrentBar(S.bar, S.beat, S.repeat), s.setTime(S.time);
|
|
4953
5014
|
}
|
|
4954
|
-
|
|
4955
|
-
} catch (
|
|
4956
|
-
throw console.error("Failed to initialize audio engine:",
|
|
5015
|
+
s.updateToggleStates(l.metronomeEnabled, l.leadInEnabled), l.setLoaded(!0);
|
|
5016
|
+
} catch (S) {
|
|
5017
|
+
throw console.error("Failed to initialize audio engine:", S), l.setLoaded(!1), S;
|
|
4957
5018
|
}
|
|
4958
5019
|
}, q = () => {
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
5020
|
+
const W = l.currentBar, S = l.currentRepeat, P = l.currentTime;
|
|
5021
|
+
F.setLastPlayStart(W, S, P), F.setNavigationAction("play"), s.play();
|
|
5022
|
+
}, G = () => {
|
|
5023
|
+
F.setNavigationAction("pause"), s.stop();
|
|
5024
|
+
}, M = () => {
|
|
5025
|
+
F.setNavigationAction("pause"), s.pause();
|
|
5026
|
+
}, O = (W) => {
|
|
5027
|
+
F.setNavigationAction("manual"), s.setTime(W);
|
|
5028
|
+
}, i = (W, S = 0) => {
|
|
5029
|
+
F.setNavigationAction("manual"), s.setBar(W, S);
|
|
5030
|
+
}, o = (W) => {
|
|
5031
|
+
s.goToPracticeMark(W);
|
|
4970
5032
|
}, k = (W) => {
|
|
4971
|
-
|
|
4972
|
-
},
|
|
4973
|
-
|
|
4974
|
-
},
|
|
4975
|
-
|
|
4976
|
-
}, al = (W,
|
|
4977
|
-
|
|
4978
|
-
}, ul = (W,
|
|
4979
|
-
|
|
5033
|
+
s.setPlaybackSpeed(W);
|
|
5034
|
+
}, I = (W) => {
|
|
5035
|
+
s.setMasterVolume(W);
|
|
5036
|
+
}, A = (W, S) => {
|
|
5037
|
+
s.setPartVolume(W, S);
|
|
5038
|
+
}, al = (W, S) => {
|
|
5039
|
+
s.setPartMuted(W, S);
|
|
5040
|
+
}, ul = (W, S) => {
|
|
5041
|
+
s.setPartSolo(W, S);
|
|
4980
5042
|
}, yl = (W = 1) => {
|
|
4981
|
-
|
|
4982
|
-
},
|
|
4983
|
-
|
|
4984
|
-
}, Yl = (W,
|
|
4985
|
-
|
|
4986
|
-
},
|
|
4987
|
-
const
|
|
4988
|
-
|
|
4989
|
-
},
|
|
5043
|
+
s.playLeadIn(W);
|
|
5044
|
+
}, FU = () => {
|
|
5045
|
+
s.playStartingNotes();
|
|
5046
|
+
}, Yl = (W, S = !0, P = 0) => {
|
|
5047
|
+
S && F.leadInEnabled ? (i(W, P), yl(F.leadInBars)) : (i(W, P), q());
|
|
5048
|
+
}, dU = (W, S = !0) => {
|
|
5049
|
+
const P = U.getBarForMark(W);
|
|
5050
|
+
P && Yl(P, S);
|
|
5051
|
+
}, tU = () => {
|
|
4990
5052
|
const W = !l.metronomeEnabled;
|
|
4991
|
-
return l.setMetronomeEnabled(W),
|
|
5053
|
+
return l.setMetronomeEnabled(W), s.setMetronomeEnabled(W), W;
|
|
4992
5054
|
}, ZU = () => {
|
|
4993
5055
|
const W = !l.leadInEnabled;
|
|
4994
|
-
return l.setLeadInEnabled(W),
|
|
5056
|
+
return l.setLeadInEnabled(W), s.updateToggleStates(l.metronomeEnabled, W), W;
|
|
4995
5057
|
};
|
|
4996
5058
|
return cl(() => {
|
|
4997
|
-
|
|
5059
|
+
Y();
|
|
4998
5060
|
}), {
|
|
4999
5061
|
// Initialization
|
|
5000
|
-
initialize:
|
|
5062
|
+
initialize: r,
|
|
5001
5063
|
// Transport controls
|
|
5002
5064
|
play: q,
|
|
5003
|
-
stop:
|
|
5004
|
-
pause:
|
|
5065
|
+
stop: G,
|
|
5066
|
+
pause: M,
|
|
5005
5067
|
// Time controls
|
|
5006
|
-
setTime:
|
|
5068
|
+
setTime: O,
|
|
5007
5069
|
setBar: i,
|
|
5008
5070
|
// Navigation
|
|
5009
|
-
goToPracticeMark:
|
|
5071
|
+
goToPracticeMark: o,
|
|
5010
5072
|
setPlaybackSpeed: k,
|
|
5011
5073
|
// Volume controls
|
|
5012
|
-
setMasterVolume:
|
|
5013
|
-
setPartVolume:
|
|
5074
|
+
setMasterVolume: I,
|
|
5075
|
+
setPartVolume: A,
|
|
5014
5076
|
setPartMuted: al,
|
|
5015
5077
|
setPartSolo: ul,
|
|
5016
|
-
getPartLevel: (W) =>
|
|
5078
|
+
getPartLevel: (W) => s.getPartLevel(W),
|
|
5017
5079
|
// Special features
|
|
5018
5080
|
playLeadIn: yl,
|
|
5019
|
-
playStartingNotes:
|
|
5081
|
+
playStartingNotes: FU,
|
|
5020
5082
|
// Feature toggles
|
|
5021
|
-
toggleMetronome:
|
|
5083
|
+
toggleMetronome: tU,
|
|
5022
5084
|
toggleLeadIn: ZU,
|
|
5023
5085
|
setMetronomeEnabled: (W) => {
|
|
5024
|
-
l.setMetronomeEnabled(W),
|
|
5086
|
+
l.setMetronomeEnabled(W), s.setMetronomeEnabled(W);
|
|
5025
5087
|
},
|
|
5026
5088
|
// Complex operations
|
|
5027
5089
|
playFromBar: Yl,
|
|
5028
|
-
playFromMark:
|
|
5090
|
+
playFromMark: dU,
|
|
5029
5091
|
// Access to stores for components
|
|
5030
5092
|
audioState: l,
|
|
5031
5093
|
musicData: U,
|
|
5032
5094
|
playbackState: F,
|
|
5033
5095
|
// Direct access to engine for advanced use
|
|
5034
|
-
audioEngine:
|
|
5096
|
+
audioEngine: s
|
|
5035
5097
|
};
|
|
5036
5098
|
}
|
|
5037
5099
|
const OU = {
|
|
@@ -5044,7 +5106,7 @@ const OU = {
|
|
|
5044
5106
|
level: {
|
|
5045
5107
|
type: Number,
|
|
5046
5108
|
default: 0,
|
|
5047
|
-
validator: (
|
|
5109
|
+
validator: (t) => t >= 0 && t <= 1
|
|
5048
5110
|
}
|
|
5049
5111
|
}, {
|
|
5050
5112
|
volume: { default: 0.75 },
|
|
@@ -5055,25 +5117,25 @@ const OU = {
|
|
|
5055
5117
|
soloModifiers: {}
|
|
5056
5118
|
}),
|
|
5057
5119
|
emits: ["update:volume", "update:mute", "update:solo"],
|
|
5058
|
-
setup(
|
|
5059
|
-
|
|
5120
|
+
setup(t) {
|
|
5121
|
+
Ul((c) => ({
|
|
5060
5122
|
"746d5fc3": n.value
|
|
5061
5123
|
}));
|
|
5062
|
-
const l =
|
|
5063
|
-
|
|
5064
|
-
const U = Vl(), F = $(
|
|
5065
|
-
|
|
5124
|
+
const l = t;
|
|
5125
|
+
dl();
|
|
5126
|
+
const U = Vl(), F = $(t, "volume"), d = $(t, "mute"), Z = $(t, "solo");
|
|
5127
|
+
v(F, (c) => {
|
|
5066
5128
|
U.setPartVolume(l.name, c);
|
|
5067
|
-
}),
|
|
5129
|
+
}), v(d, (c) => {
|
|
5068
5130
|
U.setPartMuted(l.name, c);
|
|
5069
|
-
}),
|
|
5131
|
+
}), v(Z, (c) => {
|
|
5070
5132
|
U.setPartSolo(l.name, c);
|
|
5071
5133
|
});
|
|
5072
|
-
const Q =
|
|
5134
|
+
const Q = f("el"), { width: V, height: a } = Fl(Q), n = J(() => Math.min(V.value, a.value) + "px"), R = J(
|
|
5073
5135
|
() => V.value > a.value ? "mobile" : V.value < 60 ? "tablet" : "desktop"
|
|
5074
5136
|
);
|
|
5075
5137
|
let m = null;
|
|
5076
|
-
const e =
|
|
5138
|
+
const e = x(0);
|
|
5077
5139
|
return bl(() => {
|
|
5078
5140
|
m = setInterval(() => {
|
|
5079
5141
|
if (d.value)
|
|
@@ -5087,176 +5149,176 @@ const OU = {
|
|
|
5087
5149
|
}, 16);
|
|
5088
5150
|
}), cl(() => {
|
|
5089
5151
|
m && (clearInterval(m), m = null);
|
|
5090
|
-
}), (c,
|
|
5152
|
+
}), (c, b) => (N(), y("div", {
|
|
5091
5153
|
ref_key: "el",
|
|
5092
5154
|
ref: Q,
|
|
5093
|
-
class:
|
|
5155
|
+
class: L([R.value, "part"])
|
|
5094
5156
|
}, [
|
|
5095
|
-
|
|
5157
|
+
C(EU, {
|
|
5096
5158
|
class: "tri",
|
|
5097
5159
|
mute: d.value,
|
|
5098
|
-
"onUpdate:mute":
|
|
5099
|
-
solo:
|
|
5100
|
-
"onUpdate:solo":
|
|
5160
|
+
"onUpdate:mute": b[0] || (b[0] = (B) => d.value = B),
|
|
5161
|
+
solo: Z.value,
|
|
5162
|
+
"onUpdate:solo": b[1] || (b[1] = (B) => Z.value = B)
|
|
5101
5163
|
}, null, 8, ["mute", "solo"]),
|
|
5102
|
-
|
|
5164
|
+
C(Ol, {
|
|
5103
5165
|
align: "left",
|
|
5104
5166
|
class: "name"
|
|
5105
5167
|
}, {
|
|
5106
|
-
default:
|
|
5107
|
-
Nl(
|
|
5168
|
+
default: w(() => [
|
|
5169
|
+
Nl(K(t.name), 1)
|
|
5108
5170
|
]),
|
|
5109
5171
|
_: 1
|
|
5110
5172
|
}),
|
|
5111
|
-
|
|
5173
|
+
C(Wl, {
|
|
5112
5174
|
level: e.value,
|
|
5113
5175
|
"show-level": !0,
|
|
5114
5176
|
class: "vol",
|
|
5115
5177
|
value: F.value,
|
|
5116
|
-
"onUpdate:value":
|
|
5178
|
+
"onUpdate:value": b[2] || (b[2] = (B) => F.value = B)
|
|
5117
5179
|
}, null, 8, ["level", "value"])
|
|
5118
5180
|
], 2));
|
|
5119
5181
|
}
|
|
5120
|
-
}, AU = /* @__PURE__ */
|
|
5182
|
+
}, AU = /* @__PURE__ */ H(OU, [["__scopeId", "data-v-9ca7f6e9"]]), fU = { class: "mark" }, _U = { class: "rpt" }, $U = { class: "beat-ind" }, lF = { class: "beat" }, UF = {
|
|
5121
5183
|
key: 1,
|
|
5122
5184
|
class: "mark-grid-container"
|
|
5123
|
-
}, FF = { class: "mark-grid" }, dF = ["onClick"],
|
|
5185
|
+
}, FF = { class: "mark-grid" }, dF = ["onClick"], tF = {
|
|
5124
5186
|
__name: "BarInput",
|
|
5125
|
-
setup(
|
|
5126
|
-
|
|
5187
|
+
setup(t) {
|
|
5188
|
+
Ul((i) => ({
|
|
5127
5189
|
b117cda6: X.value,
|
|
5128
|
-
"7cd7b1c8":
|
|
5190
|
+
"7cd7b1c8": E.value
|
|
5129
5191
|
}));
|
|
5130
|
-
const l =
|
|
5131
|
-
let
|
|
5132
|
-
|
|
5192
|
+
const l = f("el"), U = f("rpt"), { width: F, height: d } = Fl(l), Z = ll(), Q = dl(), V = Vl(), a = x("1"), n = x("A"), R = x(0), m = x(2), e = x(!1), c = x(!1), b = x(!1), B = x(!0);
|
|
5193
|
+
let u = null;
|
|
5194
|
+
v(() => {
|
|
5133
5195
|
var i;
|
|
5134
|
-
return ((i =
|
|
5196
|
+
return ((i = Z.beats) == null ? void 0 : i.length) > 0;
|
|
5135
5197
|
}, (i) => {
|
|
5136
|
-
console.log(i), i && !e.value && (a.value = Q.currentBar.toString(), R.value = Q.currentRepeat, m.value =
|
|
5137
|
-
}),
|
|
5138
|
-
m.value =
|
|
5139
|
-
}),
|
|
5198
|
+
console.log(i), i && !e.value && (a.value = Q.currentBar.toString(), R.value = Q.currentRepeat, m.value = Z.getRepeatCountForBar(Q.currentBar), g(Q.currentBar), e.value = !0);
|
|
5199
|
+
}), v(() => Q.currentBar, (i) => {
|
|
5200
|
+
m.value = Z.getRepeatCountForBar(i);
|
|
5201
|
+
}), v(a, () => {
|
|
5140
5202
|
a.value = a.value.replace(/\D/g, ""), a.value.length > 3 && (a.value = a.value.slice(0, 3));
|
|
5141
|
-
}),
|
|
5142
|
-
a.value = i.toString(),
|
|
5143
|
-
}),
|
|
5144
|
-
|
|
5145
|
-
|
|
5203
|
+
}), v(() => Q.currentBar, (i) => {
|
|
5204
|
+
a.value = i.toString(), g(i);
|
|
5205
|
+
}), v(() => Q.currentBeat, () => {
|
|
5206
|
+
B.value = !0, setTimeout(() => {
|
|
5207
|
+
B.value = !1;
|
|
5146
5208
|
}, 50);
|
|
5147
|
-
}),
|
|
5148
|
-
c.value &&
|
|
5209
|
+
}), v(c, () => {
|
|
5210
|
+
c.value && O();
|
|
5149
5211
|
});
|
|
5150
|
-
const X = J(() => Math.min(d.value / 2.25, F.value / 4.5) + "px"),
|
|
5151
|
-
function
|
|
5152
|
-
const
|
|
5153
|
-
|
|
5212
|
+
const X = J(() => Math.min(d.value / 2.25, F.value / 4.5) + "px"), E = J(() => Math.min(F.value / 15, d.value / 6.4) + "px"), z = J(() => Object.keys(Z.practiceMarks).sort()), D = J(() => z.value.length > 0);
|
|
5213
|
+
function g(i) {
|
|
5214
|
+
const o = Object.keys(Z.practiceMarks).filter((k) => Z.practiceMarks[k] <= i).sort((k, I) => Z.practiceMarks[I] - Z.practiceMarks[k]);
|
|
5215
|
+
o.length > 0 && (n.value = o[0]);
|
|
5154
5216
|
}
|
|
5155
|
-
function
|
|
5217
|
+
function j() {
|
|
5156
5218
|
const i = parseInt(a.value);
|
|
5157
|
-
i && i > 0 &&
|
|
5219
|
+
i && i > 0 && Y(i);
|
|
5158
5220
|
}
|
|
5159
|
-
function
|
|
5221
|
+
function Y(i) {
|
|
5160
5222
|
V.setBar(i, 0);
|
|
5161
5223
|
}
|
|
5162
|
-
function
|
|
5163
|
-
|
|
5224
|
+
function p(i, o) {
|
|
5225
|
+
o && o.stopPropagation(), n.value = i, c.value = !1, V.goToPracticeMark(i);
|
|
5164
5226
|
}
|
|
5165
|
-
function
|
|
5166
|
-
m.value > 1 && (
|
|
5227
|
+
function r() {
|
|
5228
|
+
m.value > 1 && (b.value = !0), Q.currentRepeat < m.value && V.setBar(Q.currentBar, Q.currentRepeat + 1);
|
|
5167
5229
|
}
|
|
5168
5230
|
function q() {
|
|
5169
|
-
m.value > 1 && (
|
|
5231
|
+
m.value > 1 && (b.value = !0), Q.currentRepeat > 1 && V.setBar(Q.currentBar, Q.currentRepeat - 1);
|
|
5170
5232
|
}
|
|
5171
|
-
function
|
|
5172
|
-
|
|
5233
|
+
function G(i) {
|
|
5234
|
+
D.value && (i.stopPropagation(), b.value = !1, c.value = !c.value);
|
|
5173
5235
|
}
|
|
5174
|
-
function
|
|
5175
|
-
var
|
|
5176
|
-
(
|
|
5236
|
+
function M(i) {
|
|
5237
|
+
var o, k;
|
|
5238
|
+
(o = l.value) != null && o.contains(i.target) || (c.value = !1), (k = U.value) != null && k.contains(i.target) || (b.value = !1);
|
|
5177
5239
|
}
|
|
5178
|
-
function
|
|
5240
|
+
function O() {
|
|
5179
5241
|
c.value && setTimeout(() => {
|
|
5180
|
-
var k,
|
|
5181
|
-
const i = (k = l.value) == null ? void 0 : k.querySelector(".mark-grid"),
|
|
5182
|
-
if (
|
|
5183
|
-
const
|
|
5242
|
+
var k, I;
|
|
5243
|
+
const i = (k = l.value) == null ? void 0 : k.querySelector(".mark-grid"), o = (I = l.value) == null ? void 0 : I.querySelector(".mark-option.selected");
|
|
5244
|
+
if (o && i) {
|
|
5245
|
+
const A = i.getBoundingClientRect(), al = o.getBoundingClientRect(), ul = al.left - A.left - A.width / 2 + al.width / 2;
|
|
5184
5246
|
i.scrollLeft = Math.max(0, i.scrollLeft + ul);
|
|
5185
5247
|
}
|
|
5186
5248
|
}, 50);
|
|
5187
5249
|
}
|
|
5188
5250
|
return bl(() => {
|
|
5189
|
-
document.addEventListener("click",
|
|
5190
|
-
const i = Q.currentBeat %
|
|
5251
|
+
document.addEventListener("click", M), Al("beatAnimation") && (u = setInterval(() => {
|
|
5252
|
+
const i = Q.currentBeat % Z.timeSignature + 1;
|
|
5191
5253
|
Q.setCurrentBar(Q.currentBar, i, Q.currentRepeat);
|
|
5192
5254
|
}, 800));
|
|
5193
5255
|
}), cl(() => {
|
|
5194
|
-
document.removeEventListener("click",
|
|
5195
|
-
}), (i,
|
|
5256
|
+
document.removeEventListener("click", M), u && (clearInterval(u), u = null);
|
|
5257
|
+
}), (i, o) => (N(), y("div", {
|
|
5196
5258
|
ref_key: "el",
|
|
5197
5259
|
ref: l,
|
|
5198
|
-
class:
|
|
5260
|
+
class: L(["outer", { pulse: B.value, "mark-selecting": c.value }])
|
|
5199
5261
|
}, [
|
|
5200
|
-
|
|
5262
|
+
o[6] || (o[6] = h("div", { class: "frame" }, null, -1)),
|
|
5201
5263
|
h("div", {
|
|
5202
|
-
class:
|
|
5203
|
-
onClick:
|
|
5264
|
+
class: L(["mark-input", { empty: !n.value, edit: c.value, disabled: !D.value }]),
|
|
5265
|
+
onClick: G
|
|
5204
5266
|
}, [
|
|
5205
|
-
h("div", fU, D
|
|
5267
|
+
h("div", fU, K(D.value ? n.value : "-"), 1)
|
|
5206
5268
|
], 2),
|
|
5207
|
-
|
|
5208
|
-
c.value ?
|
|
5269
|
+
o[7] || (o[7] = h("div", { class: "mark-title" }, "Mark", -1)),
|
|
5270
|
+
c.value ? _("", !0) : (N(), y(nl, { key: 0 }, [
|
|
5209
5271
|
Kl(h("input", {
|
|
5210
5272
|
type: "text",
|
|
5211
5273
|
class: "bar-input",
|
|
5212
|
-
"onUpdate:modelValue":
|
|
5274
|
+
"onUpdate:modelValue": o[0] || (o[0] = (k) => a.value = k),
|
|
5213
5275
|
inputmode: "decimal",
|
|
5214
5276
|
pattern: "\\d*",
|
|
5215
|
-
onChange:
|
|
5216
|
-
onKeyup:
|
|
5277
|
+
onChange: j,
|
|
5278
|
+
onKeyup: VU(j, ["enter"])
|
|
5217
5279
|
}, null, 544), [
|
|
5218
5280
|
[Hl, a.value]
|
|
5219
5281
|
]),
|
|
5220
|
-
|
|
5282
|
+
o[3] || (o[3] = h("div", { class: "bar-title" }, "Bar", -1)),
|
|
5221
5283
|
h("div", {
|
|
5222
5284
|
ref_key: "rpt",
|
|
5223
5285
|
ref: U,
|
|
5224
|
-
class:
|
|
5286
|
+
class: L(["rpt-input", { edit: b.value, available: m.value > 1 }])
|
|
5225
5287
|
}, [
|
|
5226
|
-
h("div", _U,
|
|
5227
|
-
(
|
|
5228
|
-
class:
|
|
5288
|
+
h("div", _U, K(T(Q).currentRepeat || "-"), 1),
|
|
5289
|
+
(N(), y("svg", {
|
|
5290
|
+
class: L(["inc", { disabled: T(Q).currentRepeat >= m.value }]),
|
|
5229
5291
|
viewBox: "0 -100 100 100",
|
|
5230
|
-
onClick: Tl(
|
|
5231
|
-
},
|
|
5292
|
+
onClick: Tl(r, ["prevent"])
|
|
5293
|
+
}, o[1] || (o[1] = [
|
|
5232
5294
|
h("path", { d: "m10-20 40-60 40 60H10Z" }, null, -1)
|
|
5233
5295
|
]), 2)),
|
|
5234
|
-
(
|
|
5235
|
-
class:
|
|
5296
|
+
(N(), y("svg", {
|
|
5297
|
+
class: L(["dec", { disabled: T(Q).currentRepeat <= 1 }]),
|
|
5236
5298
|
viewBox: "0 -100 100 100",
|
|
5237
5299
|
onClick: Tl(q, ["prevent"])
|
|
5238
|
-
},
|
|
5300
|
+
}, o[2] || (o[2] = [
|
|
5239
5301
|
h("path", { d: "m10-80 40 60 40-60H10Z" }, null, -1)
|
|
5240
5302
|
]), 2))
|
|
5241
5303
|
], 2),
|
|
5242
|
-
|
|
5304
|
+
o[4] || (o[4] = h("div", { class: "rpt-title" }, "Rpt", -1)),
|
|
5243
5305
|
h("div", $U, [
|
|
5244
|
-
h("div", lF,
|
|
5306
|
+
h("div", lF, K(T(Q).currentBeat), 1)
|
|
5245
5307
|
]),
|
|
5246
|
-
|
|
5308
|
+
o[5] || (o[5] = h("div", { class: "beat-title" }, "Beat", -1))
|
|
5247
5309
|
], 64)),
|
|
5248
|
-
c.value ? (
|
|
5310
|
+
c.value ? (N(), y("div", UF, [
|
|
5249
5311
|
h("div", FF, [
|
|
5250
|
-
(
|
|
5312
|
+
(N(!0), y(nl, null, Xl(z.value, (k) => (N(), y("div", {
|
|
5251
5313
|
key: k,
|
|
5252
|
-
class:
|
|
5253
|
-
onClick: (
|
|
5254
|
-
},
|
|
5314
|
+
class: L(["mark-option", { selected: k === n.value }]),
|
|
5315
|
+
onClick: (I) => p(k, I)
|
|
5316
|
+
}, K(k), 11, dF))), 128))
|
|
5255
5317
|
])
|
|
5256
|
-
])) :
|
|
5318
|
+
])) : _("", !0)
|
|
5257
5319
|
], 2));
|
|
5258
5320
|
}
|
|
5259
|
-
},
|
|
5321
|
+
}, ZF = /* @__PURE__ */ H(tF, [["__scopeId", "data-v-6281baf2"]]), QF = { class: "title" }, VF = {
|
|
5260
5322
|
__name: "BaseNumericInput",
|
|
5261
5323
|
props: /* @__PURE__ */ Sl({
|
|
5262
5324
|
title: {
|
|
@@ -5293,23 +5355,23 @@ const OU = {
|
|
|
5293
5355
|
},
|
|
5294
5356
|
formatValue: {
|
|
5295
5357
|
type: Function,
|
|
5296
|
-
default: (
|
|
5358
|
+
default: (t) => t.toString()
|
|
5297
5359
|
},
|
|
5298
5360
|
parseValue: {
|
|
5299
5361
|
type: Function,
|
|
5300
|
-
default: (
|
|
5362
|
+
default: (t) => parseFloat(t)
|
|
5301
5363
|
},
|
|
5302
5364
|
validateInput: {
|
|
5303
5365
|
type: Function,
|
|
5304
|
-
default: (
|
|
5366
|
+
default: (t) => t.replace(/[^0-9.]/g, "")
|
|
5305
5367
|
},
|
|
5306
5368
|
transformSliderToDisplay: {
|
|
5307
5369
|
type: Function,
|
|
5308
|
-
default: (
|
|
5370
|
+
default: (t) => t
|
|
5309
5371
|
},
|
|
5310
5372
|
transformDisplayToSlider: {
|
|
5311
5373
|
type: Function,
|
|
5312
|
-
default: (
|
|
5374
|
+
default: (t) => t
|
|
5313
5375
|
},
|
|
5314
5376
|
maxChars: {
|
|
5315
5377
|
type: Number,
|
|
@@ -5320,28 +5382,28 @@ const OU = {
|
|
|
5320
5382
|
valueModifiers: {}
|
|
5321
5383
|
}),
|
|
5322
5384
|
emits: ["update:value"],
|
|
5323
|
-
setup(
|
|
5324
|
-
|
|
5325
|
-
"0d0963e0":
|
|
5326
|
-
"4ad34b2f":
|
|
5327
|
-
"02156786":
|
|
5385
|
+
setup(t) {
|
|
5386
|
+
Ul((R) => ({
|
|
5387
|
+
"0d0963e0": t.textColor,
|
|
5388
|
+
"4ad34b2f": t.backgroundColor,
|
|
5389
|
+
"02156786": t.color,
|
|
5328
5390
|
"715a9528": a.value,
|
|
5329
5391
|
"30d64f7d": V.value,
|
|
5330
|
-
b8fbe65e:
|
|
5392
|
+
b8fbe65e: t.focusColor
|
|
5331
5393
|
}));
|
|
5332
|
-
const l =
|
|
5333
|
-
|
|
5334
|
-
const R = l.transformSliderToDisplay(
|
|
5394
|
+
const l = t, U = f("el"), { width: F, height: d } = Fl(U), Z = $(t, "value"), Q = x(l.formatValue(l.transformSliderToDisplay(Z.value)));
|
|
5395
|
+
v(Z, () => {
|
|
5396
|
+
const R = l.transformSliderToDisplay(Z.value);
|
|
5335
5397
|
Q.value = l.formatValue(R);
|
|
5336
|
-
}),
|
|
5398
|
+
}), v(Q, () => {
|
|
5337
5399
|
Q.value = l.validateInput(Q.value), l.maxChars && Q.value.length > l.maxChars && (Q.value = Q.value.slice(0, l.maxChars));
|
|
5338
5400
|
});
|
|
5339
5401
|
const V = J(() => Math.min(d.value / 2.25, F.value / 2.2) + "px"), a = J(() => Math.min(F.value / 3, d.value / 6.4) + "px");
|
|
5340
5402
|
function n() {
|
|
5341
5403
|
const R = l.parseValue(Q.value), m = l.transformDisplayToSlider(R);
|
|
5342
|
-
|
|
5404
|
+
Z.value = Math.min(Math.max(m, l.sliderMin), l.sliderMax);
|
|
5343
5405
|
}
|
|
5344
|
-
return (R, m) => (
|
|
5406
|
+
return (R, m) => (N(), y("div", {
|
|
5345
5407
|
class: "outer",
|
|
5346
5408
|
ref_key: "el",
|
|
5347
5409
|
ref: U
|
|
@@ -5357,38 +5419,38 @@ const OU = {
|
|
|
5357
5419
|
}, null, 544), [
|
|
5358
5420
|
[Hl, Q.value]
|
|
5359
5421
|
]),
|
|
5360
|
-
h("div", QF,
|
|
5361
|
-
|
|
5422
|
+
h("div", QF, K(t.title), 1),
|
|
5423
|
+
C(Wl, {
|
|
5362
5424
|
class: "slider",
|
|
5363
|
-
value:
|
|
5364
|
-
"onUpdate:value": m[1] || (m[1] = (e) =>
|
|
5365
|
-
"thumb-length":
|
|
5366
|
-
max:
|
|
5367
|
-
min:
|
|
5425
|
+
value: Z.value,
|
|
5426
|
+
"onUpdate:value": m[1] || (m[1] = (e) => Z.value = e),
|
|
5427
|
+
"thumb-length": t.thumbLength,
|
|
5428
|
+
max: t.sliderMax,
|
|
5429
|
+
min: t.sliderMin
|
|
5368
5430
|
}, null, 8, ["value", "thumb-length", "max", "min"])
|
|
5369
5431
|
], 512));
|
|
5370
5432
|
}
|
|
5371
|
-
},
|
|
5433
|
+
}, UU = /* @__PURE__ */ H(VF, [["__scopeId", "data-v-79c7a539"]]), aF = {
|
|
5372
5434
|
__name: "SpeedInput",
|
|
5373
|
-
setup(
|
|
5374
|
-
const l =
|
|
5435
|
+
setup(t) {
|
|
5436
|
+
const l = dl(), U = Vl(), F = J({
|
|
5375
5437
|
get: () => Math.log2(l.playbackSpeed) * 0.5 + 0.5,
|
|
5376
5438
|
set: (n) => {
|
|
5377
5439
|
const R = Math.pow(2, n * 2 - 1);
|
|
5378
5440
|
U.setPlaybackSpeed(R);
|
|
5379
5441
|
}
|
|
5380
|
-
}), d = (n) => Math.floor(Math.pow(2, n * 2 - 1) * 100 + 0.5) + "",
|
|
5442
|
+
}), d = (n) => Math.floor(Math.pow(2, n * 2 - 1) * 100 + 0.5) + "", Z = (n) => parseFloat(n), Q = (n) => n.replace(/\D/g, ""), V = (n) => n, a = (n) => {
|
|
5381
5443
|
const R = Math.log2(n / 100) * 0.5 + 0.5;
|
|
5382
5444
|
return Math.min(Math.max(R, 0), 1);
|
|
5383
5445
|
};
|
|
5384
|
-
return (n, R) => (
|
|
5446
|
+
return (n, R) => (N(), Rl(UU, {
|
|
5385
5447
|
value: F.value,
|
|
5386
5448
|
"onUpdate:value": R[0] || (R[0] = (m) => F.value = m),
|
|
5387
5449
|
title: "Speed",
|
|
5388
5450
|
color: "#336",
|
|
5389
5451
|
"text-color": "#aad",
|
|
5390
5452
|
"format-value": d,
|
|
5391
|
-
"parse-value":
|
|
5453
|
+
"parse-value": Z,
|
|
5392
5454
|
"validate-input": Q,
|
|
5393
5455
|
"transform-slider-to-display": V,
|
|
5394
5456
|
"transform-display-to-slider": a,
|
|
@@ -5398,23 +5460,23 @@ const OU = {
|
|
|
5398
5460
|
}
|
|
5399
5461
|
}, nF = {
|
|
5400
5462
|
__name: "TimeInput",
|
|
5401
|
-
setup(
|
|
5402
|
-
const l =
|
|
5403
|
-
return (n, R) => (
|
|
5404
|
-
value:
|
|
5463
|
+
setup(t) {
|
|
5464
|
+
const l = dl(), U = ll(), F = Vl(), d = (n) => n.toFixed(1), Z = (n) => parseFloat(n), Q = (n) => n.replace(/[^0-9.]/g, ""), V = (n) => n, a = (n) => n;
|
|
5465
|
+
return (n, R) => (N(), Rl(UU, {
|
|
5466
|
+
value: T(l).currentTime,
|
|
5405
5467
|
"onUpdate:value": [
|
|
5406
|
-
R[0] || (R[0] = (m) =>
|
|
5407
|
-
|
|
5468
|
+
R[0] || (R[0] = (m) => T(l).currentTime = m),
|
|
5469
|
+
T(F).setTime
|
|
5408
5470
|
],
|
|
5409
5471
|
title: "Time",
|
|
5410
5472
|
color: "#344",
|
|
5411
5473
|
"focus-color": "#556868",
|
|
5412
5474
|
"text-color": "#acc",
|
|
5413
5475
|
"background-color": "#111117",
|
|
5414
|
-
"slider-max":
|
|
5476
|
+
"slider-max": T(U).totalDuration,
|
|
5415
5477
|
"slider-min": 0,
|
|
5416
5478
|
"format-value": d,
|
|
5417
|
-
"parse-value":
|
|
5479
|
+
"parse-value": Z,
|
|
5418
5480
|
"validate-input": Q,
|
|
5419
5481
|
"transform-slider-to-display": V,
|
|
5420
5482
|
"transform-display-to-slider": a,
|
|
@@ -5423,20 +5485,20 @@ const OU = {
|
|
|
5423
5485
|
}
|
|
5424
5486
|
}, RF = { class: "inner" }, mF = {
|
|
5425
5487
|
__name: "AudioButton",
|
|
5426
|
-
setup(
|
|
5427
|
-
const l =
|
|
5428
|
-
return (d,
|
|
5429
|
-
class:
|
|
5488
|
+
setup(t) {
|
|
5489
|
+
const l = x(!1), U = () => l.value = !0, F = () => l.value = !1;
|
|
5490
|
+
return (d, Z) => (N(), y("div", {
|
|
5491
|
+
class: L(["button-outer", { down: l.value }]),
|
|
5430
5492
|
onPointerdown: U,
|
|
5431
5493
|
onPointerup: F,
|
|
5432
5494
|
onPointerleave: F
|
|
5433
5495
|
}, [
|
|
5434
5496
|
h("div", RF, [
|
|
5435
|
-
|
|
5497
|
+
Ql(d.$slots, "default", {}, void 0, !0)
|
|
5436
5498
|
])
|
|
5437
5499
|
], 34));
|
|
5438
5500
|
}
|
|
5439
|
-
},
|
|
5501
|
+
}, tl = /* @__PURE__ */ H(mF, [["__scopeId", "data-v-0d7af06e"]]), eF = { class: "outer" }, WF = { class: "title" }, cF = { class: "buttons" }, bF = {
|
|
5440
5502
|
class: "icon",
|
|
5441
5503
|
viewBox: "0 0 48 48"
|
|
5442
5504
|
}, sF = ["d"], hF = {
|
|
@@ -5449,125 +5511,118 @@ const OU = {
|
|
|
5449
5511
|
}
|
|
5450
5512
|
},
|
|
5451
5513
|
emits: ["menu-click"],
|
|
5452
|
-
setup(
|
|
5453
|
-
const U =
|
|
5454
|
-
function V() {
|
|
5455
|
-
t.isPlaying ? Q.stop() : Q.play();
|
|
5456
|
-
}
|
|
5514
|
+
setup(t, { emit: l }) {
|
|
5515
|
+
const U = t, F = l, d = ll(), Z = dl(), Q = fl(), V = Vl();
|
|
5457
5516
|
function a() {
|
|
5458
|
-
|
|
5459
|
-
let L = null;
|
|
5460
|
-
for (let Y = G.length - 1; Y >= 0; Y--)
|
|
5461
|
-
if (G[Y].time < E) {
|
|
5462
|
-
L = G[Y];
|
|
5463
|
-
break;
|
|
5464
|
-
}
|
|
5465
|
-
L && Q.setBar(L.bar, L.repeat);
|
|
5517
|
+
Z.isPlaying ? V.stop() : V.play();
|
|
5466
5518
|
}
|
|
5467
5519
|
function n() {
|
|
5468
|
-
const
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
L && Q.setBar(L.bar, L.repeat);
|
|
5520
|
+
const Y = Q.navigationPoints;
|
|
5521
|
+
if (Q.lastNavigationAction === "pause" && Q.lastPlayStartTime !== null) {
|
|
5522
|
+
V.setTime(Q.lastPlayStartTime), Q.setNavigationAction(null);
|
|
5523
|
+
return;
|
|
5524
|
+
}
|
|
5525
|
+
const p = Z.currentTime, r = Y.filter((q) => q.time < p - 0.01).pop();
|
|
5526
|
+
r && V.setTime(r.time);
|
|
5476
5527
|
}
|
|
5477
5528
|
function R() {
|
|
5478
|
-
Q.
|
|
5529
|
+
const Y = Q.navigationPoints, p = Z.currentTime, r = Y.find((q) => q.time > p + 0.01);
|
|
5530
|
+
r && V.setTime(r.time);
|
|
5531
|
+
}
|
|
5532
|
+
function m() {
|
|
5533
|
+
V.playStartingNotes();
|
|
5479
5534
|
}
|
|
5480
|
-
const
|
|
5535
|
+
const e = J(() => Z.metronomeEnabled), c = J(() => Z.leadInEnabled), b = x(!1), B = x(null);
|
|
5481
5536
|
function u() {
|
|
5482
5537
|
if (U.externalMenuControl) {
|
|
5483
|
-
F("menu-click"),
|
|
5484
|
-
console.warn("Audio system pre-initialization failed:",
|
|
5538
|
+
F("menu-click"), V.audioEngine.initializeAudioSystem().catch((Y) => {
|
|
5539
|
+
console.warn("Audio system pre-initialization failed:", Y);
|
|
5485
5540
|
});
|
|
5486
5541
|
return;
|
|
5487
5542
|
}
|
|
5488
|
-
|
|
5489
|
-
console.warn("Audio system pre-initialization failed:",
|
|
5543
|
+
b.value = !b.value, b.value && V.audioEngine.initializeAudioSystem().catch((Y) => {
|
|
5544
|
+
console.warn("Audio system pre-initialization failed:", Y);
|
|
5490
5545
|
});
|
|
5491
5546
|
}
|
|
5492
|
-
function
|
|
5493
|
-
|
|
5547
|
+
function X() {
|
|
5548
|
+
b.value = !1;
|
|
5494
5549
|
}
|
|
5495
|
-
function
|
|
5496
|
-
|
|
5550
|
+
function E(Y) {
|
|
5551
|
+
B.value && !B.value.contains(Y.target) && X();
|
|
5497
5552
|
}
|
|
5498
5553
|
bl(() => {
|
|
5499
|
-
document.addEventListener("click",
|
|
5554
|
+
document.addEventListener("click", E);
|
|
5500
5555
|
}), cl(() => {
|
|
5501
|
-
document.removeEventListener("click",
|
|
5556
|
+
document.removeEventListener("click", E);
|
|
5502
5557
|
});
|
|
5503
|
-
function
|
|
5504
|
-
|
|
5558
|
+
function z() {
|
|
5559
|
+
V.toggleMetronome();
|
|
5505
5560
|
}
|
|
5506
|
-
function
|
|
5507
|
-
|
|
5561
|
+
function D() {
|
|
5562
|
+
V.toggleLeadIn();
|
|
5508
5563
|
}
|
|
5509
|
-
const
|
|
5510
|
-
get: () =>
|
|
5511
|
-
set: (
|
|
5512
|
-
}),
|
|
5513
|
-
get: () =>
|
|
5514
|
-
set: (
|
|
5564
|
+
const g = J({
|
|
5565
|
+
get: () => Z.masterVolume,
|
|
5566
|
+
set: (Y) => Z.setMasterVolume(Y)
|
|
5567
|
+
}), j = J({
|
|
5568
|
+
get: () => Z.metronomeVolume,
|
|
5569
|
+
set: (Y) => Z.setMetronomeVolume(Y)
|
|
5515
5570
|
});
|
|
5516
|
-
return (
|
|
5571
|
+
return (Y, p) => (N(), y("div", eF, [
|
|
5517
5572
|
h("div", WF, [
|
|
5518
|
-
|
|
5573
|
+
C(Ol, {
|
|
5519
5574
|
class: "text",
|
|
5520
5575
|
align: "centre"
|
|
5521
5576
|
}, {
|
|
5522
|
-
default:
|
|
5523
|
-
Nl(
|
|
5577
|
+
default: w(() => [
|
|
5578
|
+
Nl(K(T(d).title), 1)
|
|
5524
5579
|
]),
|
|
5525
5580
|
_: 1
|
|
5526
5581
|
}),
|
|
5527
5582
|
h("div", {
|
|
5528
5583
|
class: "menu-container",
|
|
5529
5584
|
ref_key: "menuRef",
|
|
5530
|
-
ref:
|
|
5585
|
+
ref: B
|
|
5531
5586
|
}, [
|
|
5532
|
-
(
|
|
5587
|
+
(N(), y("svg", {
|
|
5533
5588
|
class: "menu",
|
|
5534
5589
|
viewBox: "0 -960 960 960",
|
|
5535
5590
|
onClick: u
|
|
5536
|
-
},
|
|
5591
|
+
}, p[2] || (p[2] = [
|
|
5537
5592
|
h("path", { d: "M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z" }, null, -1)
|
|
5538
5593
|
]))),
|
|
5539
|
-
!
|
|
5594
|
+
!t.externalMenuControl && b.value && Y.$slots.menu ? (N(), y("div", {
|
|
5540
5595
|
key: 0,
|
|
5541
5596
|
class: "dropdown-menu",
|
|
5542
|
-
onClick:
|
|
5597
|
+
onClick: X
|
|
5543
5598
|
}, [
|
|
5544
|
-
|
|
5545
|
-
])) :
|
|
5599
|
+
Ql(Y.$slots, "menu", {}, void 0, !0)
|
|
5600
|
+
])) : _("", !0)
|
|
5546
5601
|
], 512)
|
|
5547
5602
|
]),
|
|
5548
|
-
|
|
5603
|
+
C(Wl, {
|
|
5549
5604
|
class: "main",
|
|
5550
5605
|
colour: "red",
|
|
5551
|
-
value:
|
|
5552
|
-
"onUpdate:value":
|
|
5606
|
+
value: g.value,
|
|
5607
|
+
"onUpdate:value": p[0] || (p[0] = (r) => g.value = r)
|
|
5553
5608
|
}, null, 8, ["value"]),
|
|
5554
|
-
|
|
5609
|
+
C(Wl, {
|
|
5555
5610
|
class: "tick",
|
|
5556
5611
|
colour: "blue",
|
|
5557
|
-
value:
|
|
5558
|
-
"onUpdate:value":
|
|
5612
|
+
value: j.value,
|
|
5613
|
+
"onUpdate:value": p[1] || (p[1] = (r) => j.value = r)
|
|
5559
5614
|
}, null, 8, ["value"]),
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5615
|
+
p[8] || (p[8] = h("div", { class: "main-t" }, "Main", -1)),
|
|
5616
|
+
p[9] || (p[9] = h("div", { class: "tick-t" }, "Tick", -1)),
|
|
5617
|
+
C(ZF, { class: "bar" }),
|
|
5618
|
+
C(nF, { class: "time" }),
|
|
5619
|
+
C(aF, { class: "speed" }),
|
|
5565
5620
|
h("div", cF, [
|
|
5566
|
-
|
|
5621
|
+
C(tl, {
|
|
5567
5622
|
class: "button",
|
|
5568
|
-
onClick:
|
|
5623
|
+
onClick: n
|
|
5569
5624
|
}, {
|
|
5570
|
-
default:
|
|
5625
|
+
default: w(() => p[3] || (p[3] = [
|
|
5571
5626
|
h("svg", {
|
|
5572
5627
|
class: "icon",
|
|
5573
5628
|
viewBox: "0 0 48 48"
|
|
@@ -5578,24 +5633,24 @@ const OU = {
|
|
|
5578
5633
|
_: 1,
|
|
5579
5634
|
__: [3]
|
|
5580
5635
|
}),
|
|
5581
|
-
|
|
5636
|
+
C(tl, {
|
|
5582
5637
|
class: "button",
|
|
5583
|
-
onClick:
|
|
5638
|
+
onClick: a
|
|
5584
5639
|
}, {
|
|
5585
|
-
default:
|
|
5586
|
-
(
|
|
5640
|
+
default: w(() => [
|
|
5641
|
+
(N(), y("svg", bF, [
|
|
5587
5642
|
h("path", {
|
|
5588
|
-
d:
|
|
5643
|
+
d: T(Z).isPlaying ? "M27.4 35.4V12.6h8v22.8Zm-14.8 0V12.6h8.05v22.8Z" : "M16 37.85v-28l22 14Z"
|
|
5589
5644
|
}, null, 8, sF)
|
|
5590
5645
|
]))
|
|
5591
5646
|
]),
|
|
5592
5647
|
_: 1
|
|
5593
5648
|
}),
|
|
5594
|
-
|
|
5649
|
+
C(tl, {
|
|
5595
5650
|
class: "button",
|
|
5596
|
-
onClick:
|
|
5651
|
+
onClick: R
|
|
5597
5652
|
}, {
|
|
5598
|
-
default:
|
|
5653
|
+
default: w(() => p[4] || (p[4] = [
|
|
5599
5654
|
h("svg", {
|
|
5600
5655
|
class: "icon",
|
|
5601
5656
|
viewBox: "0 0 48 48"
|
|
@@ -5606,39 +5661,39 @@ const OU = {
|
|
|
5606
5661
|
_: 1,
|
|
5607
5662
|
__: [4]
|
|
5608
5663
|
}),
|
|
5609
|
-
|
|
5664
|
+
C(tl, {
|
|
5610
5665
|
class: "button",
|
|
5611
|
-
onClick:
|
|
5666
|
+
onClick: z
|
|
5612
5667
|
}, {
|
|
5613
|
-
default:
|
|
5614
|
-
(
|
|
5615
|
-
class:
|
|
5668
|
+
default: w(() => [
|
|
5669
|
+
(N(), y("svg", {
|
|
5670
|
+
class: L(["icon", e.value ? "on" : "off"]),
|
|
5616
5671
|
viewBox: "-128 -128 768 768"
|
|
5617
|
-
},
|
|
5672
|
+
}, p[5] || (p[5] = [
|
|
5618
5673
|
h("path", { d: "m 463.84136,154.89339 c -6.42,-6.42 -16.83,-6.42 -23.251,0 -71.31197,70.35135 -136.61146,132.25426 -208.741,199.7 h -105.82 c 23.35495,-140.1063 67.13099,-217.59716 120.727,-318.357996 0.86,-0.803 2.209,-0.801 3.067,-10e-4 20.50653,37.383983 48.51152,88.812606 72.26194,147.190756 1.186,9.002 12.2214,17.4338 23.3242,11.71391 9.002,-1.186 11.1594,-12.2324 9.9724,-21.2344 -21.69905,-53.89113 -30.43965,-85.078342 -83.11454,-161.702266 -13.446,-12.55299965 -34.508,-12.55699965 -47.954,10e-4 C 126.80877,149.30021 96.099465,324.74626 77.091365,474.25139 c -2.829,21.473 13.907,40.535 35.543995,40.535 h 271.311 c 21.661,0 38.373,-19.087 35.544,-40.535 -8.26237,-52.34207 -14.88466,-100.7074 -24.7871,-157.02622 -6.40949,-11.78839 -8.3911,-14.9907 -17.4031,-13.8037 -9.002,1.186 -13.59751,8.0528 -12.41051,17.0548 l 5.66371,34.11712 h -83.159 c 64.35441,-63.86663 129.29308,-130.29894 176.448,-176.449 6.42,-6.42 6.42,-16.83 -10e-4,-23.251 z m -88.956,232.582 12.004,91.074 c 0.112,0.846 -0.148,1.701 -0.708,2.341 -0.566,0.645 -1.38,1.014 -2.235,1.014 h -271.311 c -0.855,0 -1.668,-0.369 -2.231,-1.011 -0.564,-0.643 -0.824,-1.499 -0.712,-2.347 l 12.003,-91.072 h 253.19 z" }, null, -1)
|
|
5619
5674
|
]), 2))
|
|
5620
5675
|
]),
|
|
5621
5676
|
_: 1
|
|
5622
5677
|
}),
|
|
5623
|
-
|
|
5678
|
+
C(tl, {
|
|
5624
5679
|
class: "button",
|
|
5625
|
-
onClick:
|
|
5680
|
+
onClick: D
|
|
5626
5681
|
}, {
|
|
5627
|
-
default:
|
|
5628
|
-
(
|
|
5629
|
-
class:
|
|
5682
|
+
default: w(() => [
|
|
5683
|
+
(N(), y("svg", {
|
|
5684
|
+
class: L(["icon", c.value ? "on" : "off"]),
|
|
5630
5685
|
viewBox: "-2 -2 28 28"
|
|
5631
|
-
},
|
|
5686
|
+
}, p[6] || (p[6] = [
|
|
5632
5687
|
h("path", { d: "m 8.9838564,1.5166215 v 2 h 5.9999996 v -2 z m 2.9999996,3 c -4.9699996,0 -8.9999996,4.0299999 -8.9999996,8.9999995 0,4.97 4.02,9 8.9999996,9 4.98,0 9,-4.03 9,-9 0,-2.12 -0.740703,-4.0693745 -1.970703,-5.6093745 l 1.419922,-1.421875 c -0.43,-0.51 -0.900156,-0.9882031 -1.410156,-1.4082031 l -1.419922,1.4199219 c -1.55,-1.24 -3.499141,-1.9804688 -5.619141,-1.9804688 z m -1.789062,4.7480469 6,4.4999996 -6,4.5 z" }, null, -1)
|
|
5633
5688
|
]), 2))
|
|
5634
5689
|
]),
|
|
5635
5690
|
_: 1
|
|
5636
5691
|
}),
|
|
5637
|
-
|
|
5692
|
+
C(tl, {
|
|
5638
5693
|
class: "button",
|
|
5639
|
-
onClick:
|
|
5694
|
+
onClick: m
|
|
5640
5695
|
}, {
|
|
5641
|
-
default:
|
|
5696
|
+
default: w(() => p[7] || (p[7] = [
|
|
5642
5697
|
h("svg", {
|
|
5643
5698
|
class: "icon",
|
|
5644
5699
|
viewBox: "0 -960 960 960"
|
|
@@ -5653,7 +5708,7 @@ const OU = {
|
|
|
5653
5708
|
])
|
|
5654
5709
|
]));
|
|
5655
5710
|
}
|
|
5656
|
-
}, BF = /* @__PURE__ */
|
|
5711
|
+
}, BF = /* @__PURE__ */ H(hF, [["__scopeId", "data-v-5e330688"]]), iF = { class: "init-progress" }, uF = {
|
|
5657
5712
|
key: 0,
|
|
5658
5713
|
class: "progress-track"
|
|
5659
5714
|
}, JF = { class: "message-container" }, GF = {
|
|
@@ -5685,23 +5740,23 @@ const OU = {
|
|
|
5685
5740
|
default: null
|
|
5686
5741
|
}
|
|
5687
5742
|
},
|
|
5688
|
-
setup(
|
|
5689
|
-
const l =
|
|
5690
|
-
return (
|
|
5691
|
-
U.value ? (
|
|
5743
|
+
setup(t) {
|
|
5744
|
+
const l = t, U = J(() => l.progress !== null), F = J(() => l.progress === null ? 0 : Math.max(0, Math.min(100, l.progress * 100))), d = J(() => l.hasError ? l.errorMessage : l.message);
|
|
5745
|
+
return (Z, Q) => (N(), y("div", iF, [
|
|
5746
|
+
U.value ? (N(), y("div", uF, [
|
|
5692
5747
|
h("div", {
|
|
5693
5748
|
class: "progress-fill",
|
|
5694
5749
|
style: gl({ width: `${F.value}%` })
|
|
5695
5750
|
}, null, 4)
|
|
5696
|
-
])) :
|
|
5751
|
+
])) : _("", !0),
|
|
5697
5752
|
h("div", JF, [
|
|
5698
5753
|
h("div", {
|
|
5699
|
-
class:
|
|
5700
|
-
},
|
|
5754
|
+
class: L(["message", { error: t.hasError }])
|
|
5755
|
+
}, K(d.value), 3)
|
|
5701
5756
|
])
|
|
5702
5757
|
]));
|
|
5703
5758
|
}
|
|
5704
|
-
}, oF = /* @__PURE__ */
|
|
5759
|
+
}, oF = /* @__PURE__ */ H(GF, [["__scopeId", "data-v-a9ed87f2"]]), SF = sl("initialization", {
|
|
5705
5760
|
state: () => ({
|
|
5706
5761
|
// Current initialization stage
|
|
5707
5762
|
currentStage: null,
|
|
@@ -5725,15 +5780,15 @@ const OU = {
|
|
|
5725
5780
|
* @param {string} event.message - Human-readable message
|
|
5726
5781
|
* @param {number} [event.progress] - Optional progress (0-1)
|
|
5727
5782
|
*/
|
|
5728
|
-
updateProgress(
|
|
5729
|
-
this.currentStage =
|
|
5783
|
+
updateProgress(t) {
|
|
5784
|
+
this.currentStage = t.stage, this.message = t.message, this.progress = t.progress ?? null, t.stage === "ready" ? (this.isInitializing = !1, this.isReady = !0) : (this.isInitializing = !0, this.isReady = !1), this.hasError = !1, this.errorMessage = null;
|
|
5730
5785
|
},
|
|
5731
5786
|
/**
|
|
5732
5787
|
* Set error state
|
|
5733
5788
|
* @param {string} message - Error message
|
|
5734
5789
|
*/
|
|
5735
|
-
setError(
|
|
5736
|
-
this.hasError = !0, this.errorMessage =
|
|
5790
|
+
setError(t) {
|
|
5791
|
+
this.hasError = !0, this.errorMessage = t, this.isInitializing = !1, this.isReady = !1;
|
|
5737
5792
|
},
|
|
5738
5793
|
/**
|
|
5739
5794
|
* Reset initialization state
|
|
@@ -5746,8 +5801,8 @@ const OU = {
|
|
|
5746
5801
|
* Should be called once during app startup
|
|
5747
5802
|
*/
|
|
5748
5803
|
initializeListeners() {
|
|
5749
|
-
|
|
5750
|
-
this.updateProgress(
|
|
5804
|
+
s.on("initProgress", (t) => {
|
|
5805
|
+
this.updateProgress(t);
|
|
5751
5806
|
});
|
|
5752
5807
|
}
|
|
5753
5808
|
},
|
|
@@ -5755,12 +5810,12 @@ const OU = {
|
|
|
5755
5810
|
/**
|
|
5756
5811
|
* Whether to show the progress indicator
|
|
5757
5812
|
*/
|
|
5758
|
-
shouldShowProgress: (
|
|
5813
|
+
shouldShowProgress: (t) => t.isInitializing || t.hasError,
|
|
5759
5814
|
/**
|
|
5760
5815
|
* Whether the progress bar should be visible
|
|
5761
5816
|
* Only show for stages that have progress data
|
|
5762
5817
|
*/
|
|
5763
|
-
hasProgressBar: (
|
|
5818
|
+
hasProgressBar: (t) => t.progress !== null
|
|
5764
5819
|
}
|
|
5765
5820
|
}), XF = { class: "container" }, NF = { class: "panel" }, pF = {
|
|
5766
5821
|
key: 0,
|
|
@@ -5780,19 +5835,19 @@ const OU = {
|
|
|
5780
5835
|
}
|
|
5781
5836
|
},
|
|
5782
5837
|
emits: ["menu-click"],
|
|
5783
|
-
setup(
|
|
5784
|
-
|
|
5838
|
+
setup(t, { emit: l }) {
|
|
5839
|
+
Ul((b) => ({
|
|
5785
5840
|
"3579bdbc": m.value,
|
|
5786
5841
|
"3572ead6": e.value,
|
|
5787
5842
|
"78cf8203": c.value
|
|
5788
5843
|
}));
|
|
5789
|
-
const U =
|
|
5844
|
+
const U = t, F = l, d = ll(), Z = dl(), Q = SF();
|
|
5790
5845
|
bl(() => {
|
|
5791
5846
|
Q.initializeListeners();
|
|
5792
5847
|
});
|
|
5793
|
-
const V =
|
|
5794
|
-
const
|
|
5795
|
-
return
|
|
5848
|
+
const V = f("container"), { width: a } = Fl(V), n = J(() => Z.isLoaded), R = J(() => {
|
|
5849
|
+
const b = a.value, B = d.parts.length;
|
|
5850
|
+
return b < 640 || b < Cl * B + zl ? 0 : b < xl * B + Il ? 1 : b < Ml * B + vl ? 2 : 3;
|
|
5796
5851
|
}), m = J(() => {
|
|
5797
5852
|
switch (R.value) {
|
|
5798
5853
|
case 0:
|
|
@@ -5816,54 +5871,54 @@ const OU = {
|
|
|
5816
5871
|
return `${Ml}px `.repeat(d.parts.length) + `${vl}px`;
|
|
5817
5872
|
}
|
|
5818
5873
|
}), c = J(() => {
|
|
5819
|
-
const
|
|
5820
|
-
return R.value > 0 ? '"' +
|
|
5874
|
+
const b = [...d.parts.keys()];
|
|
5875
|
+
return R.value > 0 ? '"' + b.map((B) => "part" + B).join(" ") + ' controls"' : '"controls" ' + b.map((B) => '"part' + B + '"').join(" ");
|
|
5821
5876
|
});
|
|
5822
|
-
return (
|
|
5877
|
+
return (b, B) => (N(), y("div", {
|
|
5823
5878
|
class: "outer",
|
|
5824
5879
|
ref_key: "container",
|
|
5825
5880
|
ref: V
|
|
5826
5881
|
}, [
|
|
5827
5882
|
h("div", XF, [
|
|
5828
5883
|
h("div", NF, [
|
|
5829
|
-
(
|
|
5830
|
-
key:
|
|
5831
|
-
class:
|
|
5832
|
-
name:
|
|
5833
|
-
volume:
|
|
5834
|
-
"onUpdate:volume": (
|
|
5835
|
-
solo:
|
|
5836
|
-
"onUpdate:solo": (
|
|
5837
|
-
mute:
|
|
5838
|
-
"onUpdate:mute": (
|
|
5884
|
+
(N(!0), y(nl, null, Xl(T(d).parts, (u, X) => (N(), Rl(AU, {
|
|
5885
|
+
key: u.name,
|
|
5886
|
+
class: L("part" + X),
|
|
5887
|
+
name: u.name,
|
|
5888
|
+
volume: u.volume,
|
|
5889
|
+
"onUpdate:volume": (E) => u.volume = E,
|
|
5890
|
+
solo: u.solo,
|
|
5891
|
+
"onUpdate:solo": (E) => u.solo = E,
|
|
5892
|
+
mute: u.mute,
|
|
5893
|
+
"onUpdate:mute": (E) => u.mute = E,
|
|
5839
5894
|
ref_for: !0,
|
|
5840
5895
|
ref: "parts"
|
|
5841
5896
|
}, null, 8, ["class", "name", "volume", "onUpdate:volume", "solo", "onUpdate:solo", "mute", "onUpdate:mute"]))), 128)),
|
|
5842
|
-
|
|
5843
|
-
title:
|
|
5897
|
+
C(BF, {
|
|
5898
|
+
title: T(d).title,
|
|
5844
5899
|
"external-menu-control": U.externalMenuControl,
|
|
5845
|
-
onMenuClick:
|
|
5900
|
+
onMenuClick: B[0] || (B[0] = (u) => F("menu-click")),
|
|
5846
5901
|
class: "controls"
|
|
5847
5902
|
}, {
|
|
5848
|
-
menu:
|
|
5849
|
-
|
|
5903
|
+
menu: w(() => [
|
|
5904
|
+
Ql(b.$slots, "menu", {}, void 0, !0)
|
|
5850
5905
|
]),
|
|
5851
5906
|
_: 3
|
|
5852
5907
|
}, 8, ["title", "external-menu-control"]),
|
|
5853
|
-
n.value ?
|
|
5854
|
-
U.showInitProgress &&
|
|
5908
|
+
n.value ? _("", !0) : (N(), y("div", pF)),
|
|
5909
|
+
U.showInitProgress && T(Q).shouldShowProgress ? (N(), Rl(oF, {
|
|
5855
5910
|
key: 1,
|
|
5856
|
-
stage:
|
|
5857
|
-
message:
|
|
5858
|
-
progress:
|
|
5859
|
-
"has-error":
|
|
5860
|
-
"error-message":
|
|
5861
|
-
}, null, 8, ["stage", "message", "progress", "has-error", "error-message"])) :
|
|
5911
|
+
stage: T(Q).currentStage,
|
|
5912
|
+
message: T(Q).message,
|
|
5913
|
+
progress: T(Q).progress,
|
|
5914
|
+
"has-error": T(Q).hasError,
|
|
5915
|
+
"error-message": T(Q).errorMessage
|
|
5916
|
+
}, null, 8, ["stage", "message", "progress", "has-error", "error-message"])) : _("", !0)
|
|
5862
5917
|
])
|
|
5863
5918
|
])
|
|
5864
5919
|
], 512));
|
|
5865
5920
|
}
|
|
5866
|
-
}, HF = /* @__PURE__ */
|
|
5921
|
+
}, HF = /* @__PURE__ */ H(rF, [["__scopeId", "data-v-7163154f"]]), LF = { class: "outer" }, CF = { class: "mid" }, xF = { class: "inner" }, MF = {
|
|
5867
5922
|
key: 0,
|
|
5868
5923
|
class: "content"
|
|
5869
5924
|
}, zF = {
|
|
@@ -5878,24 +5933,24 @@ const OU = {
|
|
|
5878
5933
|
default: ""
|
|
5879
5934
|
}
|
|
5880
5935
|
},
|
|
5881
|
-
setup(
|
|
5882
|
-
return
|
|
5883
|
-
"66bea586":
|
|
5884
|
-
})), (l, U) => (
|
|
5936
|
+
setup(t) {
|
|
5937
|
+
return Ul((l) => ({
|
|
5938
|
+
"66bea586": t.colour
|
|
5939
|
+
})), (l, U) => (N(), y("div", LF, [
|
|
5885
5940
|
h("div", CF, [
|
|
5886
5941
|
h("div", xF, [
|
|
5887
|
-
|
|
5888
|
-
Nl(
|
|
5889
|
-
|
|
5890
|
-
])) :
|
|
5942
|
+
t.text || l.$slots.default ? (N(), y("div", MF, [
|
|
5943
|
+
Nl(K(t.text) + " ", 1),
|
|
5944
|
+
Ql(l.$slots, "default", {}, void 0, !0)
|
|
5945
|
+
])) : _("", !0)
|
|
5891
5946
|
])
|
|
5892
5947
|
])
|
|
5893
5948
|
]));
|
|
5894
5949
|
}
|
|
5895
|
-
}, DF = /* @__PURE__ */
|
|
5950
|
+
}, DF = /* @__PURE__ */ H(zF, [["__scopeId", "data-v-dff76c48"]]);
|
|
5896
5951
|
class IF {
|
|
5897
5952
|
constructor() {
|
|
5898
|
-
this.eventBus =
|
|
5953
|
+
this.eventBus = _l(), this.currentTime = 0, this.isPlaying = !1, this.playbackSpeed = 1, this.masterVolume = 0.75, this.parts = /* @__PURE__ */ new Map(), this.playbackTimer = null, this.lastTimestamp = 0;
|
|
5899
5954
|
}
|
|
5900
5955
|
// Initialize with musical data
|
|
5901
5956
|
initialize(l) {
|
|
@@ -6041,10 +6096,10 @@ class IF {
|
|
|
6041
6096
|
}
|
|
6042
6097
|
new IF();
|
|
6043
6098
|
export {
|
|
6044
|
-
|
|
6099
|
+
tl as AudioButton,
|
|
6045
6100
|
Wl as AudioSlider,
|
|
6046
|
-
|
|
6047
|
-
|
|
6101
|
+
ZF as BarInput,
|
|
6102
|
+
UU as BaseNumericInput,
|
|
6048
6103
|
ol as DEV_MODE,
|
|
6049
6104
|
IF as DummyAudioEngine,
|
|
6050
6105
|
oF as InitializationProgress,
|
|
@@ -6055,14 +6110,14 @@ export {
|
|
|
6055
6110
|
aF as SpeedInput,
|
|
6056
6111
|
nF as TimeInput,
|
|
6057
6112
|
Ol as TitleText,
|
|
6058
|
-
|
|
6113
|
+
EU as TriState,
|
|
6059
6114
|
PU as audioEngineConfig,
|
|
6060
6115
|
Al as isDevFeature,
|
|
6061
6116
|
KF as isDevMode,
|
|
6062
|
-
|
|
6063
|
-
|
|
6117
|
+
dl as useAudioStateStore,
|
|
6118
|
+
Fl as useElementSize,
|
|
6064
6119
|
SF as useInitializationState,
|
|
6065
6120
|
Vl as useMasterAudioControl,
|
|
6066
|
-
|
|
6067
|
-
|
|
6121
|
+
ll as useMusicDataStore,
|
|
6122
|
+
fl as usePlaybackStateStore
|
|
6068
6123
|
};
|