@webmusic/kernel 0.2.0 → 0.4.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/LICENSE +202 -21
- package/NOTICE +2 -0
- package/README.md +103 -64
- package/dist/audio-context.cjs.map +1 -1
- package/dist/build-receipt.json +3 -3
- package/dist/chunk-27LH6QLZ.cjs +277 -0
- package/dist/chunk-27LH6QLZ.cjs.map +1 -0
- package/dist/chunk-3INDOVUC.cjs.map +1 -1
- package/dist/chunk-3RR2VIKA.js +393 -0
- package/dist/chunk-3RR2VIKA.js.map +1 -0
- package/dist/chunk-3YTKIKKX.cjs +378 -0
- package/dist/chunk-3YTKIKKX.cjs.map +1 -0
- package/dist/chunk-4RG4WQKC.js +360 -0
- package/dist/chunk-4RG4WQKC.js.map +1 -0
- package/dist/chunk-5AHVQXTF.cjs +620 -0
- package/dist/chunk-5AHVQXTF.cjs.map +1 -0
- package/dist/chunk-624KWJWZ.js +170 -0
- package/dist/chunk-624KWJWZ.js.map +1 -0
- package/dist/chunk-6HGFEKD3.cjs +851 -0
- package/dist/chunk-6HGFEKD3.cjs.map +1 -0
- package/dist/chunk-7ZTZZ5PN.cjs.map +1 -1
- package/dist/chunk-ALWV4P7D.js +726 -0
- package/dist/chunk-ALWV4P7D.js.map +1 -0
- package/dist/chunk-BADJJ6DV.cjs +143 -0
- package/dist/chunk-BADJJ6DV.cjs.map +1 -0
- package/dist/chunk-C3LMS36L.cjs +393 -0
- package/dist/chunk-C3LMS36L.cjs.map +1 -0
- package/dist/chunk-C3YWUZW3.cjs.map +1 -1
- package/dist/chunk-CR6OUWBJ.cjs +726 -0
- package/dist/chunk-CR6OUWBJ.cjs.map +1 -0
- package/dist/chunk-CYWDZLWC.js +2141 -0
- package/dist/chunk-CYWDZLWC.js.map +1 -0
- package/dist/chunk-DDOGX2D5.js +378 -0
- package/dist/chunk-DDOGX2D5.js.map +1 -0
- package/dist/chunk-DVN6E5U3.js +620 -0
- package/dist/chunk-DVN6E5U3.js.map +1 -0
- package/dist/chunk-EURMRU2S.js +208 -0
- package/dist/chunk-EURMRU2S.js.map +1 -0
- package/dist/chunk-EXDCK2VL.cjs +20 -0
- package/dist/chunk-EXDCK2VL.cjs.map +1 -0
- package/dist/chunk-G5EIUP52.js +114 -0
- package/dist/chunk-G5EIUP52.js.map +1 -0
- package/dist/chunk-GB4DGKLZ.js +143 -0
- package/dist/chunk-GB4DGKLZ.js.map +1 -0
- package/dist/chunk-GPOEAYOW.js +2147 -0
- package/dist/chunk-GPOEAYOW.js.map +1 -0
- package/dist/chunk-I4YMA5VM.cjs +120 -0
- package/dist/chunk-I4YMA5VM.cjs.map +1 -0
- package/dist/chunk-IVWHMDCB.cjs +4383 -0
- package/dist/chunk-IVWHMDCB.cjs.map +1 -0
- package/dist/chunk-JFCBJMA7.cjs +2147 -0
- package/dist/chunk-JFCBJMA7.cjs.map +1 -0
- package/dist/chunk-JLVSAZ3K.cjs +813 -0
- package/dist/chunk-JLVSAZ3K.cjs.map +1 -0
- package/dist/chunk-K7FYH6UG.cjs +208 -0
- package/dist/chunk-K7FYH6UG.cjs.map +1 -0
- package/dist/chunk-L4MYCETM.cjs +970 -0
- package/dist/chunk-L4MYCETM.cjs.map +1 -0
- package/dist/chunk-MNCMYNYL.js +970 -0
- package/dist/chunk-MNCMYNYL.js.map +1 -0
- package/dist/chunk-NT2BZ3QM.js +120 -0
- package/dist/chunk-NT2BZ3QM.js.map +1 -0
- package/dist/chunk-O7SA5GLC.js +277 -0
- package/dist/chunk-O7SA5GLC.js.map +1 -0
- package/dist/chunk-OCKAHITL.cjs +548 -0
- package/dist/chunk-OCKAHITL.cjs.map +1 -0
- package/dist/chunk-OTXYWCLA.js +206 -0
- package/dist/chunk-OTXYWCLA.js.map +1 -0
- package/dist/chunk-P6ZA63J7.js +548 -0
- package/dist/chunk-P6ZA63J7.js.map +1 -0
- package/dist/chunk-QLF3BOST.js +20 -0
- package/dist/chunk-QLF3BOST.js.map +1 -0
- package/dist/chunk-RCWFRZDR.js +4383 -0
- package/dist/chunk-RCWFRZDR.js.map +1 -0
- package/dist/chunk-RZBLPM3L.cjs +206 -0
- package/dist/chunk-RZBLPM3L.cjs.map +1 -0
- package/dist/chunk-TA3TNJZU.cjs +360 -0
- package/dist/chunk-TA3TNJZU.cjs.map +1 -0
- package/dist/chunk-TZSRPTQL.cjs +2141 -0
- package/dist/chunk-TZSRPTQL.cjs.map +1 -0
- package/dist/chunk-UMTPJ76S.cjs.map +1 -1
- package/dist/chunk-UY77FXDW.js +813 -0
- package/dist/chunk-UY77FXDW.js.map +1 -0
- package/dist/chunk-VFU3S7OC.js +851 -0
- package/dist/chunk-VFU3S7OC.js.map +1 -0
- package/dist/chunk-VY6WWZSW.cjs.map +1 -1
- package/dist/chunk-WN5DZOVT.cjs +170 -0
- package/dist/chunk-WN5DZOVT.cjs.map +1 -0
- package/dist/chunk-WOPW6WLR.cjs.map +1 -1
- package/dist/chunk-XBSIYUHM.cjs +114 -0
- package/dist/chunk-XBSIYUHM.cjs.map +1 -0
- package/dist/chunk-ZMU72HJS.cjs.map +1 -1
- package/dist/context-DSa0ymyN.d.cts +664 -0
- package/dist/context-DaxfAg3b.d.ts +664 -0
- package/dist/effect-chain-Cu03O5Y0.d.ts +91 -0
- package/dist/effect-chain-Do75T7uK.d.cts +91 -0
- package/dist/effect.cjs +16 -1
- package/dist/effect.cjs.map +1 -1
- package/dist/effect.d.cts +56 -14
- package/dist/effect.d.ts +56 -14
- package/dist/effect.js +16 -1
- package/dist/elements.cjs +37 -2
- package/dist/elements.cjs.map +1 -1
- package/dist/elements.d.cts +197 -8
- package/dist/elements.d.ts +197 -8
- package/dist/elements.js +36 -1
- package/dist/events.cjs.map +1 -1
- package/dist/index.cjs +555 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -4
- package/dist/index.d.ts +16 -4
- package/dist/index.js +566 -19
- package/dist/message.cjs +104 -0
- package/dist/message.cjs.map +1 -0
- package/dist/message.d.cts +738 -0
- package/dist/message.d.ts +738 -0
- package/dist/message.js +104 -0
- package/dist/meter.cjs.map +1 -1
- package/dist/module-control-C25BMtH7.d.ts +61 -0
- package/dist/module-control-yH6nTJM9.d.cts +61 -0
- package/dist/module-plugin-BnPmq1VP.d.ts +198 -0
- package/dist/module-plugin-CHb-5W0Y.d.cts +198 -0
- package/dist/module.cjs +263 -0
- package/dist/module.cjs.map +1 -0
- package/dist/module.d.cts +1112 -0
- package/dist/module.d.ts +1112 -0
- package/dist/module.js +263 -0
- package/dist/parameter-DwQzFmBR.d.cts +172 -0
- package/dist/parameter-DwQzFmBR.d.ts +172 -0
- package/dist/player.cjs.map +1 -1
- package/dist/processor-worklet.cjs +18 -0
- package/dist/processor-worklet.cjs.map +1 -0
- package/dist/processor-worklet.d.cts +166 -0
- package/dist/processor-worklet.d.ts +166 -0
- package/dist/processor-worklet.js +18 -0
- package/dist/processor-worklet.js.map +1 -0
- package/dist/processor.cjs +51 -0
- package/dist/processor.cjs.map +1 -0
- package/dist/processor.d.cts +397 -0
- package/dist/processor.d.ts +397 -0
- package/dist/processor.js +51 -0
- package/dist/processor.js.map +1 -0
- package/dist/project-types-BU4awMnL.d.ts +323 -0
- package/dist/project-types-DufCV8Ma.d.cts +323 -0
- package/dist/ring-C-i9N90a.d.cts +139 -0
- package/dist/ring-DkcMt2Eg.d.ts +139 -0
- package/dist/sequence.cjs +68 -0
- package/dist/sequence.cjs.map +1 -0
- package/dist/sequence.d.cts +303 -0
- package/dist/sequence.d.ts +303 -0
- package/dist/sequence.js +68 -0
- package/dist/sequence.js.map +1 -0
- package/dist/session.cjs +16 -0
- package/dist/session.cjs.map +1 -0
- package/dist/session.d.cts +407 -0
- package/dist/session.d.ts +407 -0
- package/dist/session.js +16 -0
- package/dist/session.js.map +1 -0
- package/dist/tick.cjs.map +1 -1
- package/dist/transport.cjs +50 -2
- package/dist/transport.cjs.map +1 -1
- package/dist/transport.d.cts +145 -1
- package/dist/transport.d.ts +145 -1
- package/dist/transport.js +51 -3
- package/dist/worker.cjs.map +1 -1
- package/package.json +61 -10
- package/dist/chunk-53YD73OY.js +0 -162
- package/dist/chunk-53YD73OY.js.map +0 -1
- package/dist/chunk-54JYWB5X.cjs +0 -1051
- package/dist/chunk-54JYWB5X.cjs.map +0 -1
- package/dist/chunk-BR63OD53.cjs +0 -1
- package/dist/chunk-BR63OD53.cjs.map +0 -1
- package/dist/chunk-ON64FRCF.js +0 -1051
- package/dist/chunk-ON64FRCF.js.map +0 -1
- package/dist/chunk-SM5YPDDI.cjs +0 -162
- package/dist/chunk-SM5YPDDI.cjs.map +0 -1
- package/dist/chunk-TEM2I2NN.js +0 -1
- package/dist/chunk-VVZX7DQ6.cjs +0 -254
- package/dist/chunk-VVZX7DQ6.cjs.map +0 -1
- package/dist/chunk-WNFGDB7B.js +0 -254
- package/dist/chunk-WNFGDB7B.js.map +0 -1
- package/dist/sync.cjs +0 -12
- package/dist/sync.cjs.map +0 -1
- package/dist/sync.d.cts +0 -307
- package/dist/sync.d.ts +0 -307
- package/dist/sync.js +0 -12
- /package/dist/{chunk-TEM2I2NN.js.map → message.js.map} +0 -0
- /package/dist/{sync.js.map → module.js.map} +0 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ParamHandle,
|
|
3
|
+
ParamSurface
|
|
4
|
+
} from "./chunk-DVN6E5U3.js";
|
|
5
|
+
|
|
6
|
+
// src/effect-generation-guard.ts
|
|
7
|
+
var effectGenerationGuards = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
|
|
9
|
+
// src/effect-chain.ts
|
|
10
|
+
var COMPATIBILITY_EFFECT_SLOT = "$compat";
|
|
11
|
+
var chainSequence = 0;
|
|
12
|
+
var InsertChain = class {
|
|
13
|
+
constructor(context, options = {}) {
|
|
14
|
+
this.context = context;
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.explicitSlots = Object.freeze([]);
|
|
17
|
+
this.active = Object.freeze([]);
|
|
18
|
+
this.graphRevision = 0;
|
|
19
|
+
this.ended = false;
|
|
20
|
+
this.editing = false;
|
|
21
|
+
this.sequence = 0;
|
|
22
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
23
|
+
this.id = options.id ?? `insert-chain-${++chainSequence}`;
|
|
24
|
+
if (!this.id) throw new Error("An InsertChain requires a nonempty id.");
|
|
25
|
+
this.input = context.createGain();
|
|
26
|
+
this.output = context.createGain();
|
|
27
|
+
const edge = { source: this.input, destination: this.output };
|
|
28
|
+
try {
|
|
29
|
+
edge.source.connect(edge.destination);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
try {
|
|
32
|
+
edge.source.disconnect(edge.destination);
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
this.edges = [edge];
|
|
38
|
+
}
|
|
39
|
+
get slots() {
|
|
40
|
+
return this.explicitSlots;
|
|
41
|
+
}
|
|
42
|
+
get instances() {
|
|
43
|
+
return this.active;
|
|
44
|
+
}
|
|
45
|
+
get revision() {
|
|
46
|
+
return this.graphRevision;
|
|
47
|
+
}
|
|
48
|
+
get disposed() {
|
|
49
|
+
return this.ended;
|
|
50
|
+
}
|
|
51
|
+
/** Replace explicit slots only; the legacy compatibility slot remains first. */
|
|
52
|
+
replace(slots) {
|
|
53
|
+
this.assertEditable();
|
|
54
|
+
if (slots.some((slot) => slot.id === COMPATIBILITY_EFFECT_SLOT)) {
|
|
55
|
+
throw new Error("The compatibility slot is managed by setCompatibility().");
|
|
56
|
+
}
|
|
57
|
+
this.update(slots, this.compatibility);
|
|
58
|
+
}
|
|
59
|
+
/** Add a slot or update it in place without reordering other declarations. */
|
|
60
|
+
setSlot(slot) {
|
|
61
|
+
const index = this.explicitSlots.findIndex((entry) => entry.id === slot.id);
|
|
62
|
+
const next = [...this.explicitSlots];
|
|
63
|
+
if (index === -1) next.push(slot);
|
|
64
|
+
else next[index] = slot;
|
|
65
|
+
this.replace(next);
|
|
66
|
+
}
|
|
67
|
+
removeSlot(id) {
|
|
68
|
+
if (id === COMPATIBILITY_EFFECT_SLOT) throw new Error("Use setCompatibility() for the compatibility slot.");
|
|
69
|
+
this.replace(this.explicitSlots.filter((slot) => slot.id !== id));
|
|
70
|
+
}
|
|
71
|
+
setCompatibility(recipe) {
|
|
72
|
+
this.assertEditable();
|
|
73
|
+
this.update(this.explicitSlots, recipe ? { id: COMPATIBILITY_EFFECT_SLOT, recipe } : void 0);
|
|
74
|
+
}
|
|
75
|
+
subscribe(listener) {
|
|
76
|
+
if (this.ended) return () => {
|
|
77
|
+
};
|
|
78
|
+
const subscription = { listener };
|
|
79
|
+
this.listeners.add(subscription);
|
|
80
|
+
return () => {
|
|
81
|
+
this.listeners.delete(subscription);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
dispose() {
|
|
85
|
+
if (this.ended) return;
|
|
86
|
+
this.ended = true;
|
|
87
|
+
this.graphRevision++;
|
|
88
|
+
const old = this.active;
|
|
89
|
+
const edges = this.edges;
|
|
90
|
+
this.active = Object.freeze([]);
|
|
91
|
+
this.explicitSlots = Object.freeze([]);
|
|
92
|
+
this.compatibility = void 0;
|
|
93
|
+
this.edges = [];
|
|
94
|
+
let failure;
|
|
95
|
+
for (const edge of [...edges].reverse()) {
|
|
96
|
+
try {
|
|
97
|
+
edge.source.disconnect(edge.destination);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
failure ?? (failure = error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
for (const instance of old) {
|
|
103
|
+
try {
|
|
104
|
+
this.retire(instance);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
failure ?? (failure = error);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
this.notify();
|
|
110
|
+
this.listeners.clear();
|
|
111
|
+
if (failure !== void 0) {
|
|
112
|
+
this.report(failure);
|
|
113
|
+
throw failure;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
assertEditable() {
|
|
117
|
+
if (this.ended) throw new Error("InsertChain is disposed.");
|
|
118
|
+
if (this.editing) throw new Error("InsertChain edits cannot re-enter graph construction.");
|
|
119
|
+
}
|
|
120
|
+
update(slots, compatibility) {
|
|
121
|
+
this.assertEditable();
|
|
122
|
+
slots = slots.map(snapshotSlot);
|
|
123
|
+
compatibility = compatibility && snapshotSlot(compatibility);
|
|
124
|
+
const declarations = compatibility ? [compatibility, ...slots] : [...slots];
|
|
125
|
+
const ids = /* @__PURE__ */ new Set();
|
|
126
|
+
for (const slot of declarations) {
|
|
127
|
+
if (!slot.id || ids.has(slot.id)) throw new Error(`Invalid or duplicate insert slot id: ${slot.id}`);
|
|
128
|
+
if (slot.ownership !== void 0 && slot.ownership !== "owned" && slot.ownership !== "borrowed") {
|
|
129
|
+
throw new Error("Invalid effect ownership.");
|
|
130
|
+
}
|
|
131
|
+
ids.add(slot.id);
|
|
132
|
+
}
|
|
133
|
+
const previousSlots = this.compatibility ? [this.compatibility, ...this.explicitSlots] : this.explicitSlots;
|
|
134
|
+
if (declarations.length === previousSlots.length && declarations.every((slot, index) => sameSlot(slot, previousSlots[index]))) return;
|
|
135
|
+
this.editing = true;
|
|
136
|
+
const previous = this.active;
|
|
137
|
+
const candidates = [];
|
|
138
|
+
const fresh = [];
|
|
139
|
+
const attempted = [];
|
|
140
|
+
const removed = [];
|
|
141
|
+
const nextEdges = [];
|
|
142
|
+
try {
|
|
143
|
+
for (const slot of declarations) {
|
|
144
|
+
const old = previous.find((instance2) => instance2.slotId === slot.id);
|
|
145
|
+
const oldSlot = previousSlots.find((entry) => entry.id === slot.id);
|
|
146
|
+
if (old && oldSlot && sameSlot(slot, oldSlot)) {
|
|
147
|
+
candidates.push(old);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const nodes = slot.recipe.createAudioNodes(this.context);
|
|
151
|
+
const ownership = slot.ownership ?? "owned";
|
|
152
|
+
if (effectGenerationGuards.get(this)?.(nodes)) {
|
|
153
|
+
throw new Error("An effect transition must return fresh generation nodes and parameters.");
|
|
154
|
+
}
|
|
155
|
+
if (old && nodes === old.nodes && ownership === old.ownership) {
|
|
156
|
+
const entries = Object.entries(nodes.params ?? {});
|
|
157
|
+
if (entries.length !== old.params.handles.length || entries.some(([id]) => {
|
|
158
|
+
const handle = old.params.get(id);
|
|
159
|
+
return !handle || !sameDescriptors({ [id]: handle.descriptor }, { [id]: fitDisplayRange({
|
|
160
|
+
...handle.descriptor,
|
|
161
|
+
...slot.recipe.parameterDescriptors?.[id],
|
|
162
|
+
...slot.parameterDescriptors?.[id]
|
|
163
|
+
}) });
|
|
164
|
+
})) throw new Error("An active effect bundle alias cannot change parameter metadata.");
|
|
165
|
+
candidates.push(Object.freeze({ ...old, recipe: slot.recipe }));
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const overlapsLive = previous.some((instance2) => overlaps(nodes, instance2.nodes)) || touches(nodes, this.input) || touches(nodes, this.output);
|
|
169
|
+
if (overlapsLive) throw new Error("An insert replacement must return fresh nodes or its exact active bundle.");
|
|
170
|
+
let instance;
|
|
171
|
+
try {
|
|
172
|
+
for (const node of [nodes.input, nodes.output]) {
|
|
173
|
+
if (!node || typeof node.connect !== "function" || typeof node.disconnect !== "function") {
|
|
174
|
+
throw new TypeError("An effect must return input and output AudioNodes.");
|
|
175
|
+
}
|
|
176
|
+
if (node.context !== void 0 && node.context !== this.context) throw new Error("Effect nodes belong to another audio context.");
|
|
177
|
+
}
|
|
178
|
+
if (candidates.some((candidate) => overlaps(nodes, candidate.nodes))) {
|
|
179
|
+
throw new Error("Insert slots cannot share effect input/output nodes.");
|
|
180
|
+
}
|
|
181
|
+
instance = Object.freeze({
|
|
182
|
+
id: `${this.id}/effect-${++this.sequence}`,
|
|
183
|
+
slotId: slot.id,
|
|
184
|
+
recipe: slot.recipe,
|
|
185
|
+
nodes,
|
|
186
|
+
params: this.parameters(nodes, slot),
|
|
187
|
+
ownership
|
|
188
|
+
});
|
|
189
|
+
fresh.push(instance);
|
|
190
|
+
candidates.push(instance);
|
|
191
|
+
} catch (error) {
|
|
192
|
+
if (!instance && ownership === "owned" && !candidates.some((candidate) => overlaps(nodes, candidate.nodes))) {
|
|
193
|
+
try {
|
|
194
|
+
nodes.dispose?.();
|
|
195
|
+
} catch (cleanupError) {
|
|
196
|
+
this.report(cleanupError);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
throw error;
|
|
200
|
+
}
|
|
201
|
+
if (this.ended) throw new Error("InsertChain was disposed during graph construction.");
|
|
202
|
+
}
|
|
203
|
+
if (this.ended) throw new Error("InsertChain was disposed during graph construction.");
|
|
204
|
+
let source = this.input;
|
|
205
|
+
for (const instance of candidates) {
|
|
206
|
+
nextEdges.push({ source, destination: instance.nodes.input });
|
|
207
|
+
source = instance.nodes.output;
|
|
208
|
+
}
|
|
209
|
+
nextEdges.push({ source, destination: this.output });
|
|
210
|
+
for (const edge of this.edges) {
|
|
211
|
+
if (nextEdges.some((next) => sameEdge(edge, next))) continue;
|
|
212
|
+
removed.push(edge);
|
|
213
|
+
edge.source.disconnect(edge.destination);
|
|
214
|
+
if (this.ended) throw new Error("InsertChain was disposed during graph construction.");
|
|
215
|
+
}
|
|
216
|
+
for (const edge of nextEdges) {
|
|
217
|
+
if (this.edges.some((old) => sameEdge(edge, old))) continue;
|
|
218
|
+
attempted.push(edge);
|
|
219
|
+
edge.source.connect(edge.destination);
|
|
220
|
+
if (this.ended) throw new Error("InsertChain was disposed during graph construction.");
|
|
221
|
+
}
|
|
222
|
+
} catch (error) {
|
|
223
|
+
for (const edge of attempted.reverse()) {
|
|
224
|
+
try {
|
|
225
|
+
edge.source.disconnect(edge.destination);
|
|
226
|
+
} catch (cleanupError) {
|
|
227
|
+
this.report(cleanupError);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (!this.ended) for (const edge of removed) {
|
|
231
|
+
try {
|
|
232
|
+
edge.source.connect(edge.destination);
|
|
233
|
+
} catch (cleanupError) {
|
|
234
|
+
this.report(cleanupError);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
for (const instance of fresh.reverse()) {
|
|
238
|
+
try {
|
|
239
|
+
this.retire(instance);
|
|
240
|
+
} catch (cleanupError) {
|
|
241
|
+
this.report(cleanupError);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
this.editing = false;
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
this.active = Object.freeze(candidates);
|
|
248
|
+
this.explicitSlots = Object.freeze(slots.map((slot) => Object.freeze({ ...slot })));
|
|
249
|
+
this.compatibility = compatibility && Object.freeze({ ...compatibility });
|
|
250
|
+
this.edges = nextEdges;
|
|
251
|
+
this.graphRevision++;
|
|
252
|
+
for (const instance of previous) {
|
|
253
|
+
if (candidates.some((candidate) => candidate.id === instance.id)) continue;
|
|
254
|
+
try {
|
|
255
|
+
this.retire(instance);
|
|
256
|
+
} catch (error) {
|
|
257
|
+
this.report(error);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
this.editing = false;
|
|
261
|
+
this.notify();
|
|
262
|
+
}
|
|
263
|
+
parameters(nodes, slot) {
|
|
264
|
+
const handles = [];
|
|
265
|
+
try {
|
|
266
|
+
for (const [id, parameter] of Object.entries(nodes.params ?? {})) {
|
|
267
|
+
const descriptor = this.parameterDescriptor(parameter, id, slot);
|
|
268
|
+
const native = descriptor.modulation === "audio-rate" || descriptor.modulation === "control-rate";
|
|
269
|
+
const handle = new ParamHandle(descriptor, {
|
|
270
|
+
baseValue: parameter.value,
|
|
271
|
+
...!native && { apply: (value) => {
|
|
272
|
+
parameter.value = value;
|
|
273
|
+
} }
|
|
274
|
+
});
|
|
275
|
+
handles.push(handle);
|
|
276
|
+
if (native) handle.bindAudioParam(this.context, parameter, { lazy: true });
|
|
277
|
+
}
|
|
278
|
+
return new ParamSurface(handles);
|
|
279
|
+
} catch (error) {
|
|
280
|
+
for (const handle of handles) {
|
|
281
|
+
try {
|
|
282
|
+
handle.dispose();
|
|
283
|
+
} catch {
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
throw error;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
parameterDescriptor(parameter, id, slot) {
|
|
290
|
+
const min = Number.isFinite(parameter.minValue) ? parameter.minValue : -Number.MAX_VALUE;
|
|
291
|
+
const max = Number.isFinite(parameter.maxValue) ? parameter.maxValue : Number.MAX_VALUE;
|
|
292
|
+
const rate = parameter.automationRate;
|
|
293
|
+
const descriptor = {
|
|
294
|
+
id,
|
|
295
|
+
unit: "native",
|
|
296
|
+
range: { min, max },
|
|
297
|
+
defaultValue: Number.isFinite(parameter.defaultValue) ? parameter.defaultValue : parameter.value,
|
|
298
|
+
updateTiming: rate === "a-rate" || rate === "k-rate" ? "scheduled" : "synchronous",
|
|
299
|
+
modulation: rate === "a-rate" ? "audio-rate" : rate === "k-rate" ? "control-rate" : "none",
|
|
300
|
+
...slot.recipe.parameterDescriptors?.[id],
|
|
301
|
+
...slot.parameterDescriptors?.[id]
|
|
302
|
+
};
|
|
303
|
+
return fitDisplayRange(descriptor);
|
|
304
|
+
}
|
|
305
|
+
retire(instance) {
|
|
306
|
+
let failure;
|
|
307
|
+
for (const handle of instance.params) {
|
|
308
|
+
try {
|
|
309
|
+
handle.dispose();
|
|
310
|
+
} catch (error) {
|
|
311
|
+
failure ?? (failure = error);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (instance.ownership === "owned") {
|
|
315
|
+
try {
|
|
316
|
+
instance.nodes.dispose?.();
|
|
317
|
+
} catch (error) {
|
|
318
|
+
failure ?? (failure = error);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (failure !== void 0) throw failure;
|
|
322
|
+
}
|
|
323
|
+
report(error) {
|
|
324
|
+
try {
|
|
325
|
+
this.options.onCleanupError?.(error);
|
|
326
|
+
} catch {
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
notify() {
|
|
330
|
+
const revision = this.graphRevision;
|
|
331
|
+
for (const subscription of [...this.listeners]) {
|
|
332
|
+
if (revision !== this.graphRevision) break;
|
|
333
|
+
if (!this.listeners.has(subscription)) continue;
|
|
334
|
+
try {
|
|
335
|
+
const result = subscription.listener(this);
|
|
336
|
+
if (result != null && typeof result.then === "function") {
|
|
337
|
+
void Promise.resolve(result).catch(() => {
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
} catch {
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
function sameSlot(left, right) {
|
|
346
|
+
return left.id === right.id && left.recipe === right.recipe && (left.ownership ?? "owned") === (right.ownership ?? "owned") && sameDescriptors(left.parameterDescriptors, right.parameterDescriptors);
|
|
347
|
+
}
|
|
348
|
+
function snapshotSlot(slot) {
|
|
349
|
+
const descriptors = slot.parameterDescriptors;
|
|
350
|
+
return Object.freeze({ ...slot, parameterDescriptors: descriptors && Object.freeze(Object.fromEntries(
|
|
351
|
+
Object.entries(descriptors).map(([id, descriptor]) => [id, Object.freeze({
|
|
352
|
+
...descriptor,
|
|
353
|
+
...descriptor.range && { range: Object.freeze({ ...descriptor.range }) },
|
|
354
|
+
...descriptor.displayRange && { displayRange: Object.freeze({ ...descriptor.displayRange }) }
|
|
355
|
+
})])
|
|
356
|
+
)) });
|
|
357
|
+
}
|
|
358
|
+
function sameDescriptors(left, right) {
|
|
359
|
+
if (left === right) return true;
|
|
360
|
+
if (!left || !right) return false;
|
|
361
|
+
const keys = Object.keys(left);
|
|
362
|
+
return keys.length === Object.keys(right).length && keys.every((key) => {
|
|
363
|
+
const a = left[key];
|
|
364
|
+
const b = right[key];
|
|
365
|
+
return b !== void 0 && a.label === b.label && a.unit === b.unit && a.defaultValue === b.defaultValue && a.step === b.step && a.scale === b.scale && a.updateTiming === b.updateTiming && a.modulation === b.modulation && a.range?.min === b.range?.min && a.range?.max === b.range?.max && a.displayRange?.min === b.displayRange?.min && a.displayRange?.max === b.displayRange?.max;
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
function sameEdge(left, right) {
|
|
369
|
+
return left.source === right.source && left.destination === right.destination;
|
|
370
|
+
}
|
|
371
|
+
function fitDisplayRange(descriptor) {
|
|
372
|
+
const display = descriptor.displayRange;
|
|
373
|
+
if (!display) return descriptor;
|
|
374
|
+
if (!Number.isFinite(display.min) || !Number.isFinite(display.max) || display.min > display.max) {
|
|
375
|
+
throw new RangeError("A suggested parameter displayRange must be finite and ordered.");
|
|
376
|
+
}
|
|
377
|
+
const min = Math.max(descriptor.range.min, display.min);
|
|
378
|
+
const max = Math.min(descriptor.range.max, display.max);
|
|
379
|
+
return { ...descriptor, displayRange: min <= max ? { min, max } : void 0 };
|
|
380
|
+
}
|
|
381
|
+
function touches(nodes, node) {
|
|
382
|
+
return nodes.input === node || nodes.output === node;
|
|
383
|
+
}
|
|
384
|
+
function overlaps(left, right) {
|
|
385
|
+
return touches(left, right.input) || touches(left, right.output);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export {
|
|
389
|
+
effectGenerationGuards,
|
|
390
|
+
COMPATIBILITY_EFFECT_SLOT,
|
|
391
|
+
InsertChain
|
|
392
|
+
};
|
|
393
|
+
//# sourceMappingURL=chunk-3RR2VIKA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/effect-generation-guard.ts","../src/effect-chain.ts"],"sourcesContent":["import type {EffectNodes, InsertChain} from './effect-chain';\n\n/** Internal ownership fence for chains temporarily sharing a transition rack. */\nexport const effectGenerationGuards = new WeakMap<InsertChain, (nodes: EffectNodes) => boolean>();\n","// ============================================================================\n// Effect contract shared by both families: an effect is anything with\n// `createAudioNodes(context) → {input, output}`. Canonical source is\n// @webaudio/play's shape — `BaseAudioContext` keeps it offline-render capable.\n// @webscore/play's Effect class adds a `createAudioNodes` method to satisfy it\n// structurally. InsertChain supplies shared transactional routing while recipes\n// keep ownership of their internal DSP and optional cleanup.\n// ============================================================================\n\nimport {ParamHandle, ParamSurface, type ParamDescriptor} from './module/parameter';\nimport {effectGenerationGuards} from './effect-generation-guard';\n\n\n/** A built effect sub-graph: signal enters `input`, leaves `output`. */\nexport interface EffectNodes {\n readonly input: AudioNode;\n readonly output: AudioNode;\n /** Live, adjustable parameters (e.g. `frequency`, `wet`) for real-time control. */\n params?: Record<string, AudioParam>;\n dispose?(): void;\n}\n\n/**\n * The structural Effect contract. The single method `createAudioNodes` lets\n * effects cross between the families by shape alone.\n */\nexport interface Effect {\n /** Optional label — UIs can caption controls with it. */\n label?: string;\n /** Real parameter units/ranges supplied by the recipe, never guessed by a UI. */\n parameterDescriptors?: Readonly<Record<string, Partial<Omit<ParamDescriptor, 'id'>>>>;\n /**\n * Realize a fresh graph for each call; sharing a recipe does not share nodes.\n * InsertChain also accepts its exact active-slot bundle as an alias, or an\n * explicitly borrowed slot whose graph remains owned by the caller.\n */\n createAudioNodes(context: BaseAudioContext): EffectNodes;\n}\n\nexport interface InsertSlot {\n readonly id: string;\n readonly recipe: Effect;\n /** Borrowed bundles are never disposed by this chain. */\n readonly ownership?: 'owned' | 'borrowed';\n readonly parameterDescriptors?: Effect['parameterDescriptors'];\n}\n\nexport interface EffectInstance {\n /** Stable realization identity; a slot replacement receives a new identity. */\n readonly id: string;\n readonly slotId: string;\n readonly recipe: Effect;\n readonly nodes: EffectNodes;\n readonly params: ParamSurface;\n readonly ownership: 'owned' | 'borrowed';\n}\n\nexport interface InsertChainOptions {\n readonly id?: string;\n /** Retirement errors occur after commit and cannot invalidate the new graph. */\n readonly onCleanupError?: (error: unknown) => void;\n}\n\ninterface Edge {readonly source: AudioNode; readonly destination: AudioNode}\n\nexport const COMPATIBILITY_EFFECT_SLOT = '$compat';\nlet chainSequence = 0;\n\n/**\n * An ordered insert graph with stable ports in either a live or offline context.\n * Logical replacement is transactional; Web Audio does not promise a hardware\n * atomic switch or a crossfade. Callers own connections outside these ports.\n */\nexport class InsertChain {\n readonly id: string;\n readonly input: GainNode;\n readonly output: GainNode;\n private explicitSlots: readonly InsertSlot[] = Object.freeze([]);\n private compatibility?: InsertSlot;\n private active: readonly EffectInstance[] = Object.freeze([]);\n private edges: readonly Edge[];\n private graphRevision = 0;\n private ended = false;\n private editing = false;\n private sequence = 0;\n private readonly listeners = new Set<{listener: (chain: InsertChain) => void}>();\n\n constructor(readonly context: BaseAudioContext, private readonly options: InsertChainOptions = {}) {\n this.id = options.id ?? `insert-chain-${++chainSequence}`;\n if (!this.id) throw new Error('An InsertChain requires a nonempty id.');\n this.input = context.createGain();\n this.output = context.createGain();\n const edge = {source: this.input, destination: this.output};\n try { edge.source.connect(edge.destination); } catch (error) {\n try { edge.source.disconnect(edge.destination); } catch { /* Preserve construction failure. */ }\n throw error;\n }\n this.edges = [edge];\n }\n\n get slots(): readonly InsertSlot[] { return this.explicitSlots; }\n get instances(): readonly EffectInstance[] { return this.active; }\n get revision(): number { return this.graphRevision; }\n get disposed(): boolean { return this.ended; }\n\n /** Replace explicit slots only; the legacy compatibility slot remains first. */\n replace(slots: readonly InsertSlot[]): void {\n this.assertEditable();\n if (slots.some((slot) => slot.id === COMPATIBILITY_EFFECT_SLOT)) {\n throw new Error('The compatibility slot is managed by setCompatibility().');\n }\n this.update(slots, this.compatibility);\n }\n\n /** Add a slot or update it in place without reordering other declarations. */\n setSlot(slot: InsertSlot): void {\n const index = this.explicitSlots.findIndex((entry) => entry.id === slot.id);\n const next = [...this.explicitSlots];\n if (index === -1) next.push(slot);\n else next[index] = slot;\n this.replace(next);\n }\n\n removeSlot(id: string): void {\n if (id === COMPATIBILITY_EFFECT_SLOT) throw new Error('Use setCompatibility() for the compatibility slot.');\n this.replace(this.explicitSlots.filter((slot) => slot.id !== id));\n }\n\n setCompatibility(recipe: Effect | undefined): void {\n this.assertEditable();\n this.update(this.explicitSlots, recipe ? {id: COMPATIBILITY_EFFECT_SLOT, recipe} : undefined);\n }\n\n subscribe(listener: (chain: InsertChain) => void): () => void {\n if (this.ended) return () => {};\n const subscription = {listener};\n this.listeners.add(subscription);\n return () => { this.listeners.delete(subscription); };\n }\n\n dispose(): void {\n if (this.ended) return;\n this.ended = true;\n this.graphRevision++;\n const old = this.active;\n const edges = this.edges;\n this.active = Object.freeze([]);\n this.explicitSlots = Object.freeze([]);\n this.compatibility = undefined;\n this.edges = [];\n let failure: unknown;\n for (const edge of [...edges].reverse()) {\n try { edge.source.disconnect(edge.destination); } catch (error) { failure ??= error; }\n }\n for (const instance of old) {\n try { this.retire(instance); } catch (error) { failure ??= error; }\n }\n this.notify();\n this.listeners.clear();\n if (failure !== undefined) {\n this.report(failure);\n throw failure;\n }\n }\n\n private assertEditable(): void {\n if (this.ended) throw new Error('InsertChain is disposed.');\n if (this.editing) throw new Error('InsertChain edits cannot re-enter graph construction.');\n }\n\n private update(slots: readonly InsertSlot[], compatibility: InsertSlot | undefined): void {\n this.assertEditable();\n // Builders are external callbacks. Freeze declarations before calling any\n // recipe so caller mutation cannot change the configuration being committed.\n slots = slots.map(snapshotSlot);\n compatibility = compatibility && snapshotSlot(compatibility);\n const declarations = compatibility ? [compatibility, ...slots] : [...slots];\n const ids = new Set<string>();\n for (const slot of declarations) {\n if (!slot.id || ids.has(slot.id)) throw new Error(`Invalid or duplicate insert slot id: ${slot.id}`);\n if (slot.ownership !== undefined && slot.ownership !== 'owned' && slot.ownership !== 'borrowed') {\n throw new Error('Invalid effect ownership.');\n }\n ids.add(slot.id);\n }\n const previousSlots = this.compatibility ? [this.compatibility, ...this.explicitSlots] : this.explicitSlots;\n if (declarations.length === previousSlots.length && declarations.every((slot, index) => sameSlot(slot, previousSlots[index]))) return;\n\n this.editing = true;\n const previous = this.active;\n const candidates: EffectInstance[] = [];\n const fresh: EffectInstance[] = [];\n const attempted: Edge[] = [];\n const removed: Edge[] = [];\n const nextEdges: Edge[] = [];\n try {\n for (const slot of declarations) {\n const old = previous.find((instance) => instance.slotId === slot.id);\n const oldSlot = previousSlots.find((entry) => entry.id === slot.id);\n if (old && oldSlot && sameSlot(slot, oldSlot)) {\n candidates.push(old);\n continue;\n }\n const nodes = slot.recipe.createAudioNodes(this.context);\n const ownership = slot.ownership ?? 'owned';\n // A transition rack may still own earlier generations. Reject aliases\n // before taking ownership: disposing a rejected alias would kill the\n // sounding graph that the transaction promises to preserve.\n if (effectGenerationGuards.get(this)?.(nodes)) {\n throw new Error('An effect transition must return fresh generation nodes and parameters.');\n }\n // An exact active bundle alias is safe only in its existing slot and\n // ownership. Partial overlap cannot safely invoke either disposer.\n if (old && nodes === old.nodes && ownership === old.ownership) {\n const entries = Object.entries(nodes.params ?? {});\n if (entries.length !== old.params.handles.length || entries.some(([id]) => {\n const handle = old.params.get(id);\n return !handle || !sameDescriptors({[id]: handle.descriptor}, {[id]: fitDisplayRange({\n ...handle.descriptor, ...slot.recipe.parameterDescriptors?.[id], ...slot.parameterDescriptors?.[id],\n })});\n })) throw new Error('An active effect bundle alias cannot change parameter metadata.');\n candidates.push(Object.freeze({...old, recipe: slot.recipe}));\n continue;\n }\n const overlapsLive = previous.some((instance) => overlaps(nodes, instance.nodes)) ||\n touches(nodes, this.input) || touches(nodes, this.output);\n if (overlapsLive) throw new Error('An insert replacement must return fresh nodes or its exact active bundle.');\n let instance: EffectInstance | undefined;\n try {\n for (const node of [nodes.input, nodes.output]) {\n if (!node || typeof node.connect !== 'function' || typeof node.disconnect !== 'function') {\n throw new TypeError('An effect must return input and output AudioNodes.');\n }\n if (node.context !== undefined && node.context !== this.context) throw new Error('Effect nodes belong to another audio context.');\n }\n if (candidates.some((candidate) => overlaps(nodes, candidate.nodes))) {\n throw new Error('Insert slots cannot share effect input/output nodes.');\n }\n instance = Object.freeze({\n id: `${this.id}/effect-${++this.sequence}`,\n slotId: slot.id,\n recipe: slot.recipe,\n nodes,\n params: this.parameters(nodes, slot),\n ownership,\n });\n fresh.push(instance);\n candidates.push(instance);\n } catch (error) {\n // Avoid invoking a second disposer for an aliased candidate graph.\n if (!instance && ownership === 'owned' && !candidates.some((candidate) => overlaps(nodes, candidate.nodes))) {\n try { nodes.dispose?.(); } catch (cleanupError) { this.report(cleanupError); }\n }\n throw error;\n }\n if (this.ended) throw new Error('InsertChain was disposed during graph construction.');\n }\n if (this.ended) throw new Error('InsertChain was disposed during graph construction.');\n let source: AudioNode = this.input;\n for (const instance of candidates) {\n nextEdges.push({source, destination: instance.nodes.input});\n source = instance.nodes.output;\n }\n nextEdges.push({source, destination: this.output});\n // Disconnect changing chain edges before adding new ones. In particular,\n // reversing A -> B must never briefly create an A -> B -> A feedback loop.\n for (const edge of this.edges) {\n if (nextEdges.some((next) => sameEdge(edge, next))) continue;\n removed.push(edge);\n edge.source.disconnect(edge.destination);\n if (this.ended) throw new Error('InsertChain was disposed during graph construction.');\n }\n for (const edge of nextEdges) {\n if (this.edges.some((old) => sameEdge(edge, old))) continue;\n attempted.push(edge);\n edge.source.connect(edge.destination);\n if (this.ended) throw new Error('InsertChain was disposed during graph construction.');\n }\n } catch (error) {\n // Restore only edges this transaction removed. Disposal is terminal and\n // must never be undone by an interrupted candidate's rollback.\n for (const edge of attempted.reverse()) {\n try { edge.source.disconnect(edge.destination); } catch (cleanupError) { this.report(cleanupError); }\n }\n if (!this.ended) for (const edge of removed) {\n try { edge.source.connect(edge.destination); } catch (cleanupError) { this.report(cleanupError); }\n }\n for (const instance of fresh.reverse()) {\n try { this.retire(instance); } catch (cleanupError) { this.report(cleanupError); }\n }\n this.editing = false;\n throw error;\n }\n\n this.active = Object.freeze(candidates);\n this.explicitSlots = Object.freeze(slots.map((slot) => Object.freeze({...slot})));\n this.compatibility = compatibility && Object.freeze({...compatibility});\n this.edges = nextEdges;\n this.graphRevision++;\n // Keep edits blocked while retiring old graphs: a custom disposer must not\n // recursively replace the graph halfway through this cleanup batch.\n for (const instance of previous) {\n if (candidates.some((candidate) => candidate.id === instance.id)) continue;\n try { this.retire(instance); } catch (error) { this.report(error); }\n }\n this.editing = false;\n this.notify();\n }\n\n private parameters(nodes: EffectNodes, slot: InsertSlot): ParamSurface {\n const handles: ParamHandle[] = [];\n try {\n for (const [id, parameter] of Object.entries(nodes.params ?? {})) {\n const descriptor = this.parameterDescriptor(parameter, id, slot);\n const native = descriptor.modulation === 'audio-rate' || descriptor.modulation === 'control-rate';\n const handle = new ParamHandle(descriptor, {\n baseValue: parameter.value,\n ...(!native && {apply: (value: number) => { parameter.value = value; }}),\n });\n handles.push(handle);\n // Native targets keep their intrinsic base until an explicit modulation\n // or automation command activates the shared CV bus.\n if (native) handle.bindAudioParam(this.context, parameter, {lazy: true});\n }\n return new ParamSurface(handles);\n } catch (error) {\n for (const handle of handles) {\n try { handle.dispose(); } catch { /* Preserve parameter construction failure. */ }\n }\n throw error;\n }\n }\n\n private parameterDescriptor(parameter: AudioParam, id: string, slot: InsertSlot): ParamDescriptor {\n const min = Number.isFinite(parameter.minValue) ? parameter.minValue : -Number.MAX_VALUE;\n const max = Number.isFinite(parameter.maxValue) ? parameter.maxValue : Number.MAX_VALUE;\n const rate = parameter.automationRate;\n const descriptor: ParamDescriptor = {\n id, unit: 'native', range: {min, max},\n defaultValue: Number.isFinite(parameter.defaultValue) ? parameter.defaultValue : parameter.value,\n updateTiming: rate === 'a-rate' || rate === 'k-rate' ? 'scheduled' : 'synchronous',\n modulation: rate === 'a-rate' ? 'audio-rate' : rate === 'k-rate' ? 'control-rate' : 'none',\n ...slot.recipe.parameterDescriptors?.[id], ...slot.parameterDescriptors?.[id],\n };\n return fitDisplayRange(descriptor);\n }\n\n private retire(instance: EffectInstance): void {\n let failure: unknown;\n for (const handle of instance.params) {\n try { handle.dispose(); } catch (error) { failure ??= error; }\n }\n if (instance.ownership === 'owned') {\n try { instance.nodes.dispose?.(); } catch (error) { failure ??= error; }\n }\n if (failure !== undefined) throw failure;\n }\n\n private report(error: unknown): void {\n try { this.options.onCleanupError?.(error); } catch { /* Diagnostics cannot change graph ownership. */ }\n }\n\n private notify(): void {\n const revision = this.graphRevision;\n for (const subscription of [...this.listeners]) {\n if (revision !== this.graphRevision) break;\n if (!this.listeners.has(subscription)) continue;\n try {\n const result: unknown = subscription.listener(this);\n if (result != null && typeof (result as {then?: unknown}).then === 'function') {\n void Promise.resolve(result).catch(() => {});\n }\n } catch { /* Observers cannot invalidate a committed graph. */ }\n }\n }\n}\n\nfunction sameSlot(left: InsertSlot, right: InsertSlot): boolean {\n return left.id === right.id && left.recipe === right.recipe &&\n (left.ownership ?? 'owned') === (right.ownership ?? 'owned') &&\n sameDescriptors(left.parameterDescriptors, right.parameterDescriptors);\n}\n\nfunction snapshotSlot(slot: InsertSlot): InsertSlot {\n const descriptors = slot.parameterDescriptors;\n return Object.freeze({...slot, parameterDescriptors: descriptors && Object.freeze(Object.fromEntries(\n Object.entries(descriptors).map(([id, descriptor]) => [id, Object.freeze({\n ...descriptor, ...(descriptor.range && {range: Object.freeze({...descriptor.range})}),\n ...(descriptor.displayRange && {displayRange: Object.freeze({...descriptor.displayRange})}),\n })]),\n ))});\n}\n\nfunction sameDescriptors(left: Effect['parameterDescriptors'], right: Effect['parameterDescriptors']): boolean {\n if (left === right) return true;\n if (!left || !right) return false;\n const keys = Object.keys(left);\n return keys.length === Object.keys(right).length && keys.every((key) => {\n const a = left[key];\n const b = right[key];\n return b !== undefined && a.label === b.label && a.unit === b.unit &&\n a.defaultValue === b.defaultValue && a.step === b.step && a.scale === b.scale &&\n a.updateTiming === b.updateTiming && a.modulation === b.modulation &&\n a.range?.min === b.range?.min && a.range?.max === b.range?.max &&\n a.displayRange?.min === b.displayRange?.min && a.displayRange?.max === b.displayRange?.max;\n });\n}\n\nfunction sameEdge(left: Edge, right: Edge): boolean {\n return left.source === right.source && left.destination === right.destination;\n}\n\nfunction fitDisplayRange(descriptor: ParamDescriptor): ParamDescriptor {\n const display = descriptor.displayRange;\n if (!display) return descriptor;\n if (!Number.isFinite(display.min) || !Number.isFinite(display.max) || display.min > display.max) {\n throw new RangeError('A suggested parameter displayRange must be finite and ordered.');\n }\n // A recipe's UI sweep may exceed this context's native limits, notably a\n // filter frequency in a low-sample-rate offline context. Legal writes remain\n // unchanged; an incompatible suggestion is omitted rather than inverted.\n const min = Math.max(descriptor.range.min, display.min);\n const max = Math.min(descriptor.range.max, display.max);\n return {...descriptor, displayRange: min <= max ? {min, max} : undefined};\n}\n\nfunction touches(nodes: EffectNodes, node: AudioNode): boolean {\n return nodes.input === node || nodes.output === node;\n}\n\nfunction overlaps(left: EffectNodes, right: EffectNodes): boolean {\n return touches(left, right.input) || touches(left, right.output);\n}\n"],"mappings":";;;;;;AAGO,IAAM,yBAAyB,oBAAI,QAAsD;;;AC8DzF,IAAM,4BAA4B;AACzC,IAAI,gBAAgB;AAOb,IAAM,cAAN,MAAkB;AAAA,EAcvB,YAAqB,SAA4C,UAA8B,CAAC,GAAG;AAA9E;AAA4C;AAVjE,SAAQ,gBAAuC,OAAO,OAAO,CAAC,CAAC;AAE/D,SAAQ,SAAoC,OAAO,OAAO,CAAC,CAAC;AAE5D,SAAQ,gBAAgB;AACxB,SAAQ,QAAQ;AAChB,SAAQ,UAAU;AAClB,SAAQ,WAAW;AACnB,SAAiB,YAAY,oBAAI,IAA8C;AAG7E,SAAK,KAAK,QAAQ,MAAM,gBAAgB,EAAE,aAAa;AACvD,QAAI,CAAC,KAAK,GAAI,OAAM,IAAI,MAAM,wCAAwC;AACtE,SAAK,QAAQ,QAAQ,WAAW;AAChC,SAAK,SAAS,QAAQ,WAAW;AACjC,UAAM,OAAO,EAAC,QAAQ,KAAK,OAAO,aAAa,KAAK,OAAM;AAC1D,QAAI;AAAE,WAAK,OAAO,QAAQ,KAAK,WAAW;AAAA,IAAG,SAAS,OAAO;AAC3D,UAAI;AAAE,aAAK,OAAO,WAAW,KAAK,WAAW;AAAA,MAAG,QAAQ;AAAA,MAAuC;AAC/F,YAAM;AAAA,IACR;AACA,SAAK,QAAQ,CAAC,IAAI;AAAA,EACpB;AAAA,EAEA,IAAI,QAA+B;AAAE,WAAO,KAAK;AAAA,EAAe;AAAA,EAChE,IAAI,YAAuC;AAAE,WAAO,KAAK;AAAA,EAAQ;AAAA,EACjE,IAAI,WAAmB;AAAE,WAAO,KAAK;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