@webmusic/bridge 0.0.0-stage → 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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "schema": 1,
3
+ "name": "@webmusic/bridge",
4
+ "version": "0.4.0",
5
+ "source": "d55d3ce32e3b31e2e5800c7eea7a48fae3f3d074eab5cd522d0bd5f027c45b6f",
6
+ "outputs": "8e96488116a8a0fca6db4820cb308a6737fb399d45bd4fa191d843fb2ae0279b"
7
+ }
@@ -0,0 +1,408 @@
1
+ var __typeError = (msg) => {
2
+ throw TypeError(msg);
3
+ };
4
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
+
10
+ // src/audio-participant.ts
11
+ function registerAudioParticipant(session, player, options) {
12
+ return session.register({
13
+ play: (when) => player.play(when),
14
+ pause: () => player.pause(),
15
+ stop: () => player.stop(),
16
+ seek: (seconds) => player.seek(seconds),
17
+ setRate: (rate) => player.setRate(rate),
18
+ get position() {
19
+ return player.seconds;
20
+ },
21
+ get running() {
22
+ return player.playing;
23
+ },
24
+ get clock() {
25
+ return player.clock;
26
+ }
27
+ }, {
28
+ axis: "clip-seconds",
29
+ identity: player,
30
+ durationSeconds: () => player.duration,
31
+ endPolicy: "position",
32
+ offsetSeconds: options.offsetSeconds,
33
+ positionScale: options.positionScale,
34
+ prepare: options.prepare,
35
+ // Only native buffer playback can follow the Session's scheduling anchor;
36
+ // document sequences, media and external transports follow by command,
37
+ // as they do under `<audio-player>`.
38
+ ...player.timingCapabilities.sharedSessionClock && {
39
+ activate: () => player.activateScheduling(),
40
+ attachScheduling: (binding) => player.attachScheduling(binding)
41
+ }
42
+ });
43
+ }
44
+
45
+ // src/project.ts
46
+ import { Score } from "@webmusic/score";
47
+ import { Effect, MidiAccessSource, ScorePlayerModule, ScoreRackModule, Sound, createMidiPlugins, soundModulePlugin } from "@webmusic/score/play/headless";
48
+ import { AudioClip } from "@webmusic/audio";
49
+ import { AudioClipPlayer, createBufferPlugins } from "@webmusic/audio/play/headless";
50
+ import { InsertChain } from "@webmusic/kernel/effect";
51
+ import { createMessagePlugins } from "@webmusic/kernel/message";
52
+ import {
53
+ AudioOutputPort,
54
+ ParamHandle,
55
+ ParamSurface,
56
+ createStructurePlugins,
57
+ routeModuleOutput
58
+ } from "@webmusic/kernel/module";
59
+ import { sequencerPlugin } from "@webmusic/kernel/sequence";
60
+ import { SessionLFO } from "@webmusic/kernel/session";
61
+ var version = "1.0.0";
62
+ var audioOutput = Object.freeze([{ id: "output", direction: "output", kind: "audio" }]);
63
+ var audioInsert = Object.freeze([{ id: "input", direction: "input", kind: "audio" }, ...audioOutput]);
64
+ function createWebMusicProjectPlugins(options = {}) {
65
+ const environment = options.modules ?? {};
66
+ return Object.freeze([
67
+ { id: "webmusic.score-player", version, create: createScore },
68
+ { id: "webmusic.audio-player", version, create: createAudio },
69
+ { id: "webmusic.score-rack", version, create: createRack },
70
+ { id: "webmusic.audio-bus", version, create: (request) => createInsert(request, Effect.gain(number(request.record.config, "gain", 1))) },
71
+ { id: "webmusic.effect", version, create: (request) => createInsert(request, effectRecipe(request.record.config)) },
72
+ { id: "webmusic.lfo", version, create: createLfo },
73
+ ...createMessagePlugins(environment),
74
+ ...createStructurePlugins(environment),
75
+ sequencerPlugin(environment),
76
+ ...createMidiPlugins(options.midi ?? new MidiAccessSource()),
77
+ soundModulePlugin(),
78
+ ...createBufferPlugins(environment)
79
+ ]);
80
+ }
81
+ async function createScore(request) {
82
+ const score = await request.resolveAsset("source");
83
+ request.signal.throwIfAborted();
84
+ if (!(score instanceof Score)) throw new TypeError("The score-player source asset must resolve to a Score.");
85
+ const config = request.record.config;
86
+ const sound = Sound.oscillator({ type: waveform(config.waveform) });
87
+ let module;
88
+ try {
89
+ module = new ScorePlayerModule(score, {
90
+ context: request.context,
91
+ id: request.record.id,
92
+ synth: sound,
93
+ synthOwnership: "owned",
94
+ reverb: false,
95
+ offsetSeconds: number(config, "offsetSeconds", 0),
96
+ positionScale: number(config, "positionScale", 1)
97
+ });
98
+ } catch (error) {
99
+ sound.dispose();
100
+ throw error;
101
+ }
102
+ return {
103
+ module,
104
+ ports: audioOutput,
105
+ childContext: (child) => child.derive({ id: child.id, target: module }),
106
+ exportConfig: () => config,
107
+ dispose: () => module.dispose()
108
+ };
109
+ }
110
+ async function createAudio(request) {
111
+ const clip = await request.resolveAsset("source");
112
+ request.signal.throwIfAborted();
113
+ if (!(clip instanceof AudioClip)) throw new TypeError("The audio-player source asset must resolve to an AudioClip.");
114
+ const { context, record } = request;
115
+ const player = new AudioClipPlayer(clip, { moduleContext: context });
116
+ const volume = new ParamHandle({ id: "volume", unit: "ratio", range: { min: 0, max: 1 }, defaultValue: 1, modulation: "none" }, { apply: (value) => player.setVolume(value) });
117
+ const pan = new ParamHandle({ id: "pan", unit: "ratio", range: { min: -1, max: 1 }, defaultValue: 0, modulation: "none" }, { apply: (value) => player.setPan(value) });
118
+ const params = new ParamSurface([volume, pan]);
119
+ let route;
120
+ let registration;
121
+ let participant;
122
+ let disposed = false;
123
+ const module = {
124
+ id: record.id,
125
+ params,
126
+ get inserts() {
127
+ return player.insertChain;
128
+ },
129
+ getPort: (name) => name === "output" ? player.peekOutputPort() : void 0,
130
+ prepare: async () => {
131
+ if (disposed) throw new Error("Project audio player has been disposed.");
132
+ await player.preload();
133
+ if (disposed) throw new Error("Project audio player preparation was cancelled.");
134
+ if (!route) {
135
+ const candidate = routeModuleOutput(context, module, player.outputPort);
136
+ if (disposed || !candidate.active) {
137
+ candidate.release();
138
+ throw new Error("Project audio player admission was cancelled.");
139
+ }
140
+ route = candidate;
141
+ }
142
+ }
143
+ };
144
+ const dispose = () => {
145
+ if (disposed) return;
146
+ disposed = true;
147
+ clean([
148
+ () => participant?.release(),
149
+ () => route?.release(),
150
+ () => registration?.release(),
151
+ () => volume.dispose(),
152
+ () => pan.dispose(),
153
+ () => player.dispose()
154
+ ]);
155
+ };
156
+ try {
157
+ registration = context.registry.register(module);
158
+ participant = context.session ? registerAudioParticipant(context.session, player, {
159
+ offsetSeconds: number(record.config, "offsetSeconds", 0),
160
+ positionScale: number(record.config, "positionScale", 1),
161
+ prepare: () => module.prepare()
162
+ }) : void 0;
163
+ } catch (error) {
164
+ try {
165
+ dispose();
166
+ } catch {
167
+ }
168
+ throw error;
169
+ }
170
+ return {
171
+ module,
172
+ ports: audioOutput,
173
+ childContext: (child) => child.derive({ id: child.id, target: module }),
174
+ exportConfig: () => record.config,
175
+ dispose
176
+ };
177
+ }
178
+ function rackChannels(config) {
179
+ const channels = config.channels ?? {};
180
+ if (channels === null || typeof channels !== "object" || Array.isArray(channels)) throw new TypeError("Rack channels must be an object keyed by stable module ID.");
181
+ const result = /* @__PURE__ */ Object.create(null);
182
+ for (const [id, value] of Object.entries(channels)) {
183
+ if (!id.trim() || value === null || typeof value !== "object" || Array.isArray(value)) throw new TypeError("Rack channel state requires a module ID and an object.");
184
+ const fields = value;
185
+ const state = {};
186
+ if (fields.volume !== void 0) {
187
+ const volume = number(fields, "volume", 1);
188
+ if (volume < 0 || volume > 1) throw new RangeError("Rack channel volume must be in [0, 1].");
189
+ state.volume = volume;
190
+ }
191
+ for (const key of ["muted", "solo"]) {
192
+ if (fields[key] !== void 0) {
193
+ if (typeof fields[key] !== "boolean") throw new TypeError(`Rack channel ${key} must be boolean.`);
194
+ state[key] = fields[key];
195
+ }
196
+ }
197
+ result[id] = state;
198
+ }
199
+ return result;
200
+ }
201
+ function createRack({ context, record }) {
202
+ const channels = rackChannels(record.config);
203
+ const masterVolume = number(record.config, "masterVolume", 1);
204
+ if (masterVolume < 0 || masterVolume > 1) throw new RangeError("Rack masterVolume must be in [0, 1].");
205
+ const rack = new ScoreRackModule(context, { id: record.id });
206
+ try {
207
+ rack.setMasterVolume(masterVolume);
208
+ } catch (error) {
209
+ rack.dispose();
210
+ throw error;
211
+ }
212
+ return {
213
+ module: rack,
214
+ ports: audioInsert,
215
+ getInput: (name) => name === "input" ? rack.input : void 0,
216
+ childContext: (child) => child.derive({ id: child.id, target: rack, admit: (module, port) => {
217
+ const lease = rack.admit(module, port);
218
+ try {
219
+ const state = channels[module.id];
220
+ if (state?.volume !== void 0) rack.setVolume(module.id, state.volume);
221
+ if (state?.muted !== void 0) rack.mute(module.id, state.muted);
222
+ if (state?.solo !== void 0) rack.solo(module.id, state.solo);
223
+ if (!lease.active) throw new Error("Rack channel admission was cancelled.");
224
+ return lease;
225
+ } catch (error) {
226
+ try {
227
+ lease.release();
228
+ } catch {
229
+ }
230
+ throw error;
231
+ }
232
+ } }),
233
+ exportConfig: () => ({
234
+ ...record.config,
235
+ masterVolume: rack.masterVolume,
236
+ channels: { ...Object.fromEntries(Object.entries(channels).map(([id, state]) => [id, { ...state }])), ...Object.fromEntries(rack.list().map((channel) => [channel.id, { volume: channel.volume, muted: channel.muted, solo: channel.solo }])) }
237
+ }),
238
+ dispose: () => rack.dispose()
239
+ };
240
+ }
241
+ function createInsert({ context, record }, recipe) {
242
+ let chain;
243
+ let port;
244
+ let route;
245
+ let disposed = false;
246
+ let preparing = false;
247
+ const module = {
248
+ id: record.id,
249
+ get params() {
250
+ return chain?.instances[0]?.params;
251
+ },
252
+ get inserts() {
253
+ return chain;
254
+ },
255
+ getPort: (name) => name === "output" ? port : void 0,
256
+ prepare: () => {
257
+ if (disposed) throw new Error("Project insert has been disposed.");
258
+ if (chain) return;
259
+ if (preparing) throw new Error("Project insert preparation cannot re-enter.");
260
+ preparing = true;
261
+ let candidate;
262
+ let candidateRoute;
263
+ let candidatePort;
264
+ try {
265
+ candidate = new InsertChain(context.audio.prepare());
266
+ candidate.setSlot({ id: "effect", recipe });
267
+ candidatePort = new AudioOutputPort(candidate.output, { id: `${record.id}:output` });
268
+ candidateRoute = routeModuleOutput(context, module, candidatePort);
269
+ if (disposed || !candidateRoute.active) throw new Error("Project insert admission was cancelled.");
270
+ chain = candidate;
271
+ port = candidatePort;
272
+ route = candidateRoute;
273
+ } catch (error) {
274
+ try {
275
+ candidateRoute?.release();
276
+ } catch {
277
+ }
278
+ try {
279
+ candidatePort?.dispose();
280
+ } catch {
281
+ }
282
+ try {
283
+ candidate?.dispose();
284
+ } catch {
285
+ }
286
+ throw error;
287
+ } finally {
288
+ preparing = false;
289
+ }
290
+ }
291
+ };
292
+ const registration = context.registry.register(module);
293
+ return {
294
+ module,
295
+ ports: audioInsert,
296
+ getInput: (name) => name === "input" ? chain?.input : void 0,
297
+ childContext: (child) => child.derive({ id: child.id, target: module, admit: null, destination: () => chain?.input }),
298
+ exportConfig: () => record.config,
299
+ dispose: () => {
300
+ if (disposed) return;
301
+ disposed = true;
302
+ clean([() => route?.release(), () => registration?.release(), () => port?.dispose(), () => chain?.dispose()]);
303
+ }
304
+ };
305
+ }
306
+ function createLfo({ context, record }) {
307
+ let lfo;
308
+ let params;
309
+ let disposed = false;
310
+ let preparing = false;
311
+ const module = {
312
+ id: record.id,
313
+ get params() {
314
+ return params;
315
+ },
316
+ prepare: () => {
317
+ if (disposed) throw new Error("Project LFO has been disposed.");
318
+ if (lfo) return;
319
+ if (preparing) throw new Error("Project LFO preparation cannot re-enter.");
320
+ if (!context.session) throw new Error("A project LFO requires a Session.");
321
+ const loop = record.config.loop ?? "repeat";
322
+ if (loop !== "repeat" && loop !== "once") throw new TypeError("LFO loop must be repeat or once.");
323
+ preparing = true;
324
+ try {
325
+ const candidate = new SessionLFO(context.audio.prepare(), context.session.scheduling, {
326
+ frequency: number(record.config, "frequency", 1),
327
+ phase: number(record.config, "phase", 0),
328
+ waveform: waveform(record.config.waveform),
329
+ loop
330
+ });
331
+ if (disposed) {
332
+ candidate.dispose();
333
+ throw new Error("Project LFO preparation was cancelled.");
334
+ }
335
+ lfo = candidate;
336
+ params = new ParamSurface([lfo.frequency, lfo.phase]);
337
+ } finally {
338
+ preparing = false;
339
+ }
340
+ }
341
+ };
342
+ const registration = context.registry.register(module);
343
+ return {
344
+ module,
345
+ ports: [{ id: "output", direction: "output", kind: "control" }],
346
+ getControl: (name) => name === "output" ? lfo?.signal : void 0,
347
+ exportConfig: () => ({ ...record.config, waveform: lfo?.waveform ?? waveform(record.config.waveform) }),
348
+ dispose: () => {
349
+ if (disposed) return;
350
+ disposed = true;
351
+ clean([() => registration.release(), () => lfo?.dispose()]);
352
+ }
353
+ };
354
+ }
355
+ function effectRecipe(config) {
356
+ const options = config.options ?? {};
357
+ if (options === null || typeof options !== "object" || Array.isArray(options)) throw new TypeError("Effect options must be an object.");
358
+ const values = options;
359
+ const numeric = (keys) => Object.fromEntries(keys.filter((key) => values[key] !== void 0).map((key) => [key, number(values, key, 0)]));
360
+ switch (config.type) {
361
+ case "gain":
362
+ return Effect.gain(number(values, "gain", 1));
363
+ case "delay":
364
+ return Effect.delay(numeric(["delaySeconds", "feedback", "wet", "dry"]));
365
+ case "compressor":
366
+ return Effect.compressor(numeric(["threshold", "knee", "ratio", "attack", "release"]));
367
+ case "reverb":
368
+ return Effect.reverb(numeric(["seconds", "decay", "wet", "dry"]));
369
+ case "filter": {
370
+ const type = values.type ?? "lowpass";
371
+ if (!["lowpass", "highpass", "bandpass", "lowshelf", "highshelf", "peaking", "notch", "allpass"].includes(String(type))) throw new TypeError("Unsupported filter type.");
372
+ return Effect.filter({ ...numeric(["frequency", "Q", "gain"]), type });
373
+ }
374
+ default:
375
+ throw new TypeError("Unsupported project effect type.");
376
+ }
377
+ }
378
+ function number(config, key, fallback) {
379
+ const value = config[key] ?? fallback;
380
+ if (typeof value !== "number" || !Number.isFinite(value)) throw new TypeError(`${key} must be a finite number.`);
381
+ return value;
382
+ }
383
+ function waveform(value) {
384
+ const accepted = value ?? "sine";
385
+ if (!["sine", "square", "sawtooth", "triangle"].includes(String(accepted))) throw new TypeError("Unsupported oscillator waveform.");
386
+ return accepted;
387
+ }
388
+ function clean(callbacks) {
389
+ let failure;
390
+ for (const callback of callbacks) {
391
+ try {
392
+ callback();
393
+ } catch (error) {
394
+ failure ?? (failure = error);
395
+ }
396
+ }
397
+ if (failure !== void 0) throw failure;
398
+ }
399
+
400
+ export {
401
+ __privateGet,
402
+ __privateAdd,
403
+ __privateSet,
404
+ __privateMethod,
405
+ registerAudioParticipant,
406
+ createWebMusicProjectPlugins
407
+ };
408
+ //# sourceMappingURL=chunk-XQXQSBVS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/audio-participant.ts","../src/project.ts"],"sourcesContent":["import type {AudioClipPlayer} from '@webmusic/audio/play/headless';\nimport type {ModuleSession, SessionParticipantLease} from '@webmusic/kernel/session';\n\n/** The engine surface a participant adapter needs; `AudioPlayer` and `AudioClipPlayer` both provide it. */\nexport type AudioParticipantPlayer = Pick<AudioClipPlayer,\n 'play' | 'pause' | 'stop' | 'seek' | 'setRate' | 'seconds' | 'playing' | 'clock' | 'duration' |\n 'activateScheduling' | 'attachScheduling' | 'timingCapabilities'>;\n\nexport interface AudioParticipantOptions {\n offsetSeconds?: number;\n positionScale?: number;\n /** Prepare and route the player's output before the Session anchors a start. */\n prepare: () => void | Promise<void>;\n}\n\n/**\n * Register a Headless Audio engine with a Session on the `clip-seconds` axis —\n * the same axis `<audio-player>` uses, so Score and Audio mappings agree\n * (DEC-068). Native buffer playback attaches and activates the shared\n * scheduling anchor; other engines (document sequences, media streams,\n * borrowed queues) are commanded by the Session without activation.\n */\nexport function registerAudioParticipant(\n session: ModuleSession,\n player: AudioParticipantPlayer,\n options: AudioParticipantOptions,\n): SessionParticipantLease {\n return session.register({\n play: (when) => player.play(when), pause: () => player.pause(), stop: () => player.stop(),\n seek: (seconds) => player.seek(seconds), setRate: (rate) => player.setRate(rate),\n get position() { return player.seconds; }, get running() { return player.playing; },\n get clock() { return player.clock; },\n }, {\n axis: 'clip-seconds', identity: player, durationSeconds: () => player.duration, endPolicy: 'position',\n offsetSeconds: options.offsetSeconds, positionScale: options.positionScale,\n prepare: options.prepare,\n // Only native buffer playback can follow the Session's scheduling anchor;\n // document sequences, media and external transports follow by command,\n // as they do under `<audio-player>`.\n ...(player.timingCapabilities.sharedSessionClock && {\n activate: () => player.activateScheduling(),\n attachScheduling: (binding) => player.attachScheduling(binding),\n }),\n });\n}\n","import {registerAudioParticipant} from './audio-participant';\nimport {Score} from '@webmusic/score';\nimport {Effect, MidiAccessSource, ScorePlayerModule, ScoreRackModule, Sound, createMidiPlugins, soundModulePlugin} from '@webmusic/score/play/headless';\nimport {AudioClip} from '@webmusic/audio';\nimport {AudioClipPlayer, createBufferPlugins} from '@webmusic/audio/play/headless';\nimport {InsertChain} from '@webmusic/kernel/effect';\nimport {createMessagePlugins} from '@webmusic/kernel/message';\nimport {\n AudioOutputPort, ParamHandle, ParamSurface, createStructurePlugins, routeModuleOutput,\n type ConnectionLease, type ModuleEnvironment, type ModuleHandle, type ProjectFactoryRequest,\n type ProjectJsonObject, type ProjectModuleInstance, type ProjectPluginFactory,\n} from '@webmusic/kernel/module';\nimport {sequencerPlugin} from '@webmusic/kernel/sequence';\nimport {SessionLFO} from '@webmusic/kernel/session';\n\nconst version = '1.0.0';\nconst audioOutput = Object.freeze([{id: 'output', direction: 'output' as const, kind: 'audio' as const}]);\nconst audioInsert = Object.freeze([{id: 'input', direction: 'input' as const, kind: 'audio' as const}, ...audioOutput]);\n\nexport interface WebMusicProjectPluginOptions {\n /** Where printing, script output and module failures go, and the clock for timed messages; see Kernel's `ModuleEnvironment`. */\n readonly modules?: ModuleEnvironment;\n /** Web MIDI for the MIDI modules; one is made when omitted, and asks for access only when a module needs a device. */\n readonly midi?: MidiAccessSource;\n}\n\n/**\n * The standard set (DEC-097): the Bridge's own players, rack, bus, effect and\n * LFO, which need both domains, with the module types each package registers\n * — Kernel's message, structure and sequence modules, Score's MIDI and sound\n * modules, and Audio's buffer modules. Trusted, explicit factories; asset\n * resolution and storage remain application responsibilities.\n */\nexport function createWebMusicProjectPlugins(options: WebMusicProjectPluginOptions = {}): readonly ProjectPluginFactory[] {\n const environment = options.modules ?? {};\n return Object.freeze([\n {id: 'webmusic.score-player', version, create: createScore},\n {id: 'webmusic.audio-player', version, create: createAudio},\n {id: 'webmusic.score-rack', version, create: createRack},\n {id: 'webmusic.audio-bus', version, create: (request: ProjectFactoryRequest) => createInsert(request, Effect.gain(number(request.record.config, 'gain', 1)))},\n {id: 'webmusic.effect', version, create: (request: ProjectFactoryRequest) => createInsert(request, effectRecipe(request.record.config))},\n {id: 'webmusic.lfo', version, create: createLfo},\n ...createMessagePlugins(environment),\n ...createStructurePlugins(environment),\n sequencerPlugin(environment),\n ...createMidiPlugins(options.midi ?? new MidiAccessSource()),\n soundModulePlugin(),\n ...createBufferPlugins(environment),\n ]);\n}\n\nasync function createScore(request: ProjectFactoryRequest): Promise<ProjectModuleInstance> {\n const score = await request.resolveAsset('source');\n request.signal.throwIfAborted();\n if (!(score instanceof Score)) throw new TypeError('The score-player source asset must resolve to a Score.');\n const config = request.record.config;\n const sound = Sound.oscillator({type: waveform(config.waveform)});\n let module: ScorePlayerModule;\n try {\n module = new ScorePlayerModule(score, {\n context: request.context, id: request.record.id, synth: sound, synthOwnership: 'owned', reverb: false,\n offsetSeconds: number(config, 'offsetSeconds', 0), positionScale: number(config, 'positionScale', 1),\n });\n } catch (error) { sound.dispose(); throw error; }\n return {module, ports: audioOutput, childContext: child => child.derive({id: child.id, target: module}),\n exportConfig: () => config, dispose: () => module.dispose()};\n}\n\nasync function createAudio(request: ProjectFactoryRequest): Promise<ProjectModuleInstance> {\n const clip = await request.resolveAsset('source');\n request.signal.throwIfAborted();\n if (!(clip instanceof AudioClip)) throw new TypeError('The audio-player source asset must resolve to an AudioClip.');\n const {context, record} = request;\n const player = new AudioClipPlayer(clip, {moduleContext: context});\n const volume = new ParamHandle({id: 'volume', unit: 'ratio', range: {min: 0, max: 1}, defaultValue: 1, modulation: 'none'}, {apply: value => player.setVolume(value)});\n const pan = new ParamHandle({id: 'pan', unit: 'ratio', range: {min: -1, max: 1}, defaultValue: 0, modulation: 'none'}, {apply: value => player.setPan(value)});\n const params = new ParamSurface([volume, pan]);\n let route: ConnectionLease | undefined;\n let registration: ConnectionLease | undefined;\n let participant: {release(): void} | undefined;\n let disposed = false;\n const module: ModuleHandle = {\n id: record.id, params,\n get inserts() { return player.insertChain; },\n getPort: name => name === 'output' ? player.peekOutputPort() : undefined,\n prepare: async () => {\n if (disposed) throw new Error('Project audio player has been disposed.');\n await player.preload();\n if (disposed) throw new Error('Project audio player preparation was cancelled.');\n if (!route) {\n const candidate = routeModuleOutput(context, module, player.outputPort);\n if (disposed || !candidate.active) { candidate.release(); throw new Error('Project audio player admission was cancelled.'); }\n route = candidate;\n }\n },\n };\n const dispose = () => {\n if (disposed) return;\n disposed = true;\n clean([() => participant?.release(), () => route?.release(), () => registration?.release(),\n () => volume.dispose(), () => pan.dispose(), () => player.dispose()]);\n };\n try {\n registration = context.registry.register(module);\n participant = context.session ? registerAudioParticipant(context.session, player, {\n offsetSeconds: number(record.config, 'offsetSeconds', 0), positionScale: number(record.config, 'positionScale', 1),\n prepare: () => module.prepare!(),\n }) : undefined;\n } catch (error) { try { dispose(); } catch { /* Preserve creation failure. */ } throw error; }\n return {module, ports: audioOutput, childContext: child => child.derive({id: child.id, target: module}),\n exportConfig: () => record.config, dispose};\n}\n\ninterface ProjectRackChannelState { volume?: number; muted?: boolean; solo?: boolean }\n\nfunction rackChannels(config: ProjectJsonObject): Record<string, ProjectRackChannelState> {\n const channels = config.channels ?? {};\n if (channels === null || typeof channels !== 'object' || Array.isArray(channels)) throw new TypeError('Rack channels must be an object keyed by stable module ID.');\n const result: Record<string, ProjectRackChannelState> = Object.create(null);\n for (const [id, value] of Object.entries(channels)) {\n if (!id.trim() || value === null || typeof value !== 'object' || Array.isArray(value)) throw new TypeError('Rack channel state requires a module ID and an object.');\n const fields = value as ProjectJsonObject;\n const state: ProjectRackChannelState = {};\n if (fields.volume !== undefined) {\n const volume = number(fields, 'volume', 1);\n if (volume < 0 || volume > 1) throw new RangeError('Rack channel volume must be in [0, 1].');\n state.volume = volume;\n }\n for (const key of ['muted', 'solo'] as const) {\n if (fields[key] !== undefined) {\n if (typeof fields[key] !== 'boolean') throw new TypeError(`Rack channel ${key} must be boolean.`);\n state[key] = fields[key];\n }\n }\n result[id] = state;\n }\n return result;\n}\n\nfunction createRack({context, record}: ProjectFactoryRequest): ProjectModuleInstance {\n const channels = rackChannels(record.config);\n const masterVolume = number(record.config, 'masterVolume', 1);\n if (masterVolume < 0 || masterVolume > 1) throw new RangeError('Rack masterVolume must be in [0, 1].');\n const rack = new ScoreRackModule(context, {id: record.id});\n try { rack.setMasterVolume(masterVolume); }\n catch (error) { rack.dispose(); throw error; }\n return {\n module: rack, ports: audioInsert, getInput: name => name === 'input' ? rack.input : undefined,\n childContext: child => child.derive({id: child.id, target: rack, admit: (module, port) => {\n const lease = rack.admit(module, port);\n try {\n const state = channels[module.id];\n if (state?.volume !== undefined) rack.setVolume(module.id, state.volume);\n if (state?.muted !== undefined) rack.mute(module.id, state.muted);\n if (state?.solo !== undefined) rack.solo(module.id, state.solo);\n if (!lease.active) throw new Error('Rack channel admission was cancelled.');\n return lease;\n } catch (error) { try { lease.release(); } catch { /* Preserve admission failure. */ } throw error; }\n }}),\n exportConfig: () => ({...record.config, masterVolume: rack.masterVolume,\n channels: {...Object.fromEntries(Object.entries(channels).map(([id, state]) => [id, {...state}])), ...Object.fromEntries(rack.list().map(channel => [channel.id, {volume: channel.volume, muted: channel.muted, solo: channel.solo}]))}}),\n dispose: () => rack.dispose(),\n };\n}\n\nfunction createInsert({context, record}: ProjectFactoryRequest, recipe: Effect): ProjectModuleInstance {\n let chain: InsertChain | undefined;\n let port: AudioOutputPort | undefined;\n let route: ConnectionLease | undefined;\n let disposed = false;\n let preparing = false;\n const module: ModuleHandle = {\n id: record.id,\n get params() { return chain?.instances[0]?.params; },\n get inserts() { return chain; },\n getPort: name => name === 'output' ? port : undefined,\n prepare: () => {\n if (disposed) throw new Error('Project insert has been disposed.');\n if (chain) return;\n if (preparing) throw new Error('Project insert preparation cannot re-enter.');\n preparing = true;\n let candidate: InsertChain | undefined;\n let candidateRoute: ConnectionLease | undefined;\n let candidatePort: AudioOutputPort | undefined;\n try {\n candidate = new InsertChain(context.audio.prepare());\n candidate.setSlot({id: 'effect', recipe});\n candidatePort = new AudioOutputPort(candidate.output, {id: `${record.id}:output`});\n candidateRoute = routeModuleOutput(context, module, candidatePort);\n if (disposed || !candidateRoute.active) throw new Error('Project insert admission was cancelled.');\n chain = candidate; port = candidatePort; route = candidateRoute;\n } catch (error) {\n try { candidateRoute?.release(); } catch { /* Preserve preparation failure. */ }\n try { candidatePort?.dispose(); } catch { /* Preserve preparation failure. */ }\n try { candidate?.dispose(); } catch { /* Preserve preparation failure. */ }\n throw error;\n } finally { preparing = false; }\n },\n };\n const registration = context.registry.register(module);\n return {\n module, ports: audioInsert, getInput: name => name === 'input' ? chain?.input : undefined,\n childContext: child => child.derive({id: child.id, target: module, admit: null, destination: () => chain?.input}),\n exportConfig: () => record.config,\n dispose: () => {\n if (disposed) return;\n disposed = true;\n clean([() => route?.release(), () => registration?.release(), () => port?.dispose(), () => chain?.dispose()]);\n },\n };\n}\n\nfunction createLfo({context, record}: ProjectFactoryRequest): ProjectModuleInstance {\n let lfo: SessionLFO | undefined;\n let params: ParamSurface | undefined;\n let disposed = false;\n let preparing = false;\n const module: ModuleHandle = {\n id: record.id,\n get params() { return params; },\n prepare: () => {\n if (disposed) throw new Error('Project LFO has been disposed.');\n if (lfo) return;\n if (preparing) throw new Error('Project LFO preparation cannot re-enter.');\n if (!context.session) throw new Error('A project LFO requires a Session.');\n const loop = record.config.loop ?? 'repeat';\n if (loop !== 'repeat' && loop !== 'once') throw new TypeError('LFO loop must be repeat or once.');\n preparing = true;\n try {\n const candidate = new SessionLFO(context.audio.prepare(), context.session.scheduling, {\n frequency: number(record.config, 'frequency', 1), phase: number(record.config, 'phase', 0),\n waveform: waveform(record.config.waveform), loop,\n });\n if (disposed) { candidate.dispose(); throw new Error('Project LFO preparation was cancelled.'); }\n lfo = candidate;\n params = new ParamSurface([lfo.frequency, lfo.phase]);\n } finally { preparing = false; }\n },\n };\n const registration = context.registry.register(module);\n return {\n module, ports: [{id: 'output', direction: 'output', kind: 'control'}],\n getControl: name => name === 'output' ? lfo?.signal : undefined,\n exportConfig: () => ({...record.config, waveform: lfo?.waveform ?? waveform(record.config.waveform)}),\n dispose: () => { if (disposed) return; disposed = true; clean([() => registration.release(), () => lfo?.dispose()]); },\n };\n}\n\nfunction effectRecipe(config: ProjectJsonObject): Effect {\n const options = config.options ?? {};\n if (options === null || typeof options !== 'object' || Array.isArray(options)) throw new TypeError('Effect options must be an object.');\n const values = options as ProjectJsonObject;\n const numeric = (keys: readonly string[]) => Object.fromEntries(keys.filter(key => values[key] !== undefined).map(key => [key, number(values, key, 0)]));\n switch (config.type) {\n case 'gain': return Effect.gain(number(values, 'gain', 1));\n case 'delay': return Effect.delay(numeric(['delaySeconds', 'feedback', 'wet', 'dry']));\n case 'compressor': return Effect.compressor(numeric(['threshold', 'knee', 'ratio', 'attack', 'release']));\n case 'reverb': return Effect.reverb(numeric(['seconds', 'decay', 'wet', 'dry']));\n case 'filter': {\n const type = values.type ?? 'lowpass';\n if (!['lowpass', 'highpass', 'bandpass', 'lowshelf', 'highshelf', 'peaking', 'notch', 'allpass'].includes(String(type))) throw new TypeError('Unsupported filter type.');\n return Effect.filter({...numeric(['frequency', 'Q', 'gain']), type: type as BiquadFilterType});\n }\n default: throw new TypeError('Unsupported project effect type.');\n }\n}\n\nfunction number(config: ProjectJsonObject, key: string, fallback: number): number {\n const value = config[key] ?? fallback;\n if (typeof value !== 'number' || !Number.isFinite(value)) throw new TypeError(`${key} must be a finite number.`);\n return value;\n}\n\nfunction waveform(value: unknown): Exclude<OscillatorType, 'custom'> {\n const accepted = value ?? 'sine';\n if (!['sine', 'square', 'sawtooth', 'triangle'].includes(String(accepted))) throw new TypeError('Unsupported oscillator waveform.');\n return accepted as Exclude<OscillatorType, 'custom'>;\n}\n\nfunction clean(callbacks: readonly (() => void)[]): void {\n let failure: unknown;\n for (const callback of callbacks) { try { callback(); } catch (error) { failure ??= error; } }\n if (failure !== undefined) throw failure;\n}\n"],"mappings":";;;;;;;;;;AAsBO,SAAS,yBACd,SACA,QACA,SACyB;AACzB,SAAO,QAAQ,SAAS;AAAA,IACtB,MAAM,CAAC,SAAS,OAAO,KAAK,IAAI;AAAA,IAAG,OAAO,MAAM,OAAO,MAAM;AAAA,IAAG,MAAM,MAAM,OAAO,KAAK;AAAA,IACxF,MAAM,CAAC,YAAY,OAAO,KAAK,OAAO;AAAA,IAAG,SAAS,CAAC,SAAS,OAAO,QAAQ,IAAI;AAAA,IAC/E,IAAI,WAAW;AAAE,aAAO,OAAO;AAAA,IAAS;AAAA,IAAG,IAAI,UAAU;AAAE,aAAO,OAAO;AAAA,IAAS;AAAA,IAClF,IAAI,QAAQ;AAAE,aAAO,OAAO;AAAA,IAAO;AAAA,EACrC,GAAG;AAAA,IACD,MAAM;AAAA,IAAgB,UAAU;AAAA,IAAQ,iBAAiB,MAAM,OAAO;AAAA,IAAU,WAAW;AAAA,IAC3F,eAAe,QAAQ;AAAA,IAAe,eAAe,QAAQ;AAAA,IAC7D,SAAS,QAAQ;AAAA;AAAA;AAAA;AAAA,IAIjB,GAAI,OAAO,mBAAmB,sBAAsB;AAAA,MAClD,UAAU,MAAM,OAAO,mBAAmB;AAAA,MAC1C,kBAAkB,CAAC,YAAY,OAAO,iBAAiB,OAAO;AAAA,IAChE;AAAA,EACF,CAAC;AACH;;;AC3CA,SAAQ,aAAY;AACpB,SAAQ,QAAQ,kBAA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AO;AACT;AAEA,SAAS,MAAM,WAA0C;AACvD,MAAI;AACJ,aAAW,YAAY,WAAW;AAAE,QAAI;AAAE,eAAS;AAAA,IAAG,SAAS,OAAO;AAAE,4BAAY;AAAA,IAAO;AAAA,EAAE;AAC7F,MAAI,YAAY,OAAW,OAAM;AACnC;","names":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/component/global.ts
17
+ var global_exports = {};
18
+ module.exports = __toCommonJS(global_exports);
19
+ //# sourceMappingURL=global.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/component/global.ts"],"sourcesContent":["// ============================================================================\n// Type surface for the browser-only `@webmusic/bridge/component/global` IIFE\n// bundle (DEC-095).\n//\n// The runtime target is `dist/component.global.js`, loaded as a classic\n// <script> or pasted into a page. It carries the five packages and creates\n// `window.WebMusicComponent`, the `@webmusic/bridge/component` API, so a\n// component exported from an editor runs with nothing installed. It registers\n// no element until `defineComponentElement` is called. It is not an ESM or\n// CommonJS module; this source exists so the bundle has a declaration file.\n// ============================================================================\n\nimport type * as Component from '../component.js';\n\ndeclare global {\n /** APIs exposed by the classic `@webmusic/bridge/component/global` browser bundle. */\n var WebMusicComponent: typeof Component;\n\n interface Window {\n WebMusicComponent: typeof Component;\n }\n}\n\nexport {};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,9 @@
1
+ import * as Component from '../component.js';
2
+
3
+ declare global {
4
+ /** APIs exposed by the classic `@webmusic/bridge/component/global` browser bundle. */
5
+ var WebMusicComponent: typeof Component;
6
+ interface Window {
7
+ WebMusicComponent: typeof Component;
8
+ }
9
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=global.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}