@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.
Files changed (188) hide show
  1. package/LICENSE +202 -21
  2. package/NOTICE +2 -0
  3. package/README.md +103 -64
  4. package/dist/audio-context.cjs.map +1 -1
  5. package/dist/build-receipt.json +3 -3
  6. package/dist/chunk-27LH6QLZ.cjs +277 -0
  7. package/dist/chunk-27LH6QLZ.cjs.map +1 -0
  8. package/dist/chunk-3INDOVUC.cjs.map +1 -1
  9. package/dist/chunk-3RR2VIKA.js +393 -0
  10. package/dist/chunk-3RR2VIKA.js.map +1 -0
  11. package/dist/chunk-3YTKIKKX.cjs +378 -0
  12. package/dist/chunk-3YTKIKKX.cjs.map +1 -0
  13. package/dist/chunk-4RG4WQKC.js +360 -0
  14. package/dist/chunk-4RG4WQKC.js.map +1 -0
  15. package/dist/chunk-5AHVQXTF.cjs +620 -0
  16. package/dist/chunk-5AHVQXTF.cjs.map +1 -0
  17. package/dist/chunk-624KWJWZ.js +170 -0
  18. package/dist/chunk-624KWJWZ.js.map +1 -0
  19. package/dist/chunk-6HGFEKD3.cjs +851 -0
  20. package/dist/chunk-6HGFEKD3.cjs.map +1 -0
  21. package/dist/chunk-7ZTZZ5PN.cjs.map +1 -1
  22. package/dist/chunk-ALWV4P7D.js +726 -0
  23. package/dist/chunk-ALWV4P7D.js.map +1 -0
  24. package/dist/chunk-BADJJ6DV.cjs +143 -0
  25. package/dist/chunk-BADJJ6DV.cjs.map +1 -0
  26. package/dist/chunk-C3LMS36L.cjs +393 -0
  27. package/dist/chunk-C3LMS36L.cjs.map +1 -0
  28. package/dist/chunk-C3YWUZW3.cjs.map +1 -1
  29. package/dist/chunk-CR6OUWBJ.cjs +726 -0
  30. package/dist/chunk-CR6OUWBJ.cjs.map +1 -0
  31. package/dist/chunk-CYWDZLWC.js +2141 -0
  32. package/dist/chunk-CYWDZLWC.js.map +1 -0
  33. package/dist/chunk-DDOGX2D5.js +378 -0
  34. package/dist/chunk-DDOGX2D5.js.map +1 -0
  35. package/dist/chunk-DVN6E5U3.js +620 -0
  36. package/dist/chunk-DVN6E5U3.js.map +1 -0
  37. package/dist/chunk-EURMRU2S.js +208 -0
  38. package/dist/chunk-EURMRU2S.js.map +1 -0
  39. package/dist/chunk-EXDCK2VL.cjs +20 -0
  40. package/dist/chunk-EXDCK2VL.cjs.map +1 -0
  41. package/dist/chunk-G5EIUP52.js +114 -0
  42. package/dist/chunk-G5EIUP52.js.map +1 -0
  43. package/dist/chunk-GB4DGKLZ.js +143 -0
  44. package/dist/chunk-GB4DGKLZ.js.map +1 -0
  45. package/dist/chunk-GPOEAYOW.js +2147 -0
  46. package/dist/chunk-GPOEAYOW.js.map +1 -0
  47. package/dist/chunk-I4YMA5VM.cjs +120 -0
  48. package/dist/chunk-I4YMA5VM.cjs.map +1 -0
  49. package/dist/chunk-IVWHMDCB.cjs +4383 -0
  50. package/dist/chunk-IVWHMDCB.cjs.map +1 -0
  51. package/dist/chunk-JFCBJMA7.cjs +2147 -0
  52. package/dist/chunk-JFCBJMA7.cjs.map +1 -0
  53. package/dist/chunk-JLVSAZ3K.cjs +813 -0
  54. package/dist/chunk-JLVSAZ3K.cjs.map +1 -0
  55. package/dist/chunk-K7FYH6UG.cjs +208 -0
  56. package/dist/chunk-K7FYH6UG.cjs.map +1 -0
  57. package/dist/chunk-L4MYCETM.cjs +970 -0
  58. package/dist/chunk-L4MYCETM.cjs.map +1 -0
  59. package/dist/chunk-MNCMYNYL.js +970 -0
  60. package/dist/chunk-MNCMYNYL.js.map +1 -0
  61. package/dist/chunk-NT2BZ3QM.js +120 -0
  62. package/dist/chunk-NT2BZ3QM.js.map +1 -0
  63. package/dist/chunk-O7SA5GLC.js +277 -0
  64. package/dist/chunk-O7SA5GLC.js.map +1 -0
  65. package/dist/chunk-OCKAHITL.cjs +548 -0
  66. package/dist/chunk-OCKAHITL.cjs.map +1 -0
  67. package/dist/chunk-OTXYWCLA.js +206 -0
  68. package/dist/chunk-OTXYWCLA.js.map +1 -0
  69. package/dist/chunk-P6ZA63J7.js +548 -0
  70. package/dist/chunk-P6ZA63J7.js.map +1 -0
  71. package/dist/chunk-QLF3BOST.js +20 -0
  72. package/dist/chunk-QLF3BOST.js.map +1 -0
  73. package/dist/chunk-RCWFRZDR.js +4383 -0
  74. package/dist/chunk-RCWFRZDR.js.map +1 -0
  75. package/dist/chunk-RZBLPM3L.cjs +206 -0
  76. package/dist/chunk-RZBLPM3L.cjs.map +1 -0
  77. package/dist/chunk-TA3TNJZU.cjs +360 -0
  78. package/dist/chunk-TA3TNJZU.cjs.map +1 -0
  79. package/dist/chunk-TZSRPTQL.cjs +2141 -0
  80. package/dist/chunk-TZSRPTQL.cjs.map +1 -0
  81. package/dist/chunk-UMTPJ76S.cjs.map +1 -1
  82. package/dist/chunk-UY77FXDW.js +813 -0
  83. package/dist/chunk-UY77FXDW.js.map +1 -0
  84. package/dist/chunk-VFU3S7OC.js +851 -0
  85. package/dist/chunk-VFU3S7OC.js.map +1 -0
  86. package/dist/chunk-VY6WWZSW.cjs.map +1 -1
  87. package/dist/chunk-WN5DZOVT.cjs +170 -0
  88. package/dist/chunk-WN5DZOVT.cjs.map +1 -0
  89. package/dist/chunk-WOPW6WLR.cjs.map +1 -1
  90. package/dist/chunk-XBSIYUHM.cjs +114 -0
  91. package/dist/chunk-XBSIYUHM.cjs.map +1 -0
  92. package/dist/chunk-ZMU72HJS.cjs.map +1 -1
  93. package/dist/context-DSa0ymyN.d.cts +664 -0
  94. package/dist/context-DaxfAg3b.d.ts +664 -0
  95. package/dist/effect-chain-Cu03O5Y0.d.ts +91 -0
  96. package/dist/effect-chain-Do75T7uK.d.cts +91 -0
  97. package/dist/effect.cjs +16 -1
  98. package/dist/effect.cjs.map +1 -1
  99. package/dist/effect.d.cts +56 -14
  100. package/dist/effect.d.ts +56 -14
  101. package/dist/effect.js +16 -1
  102. package/dist/elements.cjs +37 -2
  103. package/dist/elements.cjs.map +1 -1
  104. package/dist/elements.d.cts +197 -8
  105. package/dist/elements.d.ts +197 -8
  106. package/dist/elements.js +36 -1
  107. package/dist/events.cjs.map +1 -1
  108. package/dist/index.cjs +555 -8
  109. package/dist/index.cjs.map +1 -1
  110. package/dist/index.d.cts +16 -4
  111. package/dist/index.d.ts +16 -4
  112. package/dist/index.js +566 -19
  113. package/dist/message.cjs +104 -0
  114. package/dist/message.cjs.map +1 -0
  115. package/dist/message.d.cts +738 -0
  116. package/dist/message.d.ts +738 -0
  117. package/dist/message.js +104 -0
  118. package/dist/meter.cjs.map +1 -1
  119. package/dist/module-control-C25BMtH7.d.ts +61 -0
  120. package/dist/module-control-yH6nTJM9.d.cts +61 -0
  121. package/dist/module-plugin-BnPmq1VP.d.ts +198 -0
  122. package/dist/module-plugin-CHb-5W0Y.d.cts +198 -0
  123. package/dist/module.cjs +263 -0
  124. package/dist/module.cjs.map +1 -0
  125. package/dist/module.d.cts +1112 -0
  126. package/dist/module.d.ts +1112 -0
  127. package/dist/module.js +263 -0
  128. package/dist/parameter-DwQzFmBR.d.cts +172 -0
  129. package/dist/parameter-DwQzFmBR.d.ts +172 -0
  130. package/dist/player.cjs.map +1 -1
  131. package/dist/processor-worklet.cjs +18 -0
  132. package/dist/processor-worklet.cjs.map +1 -0
  133. package/dist/processor-worklet.d.cts +166 -0
  134. package/dist/processor-worklet.d.ts +166 -0
  135. package/dist/processor-worklet.js +18 -0
  136. package/dist/processor-worklet.js.map +1 -0
  137. package/dist/processor.cjs +51 -0
  138. package/dist/processor.cjs.map +1 -0
  139. package/dist/processor.d.cts +397 -0
  140. package/dist/processor.d.ts +397 -0
  141. package/dist/processor.js +51 -0
  142. package/dist/processor.js.map +1 -0
  143. package/dist/project-types-BU4awMnL.d.ts +323 -0
  144. package/dist/project-types-DufCV8Ma.d.cts +323 -0
  145. package/dist/ring-C-i9N90a.d.cts +139 -0
  146. package/dist/ring-DkcMt2Eg.d.ts +139 -0
  147. package/dist/sequence.cjs +68 -0
  148. package/dist/sequence.cjs.map +1 -0
  149. package/dist/sequence.d.cts +303 -0
  150. package/dist/sequence.d.ts +303 -0
  151. package/dist/sequence.js +68 -0
  152. package/dist/sequence.js.map +1 -0
  153. package/dist/session.cjs +16 -0
  154. package/dist/session.cjs.map +1 -0
  155. package/dist/session.d.cts +407 -0
  156. package/dist/session.d.ts +407 -0
  157. package/dist/session.js +16 -0
  158. package/dist/session.js.map +1 -0
  159. package/dist/tick.cjs.map +1 -1
  160. package/dist/transport.cjs +50 -2
  161. package/dist/transport.cjs.map +1 -1
  162. package/dist/transport.d.cts +145 -1
  163. package/dist/transport.d.ts +145 -1
  164. package/dist/transport.js +51 -3
  165. package/dist/worker.cjs.map +1 -1
  166. package/package.json +61 -10
  167. package/dist/chunk-53YD73OY.js +0 -162
  168. package/dist/chunk-53YD73OY.js.map +0 -1
  169. package/dist/chunk-54JYWB5X.cjs +0 -1051
  170. package/dist/chunk-54JYWB5X.cjs.map +0 -1
  171. package/dist/chunk-BR63OD53.cjs +0 -1
  172. package/dist/chunk-BR63OD53.cjs.map +0 -1
  173. package/dist/chunk-ON64FRCF.js +0 -1051
  174. package/dist/chunk-ON64FRCF.js.map +0 -1
  175. package/dist/chunk-SM5YPDDI.cjs +0 -162
  176. package/dist/chunk-SM5YPDDI.cjs.map +0 -1
  177. package/dist/chunk-TEM2I2NN.js +0 -1
  178. package/dist/chunk-VVZX7DQ6.cjs +0 -254
  179. package/dist/chunk-VVZX7DQ6.cjs.map +0 -1
  180. package/dist/chunk-WNFGDB7B.js +0 -254
  181. package/dist/chunk-WNFGDB7B.js.map +0 -1
  182. package/dist/sync.cjs +0 -12
  183. package/dist/sync.cjs.map +0 -1
  184. package/dist/sync.d.cts +0 -307
  185. package/dist/sync.d.ts +0 -307
  186. package/dist/sync.js +0 -12
  187. /package/dist/{chunk-TEM2I2NN.js.map → message.js.map} +0 -0
  188. /package/dist/{sync.js.map → module.js.map} +0 -0
@@ -0,0 +1,206 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+ var _chunk7ZTZZ5PNcjs = require('./chunk-7ZTZZ5PN.cjs');
6
+
7
+ // src/processor/definition.ts
8
+ var MAX_CHANNELS = 32;
9
+ var resolved = /* @__PURE__ */ new WeakSet();
10
+ function identifier(value, name) {
11
+ if (typeof value !== "string" || !value || value !== value.trim()) {
12
+ throw new TypeError(`Processor ${name} must be a nonempty trimmed string.`);
13
+ }
14
+ return value;
15
+ }
16
+ function ports(value, fallback, kind) {
17
+ if (value === void 0) return Object.freeze(fallback.map((port) => Object.freeze({ ...port })));
18
+ if (!Array.isArray(value)) throw new TypeError(`Processor ${kind} must be an array.`);
19
+ const seen = /* @__PURE__ */ new Set();
20
+ return Object.freeze(value.map((port) => {
21
+ const id = identifier(_optionalChain([port, 'optionalAccess', _ => _.id]), `${kind} port ID`);
22
+ if (seen.has(id)) throw new TypeError(`Processor ${kind} port ID is duplicated: ${id}.`);
23
+ seen.add(id);
24
+ if (!Number.isInteger(port.channels) || port.channels < 1 || port.channels > MAX_CHANNELS) {
25
+ throw new RangeError(`Processor ${kind} port ${id} needs 1\u2013${MAX_CHANNELS} channels.`);
26
+ }
27
+ return Object.freeze({ id, channels: port.channels });
28
+ }));
29
+ }
30
+ function params(value) {
31
+ if (value === void 0) return Object.freeze([]);
32
+ if (!Array.isArray(value)) throw new TypeError("Processor params must be an array.");
33
+ const seen = /* @__PURE__ */ new Set();
34
+ return Object.freeze(value.map((param) => {
35
+ const id = identifier(_optionalChain([param, 'optionalAccess', _2 => _2.id]), "parameter ID");
36
+ if (seen.has(id)) throw new TypeError(`Processor parameter ID is duplicated: ${id}.`);
37
+ seen.add(id);
38
+ identifier(param.unit, `parameter ${id} unit`);
39
+ const { min, max } = _nullishCoalesce(param.range, () => ( {}));
40
+ if (!Number.isFinite(min) || !Number.isFinite(max) || min > max) {
41
+ throw new RangeError(`Processor parameter ${id} needs a finite range with min <= max.`);
42
+ }
43
+ if (!Number.isFinite(param.defaultValue) || param.defaultValue < min || param.defaultValue > max) {
44
+ throw new RangeError(`Processor parameter ${id} default must lie within its range.`);
45
+ }
46
+ return Object.freeze({ ...param, range: Object.freeze({ min, max }) });
47
+ }));
48
+ }
49
+ function processorName(definition) {
50
+ return `${identifier(_optionalChain([definition, 'optionalAccess', _3 => _3.id]), "ID")}@${identifier(_optionalChain([definition, 'optionalAccess', _4 => _4.version]), "version")}`;
51
+ }
52
+ function resolveProcessorDefinition(definition) {
53
+ if (!definition || typeof definition !== "object") throw new TypeError("Processor definition must be an object.");
54
+ if (resolved.has(definition)) return definition;
55
+ const name = processorName(definition);
56
+ const audioOutputs = ports(definition.audioOutputs, [{ id: "output", channels: 2 }], "audio output");
57
+ if (audioOutputs.length === 0) throw new TypeError("Processor needs at least one audio output.");
58
+ const latencySamples = _nullishCoalesce(definition.latencySamples, () => ( 0));
59
+ if (!Number.isInteger(latencySamples) || latencySamples < 0) {
60
+ throw new RangeError("Processor latencySamples must be a nonnegative integer.");
61
+ }
62
+ const tailSeconds = _nullishCoalesce(definition.tailSeconds, () => ( 0));
63
+ if (Number.isNaN(tailSeconds) || tailSeconds < 0) {
64
+ throw new RangeError("Processor tailSeconds must be nonnegative or Infinity.");
65
+ }
66
+ let sharedRing = null;
67
+ const request = definition.sharedRing;
68
+ if (request !== void 0 && request !== null) {
69
+ const capacity = Number(request.capacity);
70
+ if (!Number.isInteger(capacity) || capacity < 128 || capacity > 16777216) {
71
+ throw new RangeError("Processor sharedRing capacity must be an integer from 128 to 16,777,216 samples.");
72
+ }
73
+ sharedRing = Object.freeze({ capacity, required: request.required === true });
74
+ }
75
+ const result = Object.freeze({
76
+ id: definition.id,
77
+ version: definition.version,
78
+ name,
79
+ audioInputs: ports(definition.audioInputs, [], "audio input"),
80
+ audioOutputs,
81
+ noteInput: definition.noteInput === true,
82
+ transport: definition.transport === true,
83
+ params: params(definition.params),
84
+ latencySamples,
85
+ tailSeconds,
86
+ wasm: definition.wasm === true,
87
+ sharedRing
88
+ });
89
+ resolved.add(result);
90
+ return result;
91
+ }
92
+ function processorAudioParams(definition) {
93
+ return Object.freeze(resolveProcessorDefinition(definition).params.map((param) => Object.freeze({
94
+ name: param.id,
95
+ defaultValue: param.defaultValue,
96
+ minValue: param.range.min,
97
+ maxValue: param.range.max,
98
+ automationRate: param.modulation === "audio-rate" ? "a-rate" : "k-rate"
99
+ })));
100
+ }
101
+ function processorSignature(definition) {
102
+ const { name, audioInputs, audioOutputs, noteInput, transport, latencySamples, tailSeconds, wasm, sharedRing } = resolveProcessorDefinition(definition);
103
+ return JSON.stringify({
104
+ name,
105
+ audioInputs,
106
+ audioOutputs,
107
+ noteInput,
108
+ transport,
109
+ latencySamples,
110
+ wasm,
111
+ sharedRing,
112
+ tailSeconds: Number.isFinite(tailSeconds) ? tailSeconds : "Infinity",
113
+ params: processorAudioParams(definition)
114
+ });
115
+ }
116
+
117
+ // src/processor/protocol.ts
118
+ var PROCESSOR_PROTOCOL_VERSION = 1;
119
+ var PROCESSOR_IMMEDIATE_FRAME = -1;
120
+
121
+ // src/processor/ring.ts
122
+ var READ = 0;
123
+ var WRITE = 1;
124
+ var DROPPED = 2;
125
+ var HEADER_BYTES = 16;
126
+ function processorCapabilities() {
127
+ const scope = globalThis;
128
+ return Object.freeze({
129
+ audioWorklet: typeof scope.AudioWorkletNode === "function",
130
+ wasm: typeof scope.WebAssembly === "object" && scope.WebAssembly !== null,
131
+ sharedMemory: scope.crossOriginIsolated === true && typeof scope.SharedArrayBuffer === "function" && typeof scope.Atomics === "object"
132
+ });
133
+ }
134
+ var _state, _data;
135
+ var _ProcessorRing = class _ProcessorRing {
136
+ /** Attach to a ring another thread created. */
137
+ constructor(buffer) {
138
+ _chunk7ZTZZ5PNcjs.__privateAdd.call(void 0, this, _state);
139
+ _chunk7ZTZZ5PNcjs.__privateAdd.call(void 0, this, _data);
140
+ const capacity = (_optionalChain([buffer, 'optionalAccess', _5 => _5.byteLength]) - HEADER_BYTES) / 4;
141
+ if (!Number.isInteger(capacity) || capacity < 2) throw new TypeError("Not a processor ring buffer.");
142
+ this.buffer = buffer;
143
+ this.capacity = capacity;
144
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _state, new Int32Array(buffer, 0, 4));
145
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _data, new Float32Array(buffer, HEADER_BYTES, capacity));
146
+ }
147
+ /** Allocate a ring. Throws where `SharedArrayBuffer` is unavailable. */
148
+ static create(capacity) {
149
+ if (!Number.isInteger(capacity) || capacity < 2) throw new RangeError("A processor ring needs an integer capacity of at least 2.");
150
+ if (typeof SharedArrayBuffer !== "function") throw new Error("SharedArrayBuffer is unavailable: the page is not cross-origin isolated.");
151
+ return new _ProcessorRing(new SharedArrayBuffer(HEADER_BYTES + capacity * 4));
152
+ }
153
+ /** Samples waiting to be read. */
154
+ get available() {
155
+ const read = Atomics.load(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), READ), write = Atomics.load(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), WRITE);
156
+ return (write - read + this.capacity) % this.capacity;
157
+ }
158
+ /** Samples the writer has dropped because the ring was full, since creation. */
159
+ get dropped() {
160
+ return Atomics.load(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), DROPPED);
161
+ }
162
+ /** Writer side: append `length` samples from `source[start…]`; returns how many fit. Allocates nothing. */
163
+ write(source, start = 0, length = source.length - start) {
164
+ const capacity = this.capacity, data = _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _data);
165
+ const read = Atomics.load(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), READ);
166
+ let write = Atomics.load(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), WRITE);
167
+ const space = capacity - 1 - (write - read + capacity) % capacity;
168
+ const count = length < space ? length : space;
169
+ for (let index = 0; index < count; index++) {
170
+ data[write] = source[start + index];
171
+ write = write + 1 === capacity ? 0 : write + 1;
172
+ }
173
+ Atomics.store(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), WRITE, write);
174
+ if (count < length) Atomics.add(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), DROPPED, length - count);
175
+ return count;
176
+ }
177
+ /** Reader side: move up to `target.length` samples into `target`; returns how many. */
178
+ read(target) {
179
+ const capacity = this.capacity, data = _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _data);
180
+ let read = Atomics.load(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), READ);
181
+ const write = Atomics.load(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), WRITE);
182
+ const available = (write - read + capacity) % capacity;
183
+ const count = available < target.length ? available : target.length;
184
+ for (let index = 0; index < count; index++) {
185
+ target[index] = data[read];
186
+ read = read + 1 === capacity ? 0 : read + 1;
187
+ }
188
+ Atomics.store(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _state), READ, read);
189
+ return count;
190
+ }
191
+ };
192
+ _state = new WeakMap();
193
+ _data = new WeakMap();
194
+ var ProcessorRing = _ProcessorRing;
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+ exports.processorName = processorName; exports.resolveProcessorDefinition = resolveProcessorDefinition; exports.processorAudioParams = processorAudioParams; exports.processorSignature = processorSignature; exports.PROCESSOR_PROTOCOL_VERSION = PROCESSOR_PROTOCOL_VERSION; exports.PROCESSOR_IMMEDIATE_FRAME = PROCESSOR_IMMEDIATE_FRAME; exports.processorCapabilities = processorCapabilities; exports.ProcessorRing = ProcessorRing;
206
+ //# sourceMappingURL=chunk-RZBLPM3L.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/private/tmp/claude-501/-Users-mamingchen-GitHub-public-WebMusic/77eac0d8-82c0-45c6-aba8-0cd73cfd2b1b/scratchpad/release-0.4.0/platform/kernel/dist/chunk-RZBLPM3L.cjs","../src/processor/definition.ts","../src/processor/protocol.ts","../src/processor/ring.ts"],"names":[],"mappings":"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","file":"/private/tmp/claude-501/-Users-mamingchen-GitHub-public-WebMusic/77eac0d8-82c0-45c6-aba8-0cd73cfd2b1b/scratchpad/release-0.4.0/platform/kernel/dist/chunk-RZBLPM3L.cjs","sourcesContent":[null,"import type {ParamDescriptor} from '../module/parameter';\n\n// A processor definition is plain data shared by the main thread and the\n// audio thread. This file therefore imports types only: an author's worklet\n// bundle must not pull main-thread Kernel code in through it.\n\n/** One audio bus of a processor. Channel count is fixed for the node's life. */\nexport interface ProcessorAudioPort {\n readonly id: string;\n readonly channels: number;\n}\n\n/**\n * Serializable description of one authored DSP processor. The same object is\n * passed to `prepareProcessor` on the main thread and to `defineProcessor` in\n * the worklet file, so both sides agree on ports and parameters.\n */\nexport interface ProcessorDefinition {\n /** With `version`, the processor's identity; a project stores this pair. */\n readonly id: string;\n readonly version: string;\n /** Default: none, which makes an instrument or generator. */\n readonly audioInputs?: readonly ProcessorAudioPort[];\n /** Default: one stereo output named `output`. At least one is required. */\n readonly audioOutputs?: readonly ProcessorAudioPort[];\n /** Accept queued note events. Default false. */\n readonly noteInput?: boolean;\n /** Receive the Session anchor on the audio thread. Default false. */\n readonly transport?: boolean;\n /**\n * Every parameter is an `AudioParam` of the node. `modulation: 'audio-rate'`\n * makes it a-rate (one value per frame); anything else makes it k-rate (one\n * value per block).\n */\n readonly params?: readonly ParamDescriptor[];\n /** Declared processing latency in samples; never a measured device latency. Default 0. */\n readonly latencySamples?: number;\n /** How long output continues after input and notes end. Default 0; `Infinity` never idles. */\n readonly tailSeconds?: number;\n /**\n * The processor needs a compiled WebAssembly module: preparation then\n * requires `source.wasm`, and `create` receives the module as `setup.wasm`.\n * Default false.\n */\n readonly wasm?: boolean;\n /**\n * A shared ring the processor writes and the main thread reads, for\n * high-rate observation such as a scope or a sample stream. It exists only\n * where `processorCapabilities().sharedMemory` is true; with `required`,\n * preparation fails elsewhere instead of running without it.\n */\n readonly sharedRing?: ProcessorSharedRingRequest;\n}\n\n/** A processor's request for a shared ring. */\nexport interface ProcessorSharedRingRequest {\n /** Ring size in `float32` samples: an integer from 128 to 16,777,216. */\n readonly capacity: number;\n /** Fail preparation without cross-origin isolation. Default false: the processor runs without the ring. */\n readonly required?: boolean;\n}\n\n/** A validated definition with every default applied. Deeply frozen. */\nexport interface ResolvedProcessorDefinition {\n readonly id: string;\n readonly version: string;\n /** The `registerProcessor` name: `id@version`. */\n readonly name: string;\n readonly audioInputs: readonly ProcessorAudioPort[];\n readonly audioOutputs: readonly ProcessorAudioPort[];\n readonly noteInput: boolean;\n readonly transport: boolean;\n readonly params: readonly ParamDescriptor[];\n readonly latencySamples: number;\n readonly tailSeconds: number;\n readonly wasm: boolean;\n readonly sharedRing: Readonly<{capacity: number; required: boolean}> | null;\n}\n\n/** The `AudioParamDescriptor` shape, declared here because worklet globals have no DOM types. */\nexport interface ProcessorAudioParamDescriptor {\n readonly name: string;\n readonly defaultValue: number;\n readonly minValue: number;\n readonly maxValue: number;\n readonly automationRate: 'a-rate' | 'k-rate';\n}\n\nconst MAX_CHANNELS = 32;\nconst resolved = new WeakSet<object>();\n\nfunction identifier(value: unknown, name: string): string {\n if (typeof value !== 'string' || !value || value !== value.trim()) {\n throw new TypeError(`Processor ${name} must be a nonempty trimmed string.`);\n }\n return value;\n}\n\nfunction ports(value: readonly ProcessorAudioPort[] | undefined, fallback: readonly ProcessorAudioPort[], kind: string): readonly ProcessorAudioPort[] {\n if (value === undefined) return Object.freeze(fallback.map(port => Object.freeze({...port})));\n if (!Array.isArray(value)) throw new TypeError(`Processor ${kind} must be an array.`);\n const seen = new Set<string>();\n return Object.freeze(value.map((port: ProcessorAudioPort) => {\n const id = identifier(port?.id, `${kind} port ID`);\n if (seen.has(id)) throw new TypeError(`Processor ${kind} port ID is duplicated: ${id}.`);\n seen.add(id);\n if (!Number.isInteger(port.channels) || port.channels < 1 || port.channels > MAX_CHANNELS) {\n throw new RangeError(`Processor ${kind} port ${id} needs 1–${MAX_CHANNELS} channels.`);\n }\n return Object.freeze({id, channels: port.channels});\n }));\n}\n\nfunction params(value: readonly ParamDescriptor[] | undefined): readonly ParamDescriptor[] {\n if (value === undefined) return Object.freeze([]);\n if (!Array.isArray(value)) throw new TypeError('Processor params must be an array.');\n const seen = new Set<string>();\n return Object.freeze(value.map((param: ParamDescriptor) => {\n const id = identifier(param?.id, 'parameter ID');\n if (seen.has(id)) throw new TypeError(`Processor parameter ID is duplicated: ${id}.`);\n seen.add(id);\n identifier(param.unit, `parameter ${id} unit`);\n const {min, max} = param.range ?? ({} as ParamDescriptor['range']);\n if (!Number.isFinite(min) || !Number.isFinite(max) || min > max) {\n throw new RangeError(`Processor parameter ${id} needs a finite range with min <= max.`);\n }\n if (!Number.isFinite(param.defaultValue) || param.defaultValue < min || param.defaultValue > max) {\n throw new RangeError(`Processor parameter ${id} default must lie within its range.`);\n }\n return Object.freeze({...param, range: Object.freeze({min, max})});\n }));\n}\n\n/** The `registerProcessor` name of a definition: `id@version`. */\nexport function processorName(definition: Pick<ProcessorDefinition, 'id' | 'version'>): string {\n return `${identifier(definition?.id, 'ID')}@${identifier(definition?.version, 'version')}`;\n}\n\n/**\n * Validate a definition and apply its defaults. Throws before any resource is\n * acquired; resolving an already resolved definition returns it unchanged.\n */\nexport function resolveProcessorDefinition(definition: ProcessorDefinition | ResolvedProcessorDefinition): ResolvedProcessorDefinition {\n if (!definition || typeof definition !== 'object') throw new TypeError('Processor definition must be an object.');\n if (resolved.has(definition)) return definition as ResolvedProcessorDefinition;\n const name = processorName(definition);\n const audioOutputs = ports(definition.audioOutputs, [{id: 'output', channels: 2}], 'audio output');\n if (audioOutputs.length === 0) throw new TypeError('Processor needs at least one audio output.');\n const latencySamples = definition.latencySamples ?? 0;\n if (!Number.isInteger(latencySamples) || latencySamples < 0) {\n throw new RangeError('Processor latencySamples must be a nonnegative integer.');\n }\n const tailSeconds = definition.tailSeconds ?? 0;\n if (Number.isNaN(tailSeconds) || tailSeconds < 0) {\n throw new RangeError('Processor tailSeconds must be nonnegative or Infinity.');\n }\n let sharedRing: ResolvedProcessorDefinition['sharedRing'] = null;\n const request = definition.sharedRing;\n if (request !== undefined && request !== null) {\n const capacity = Number(request.capacity);\n if (!Number.isInteger(capacity) || capacity < 128 || capacity > 16_777_216) {\n throw new RangeError('Processor sharedRing capacity must be an integer from 128 to 16,777,216 samples.');\n }\n sharedRing = Object.freeze({capacity, required: request.required === true});\n }\n const result: ResolvedProcessorDefinition = Object.freeze({\n id: definition.id,\n version: definition.version,\n name,\n audioInputs: ports(definition.audioInputs, [], 'audio input'),\n audioOutputs,\n noteInput: definition.noteInput === true,\n transport: definition.transport === true,\n params: params(definition.params),\n latencySamples,\n tailSeconds,\n wasm: definition.wasm === true,\n sharedRing,\n });\n resolved.add(result);\n return result;\n}\n\n/** The node's `AudioParam` declarations, in definition order. */\nexport function processorAudioParams(definition: ProcessorDefinition | ResolvedProcessorDefinition): readonly ProcessorAudioParamDescriptor[] {\n return Object.freeze(resolveProcessorDefinition(definition).params.map(param => Object.freeze({\n name: param.id,\n defaultValue: param.defaultValue,\n minValue: param.range.min,\n maxValue: param.range.max,\n automationRate: param.modulation === 'audio-rate' ? 'a-rate' as const : 'k-rate' as const,\n })));\n}\n\n/**\n * A stable text form of everything two registrations of one name must agree\n * on. Two definitions with the same `id@version` and different signatures are\n * a conflict, not an update.\n */\nexport function processorSignature(definition: ProcessorDefinition | ResolvedProcessorDefinition): string {\n const {name, audioInputs, audioOutputs, noteInput, transport, latencySamples, tailSeconds, wasm, sharedRing} = resolveProcessorDefinition(definition);\n return JSON.stringify({\n name, audioInputs, audioOutputs, noteInput, transport, latencySamples, wasm, sharedRing,\n tailSeconds: Number.isFinite(tailSeconds) ? tailSeconds : 'Infinity',\n params: processorAudioParams(definition),\n });\n}\n","// Messages between a processor module (main thread) and its processor (audio\n// thread). Types and constants only: both sides import this file, and it\n// must stay free of runtime dependencies.\n\n/** Bumped when a message shape changes incompatibly; the two sides must match. */\nexport const PROCESSOR_PROTOCOL_VERSION = 1;\n\n/** `frame` of a note that plays as soon as possible: a live gesture with no scheduled time. */\nexport const PROCESSOR_IMMEDIATE_FRAME = -1;\n\n/** `processorOptions` handed to the processor's constructor. */\nexport interface ProcessorNodeOptions {\n readonly protocol: number;\n /** The `id@version` the node was created for. */\n readonly name: string;\n /** Author-defined, structured-cloneable initial configuration. */\n readonly config?: unknown;\n /** The module compiled during preparation, when the source supplied `wasm`. */\n readonly wasm?: WebAssembly.Module;\n /** This node's shared ring, when the definition requests one and memory can be shared. */\n readonly ring?: SharedArrayBuffer;\n}\n\n/** Author-defined configuration; never used for per-block control. */\nexport interface ProcessorConfigMessage {\n readonly type: 'config';\n readonly data: unknown;\n}\n\n/**\n * One gate change of one note occurrence, already converted for the audio\n * thread: an absolute context frame instead of seconds, an integer occurrence\n * instead of a string ID.\n */\nexport interface ProcessorNoteMessage {\n readonly type: 'note';\n readonly gate: 'on' | 'off' | 'cancel';\n readonly occurrence: number;\n readonly midi: number;\n readonly cents: number;\n /** Normalized 0–1. */\n readonly velocity: number;\n /**\n * Absolute frame on the context's sample clock, or {@link PROCESSOR_IMMEDIATE_FRAME}\n * for a live gesture that plays at the next block without counting as late.\n */\n readonly frame: number;\n readonly epoch: number;\n}\n\n/** A Session anchor copied to the audio thread. The processor cannot write it. */\nexport interface ProcessorTransportMessage {\n readonly type: 'transport';\n /** Absolute frame at which the Session position is `originSeconds`; before it the position holds. */\n readonly originFrame: number;\n /** Session seconds at `originFrame`. */\n readonly originSeconds: number;\n readonly rate: number;\n readonly running: boolean;\n readonly loop: Readonly<{startSeconds: number; endSeconds: number}> | null;\n readonly epoch: number;\n}\n\n/**\n * The Session invalidated its schedule (seek, pause, stop, loop or rate\n * change): withdraw every queued scheduled onset and cancel every sounding\n * scheduled note. Live gestures (immediate frame) are untouched.\n */\nexport interface ProcessorFlushMessage {\n readonly type: 'flush';\n readonly epoch: number;\n}\n\n/** The owner released the node: the processor stops at its next block instead of waiting for collection. */\nexport interface ProcessorCloseMessage {\n readonly type: 'close';\n}\n\n/** Everything the main thread can post to a processor. */\nexport type ProcessorMessage = ProcessorConfigMessage | ProcessorNoteMessage | ProcessorTransportMessage | ProcessorFlushMessage | ProcessorCloseMessage;\n\n/** The processor threw; Web Audio has stopped calling it. Sent once. */\nexport interface ProcessorErrorReport {\n readonly type: 'error';\n readonly message: string;\n}\n\n/** Note events that arrived after their frame since the last report. Posted at most four times a second. */\nexport interface ProcessorLateReport {\n readonly type: 'late';\n readonly count: number;\n}\n\n/** Author-defined observation, posted at a bounded rate. */\nexport interface ProcessorDataReport {\n readonly type: 'data';\n readonly data: unknown;\n}\n\n/** Everything a processor can post to the main thread. */\nexport type ProcessorReport = ProcessorErrorReport | ProcessorLateReport | ProcessorDataReport;\n","// A single-producer, single-consumer float ring over shared memory, used by\n// both threads: the processor writes on the audio thread, the main thread\n// reads. Pure: no DOM, and nothing runs at import time.\n\nconst READ = 0;\nconst WRITE = 1;\nconst DROPPED = 2;\nconst HEADER_BYTES = 16;\n\n/** Where shared memory and the other optional processor features are available. */\nexport interface ProcessorCapabilities {\n /** `AudioWorkletNode` exists, so processors can run at all. */\n readonly audioWorklet: boolean;\n /** `WebAssembly` exists, so `source.wasm` can be compiled. */\n readonly wasm: boolean;\n /**\n * The page is cross-origin isolated and has `SharedArrayBuffer` and\n * `Atomics`, so a definition's `sharedRing` is provided. Pages served\n * without COOP/COEP headers (GitHub Pages, for one) report false.\n */\n readonly sharedMemory: boolean;\n}\n\n/** What this environment offers processors. Reading it allocates nothing. */\nexport function processorCapabilities(): ProcessorCapabilities {\n const scope = globalThis as {\n crossOriginIsolated?: boolean; AudioWorkletNode?: unknown; WebAssembly?: unknown;\n SharedArrayBuffer?: unknown; Atomics?: unknown;\n };\n return Object.freeze({\n audioWorklet: typeof scope.AudioWorkletNode === 'function',\n wasm: typeof scope.WebAssembly === 'object' && scope.WebAssembly !== null,\n sharedMemory: scope.crossOriginIsolated === true && typeof scope.SharedArrayBuffer === 'function' && typeof scope.Atomics === 'object',\n });\n}\n\n/**\n * A lock-free ring of `float32` samples in one `SharedArrayBuffer`. Exactly\n * one side writes and one side reads. Writing never blocks or allocates: what\n * does not fit is dropped and counted. One slot stays empty, so a ring of\n * capacity `n` holds at most `n − 1` samples.\n */\nexport class ProcessorRing {\n /** The shared memory, to hand to the other thread. */\n readonly buffer: SharedArrayBuffer;\n readonly capacity: number;\n readonly #state: Int32Array;\n readonly #data: Float32Array;\n\n /** Allocate a ring. Throws where `SharedArrayBuffer` is unavailable. */\n static create(capacity: number): ProcessorRing {\n if (!Number.isInteger(capacity) || capacity < 2) throw new RangeError('A processor ring needs an integer capacity of at least 2.');\n if (typeof SharedArrayBuffer !== 'function') throw new Error('SharedArrayBuffer is unavailable: the page is not cross-origin isolated.');\n return new ProcessorRing(new SharedArrayBuffer(HEADER_BYTES + capacity * 4));\n }\n\n /** Attach to a ring another thread created. */\n constructor(buffer: SharedArrayBuffer) {\n const capacity = (buffer?.byteLength - HEADER_BYTES) / 4;\n if (!Number.isInteger(capacity) || capacity < 2) throw new TypeError('Not a processor ring buffer.');\n this.buffer = buffer;\n this.capacity = capacity;\n this.#state = new Int32Array(buffer, 0, 4);\n this.#data = new Float32Array(buffer, HEADER_BYTES, capacity);\n }\n\n /** Samples waiting to be read. */\n get available(): number {\n const read = Atomics.load(this.#state, READ), write = Atomics.load(this.#state, WRITE);\n return (write - read + this.capacity) % this.capacity;\n }\n\n /** Samples the writer has dropped because the ring was full, since creation. */\n get dropped(): number { return Atomics.load(this.#state, DROPPED); }\n\n /** Writer side: append `length` samples from `source[start…]`; returns how many fit. Allocates nothing. */\n write(source: ArrayLike<number>, start = 0, length = source.length - start): number {\n const capacity = this.capacity, data = this.#data;\n const read = Atomics.load(this.#state, READ);\n let write = Atomics.load(this.#state, WRITE);\n const space = capacity - 1 - (write - read + capacity) % capacity;\n const count = length < space ? length : space;\n for (let index = 0; index < count; index++) {\n data[write] = source[start + index];\n write = write + 1 === capacity ? 0 : write + 1;\n }\n Atomics.store(this.#state, WRITE, write);\n if (count < length) Atomics.add(this.#state, DROPPED, length - count);\n return count;\n }\n\n /** Reader side: move up to `target.length` samples into `target`; returns how many. */\n read(target: Float32Array): number {\n const capacity = this.capacity, data = this.#data;\n let read = Atomics.load(this.#state, READ);\n const write = Atomics.load(this.#state, WRITE);\n const available = (write - read + capacity) % capacity;\n const count = available < target.length ? available : target.length;\n for (let index = 0; index < count; index++) {\n target[index] = data[read];\n read = read + 1 === capacity ? 0 : read + 1;\n }\n Atomics.store(this.#state, READ, read);\n return count;\n }\n}\n"]}
@@ -0,0 +1,360 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+ var _chunk7ZTZZ5PNcjs = require('./chunk-7ZTZZ5PN.cjs');
6
+
7
+ // src/transport.ts
8
+ var _originTime, _originPosition, _rate, _paused, _holdUntilOrigin, _now;
9
+ var TransportClock = class {
10
+ /** @param now Optional reference clock enabling the zero-arg `position` getter. */
11
+ constructor(now) {
12
+ _chunk7ZTZZ5PNcjs.__privateAdd.call(void 0, this, _originTime, 0);
13
+ _chunk7ZTZZ5PNcjs.__privateAdd.call(void 0, this, _originPosition, 0);
14
+ _chunk7ZTZZ5PNcjs.__privateAdd.call(void 0, this, _rate, 1);
15
+ _chunk7ZTZZ5PNcjs.__privateAdd.call(void 0, this, _paused, true);
16
+ _chunk7ZTZZ5PNcjs.__privateAdd.call(void 0, this, _holdUntilOrigin, false);
17
+ _chunk7ZTZZ5PNcjs.__privateAdd.call(void 0, this, _now);
18
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _now, now);
19
+ }
20
+ get state() {
21
+ return {
22
+ originTime: _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originTime),
23
+ originPosition: _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originPosition),
24
+ rate: _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _rate),
25
+ paused: _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _paused)
26
+ };
27
+ }
28
+ get rate() {
29
+ return _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _rate);
30
+ }
31
+ get paused() {
32
+ return _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _paused);
33
+ }
34
+ /** Current position via the injected `now()` clock. Throws when none was injected. */
35
+ get position() {
36
+ if (!_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _now)) throw new Error("TransportClock has no injected now() clock; use positionAt(t).");
37
+ return this.positionAt(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _now).call(this));
38
+ }
39
+ /**
40
+ * True when a {@link startAt} start is armed. The flag is cleared by the
41
+ * next {@link start} or {@link pause} — NOT by the origin time passing —
42
+ * so callers combining it with {@link TransportClockState.originTime}
43
+ * should treat "holding and origin still in the future" as the pre-roll
44
+ * condition (positionAt handles this internally either way).
45
+ */
46
+ get holding() {
47
+ return _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _holdUntilOrigin);
48
+ }
49
+ /**
50
+ * Position at reference time `t`. While paused this is constant. `t` before
51
+ * the anchor yields positions before it (possibly negative) — callers clamp
52
+ * to their own domain — EXCEPT after {@link startAt}, where the position
53
+ * holds at the armed origin position through the pre-roll (mirroring how a
54
+ * scheduled `source.start(when)` sounds nothing before `when`).
55
+ */
56
+ positionAt(t) {
57
+ if (_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _paused)) return _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originPosition);
58
+ if (_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _holdUntilOrigin) && t < _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originTime)) return _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originPosition);
59
+ return _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originPosition) + (t - _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originTime)) * _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _rate);
60
+ }
61
+ /**
62
+ * Inverse of {@link positionAt}. Throws RangeError while paused: no
63
+ * reference time maps to a position when the transport is frozen — guard
64
+ * with {@link paused} before calling. While a {@link startAt} start is
65
+ * armed, positions before the armed origin position also throw: the
66
+ * position holds through the pre-roll and never passes below the origin,
67
+ * so no reference time maps to them (extrapolating backwards would return
68
+ * a time whose {@link positionAt} is NOT the requested position).
69
+ */
70
+ timeAt(position) {
71
+ if (_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _paused)) throw new RangeError("TransportClock is paused; no reference time maps to a position.");
72
+ if (_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _holdUntilOrigin) && position < _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originPosition)) {
73
+ throw new RangeError(
74
+ "TransportClock is holding a scheduled start; no reference time maps to a position before the armed origin position."
75
+ );
76
+ }
77
+ return _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originTime) + (position - _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originPosition)) / _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _rate);
78
+ }
79
+ /**
80
+ * Anchor at `(t, position ?? current position)` and unpause. Re-anchoring
81
+ * while already playing is idempotent for the position at `t`.
82
+ */
83
+ start(t, position) {
84
+ assertFiniteAnchor("start time", t);
85
+ if (position !== void 0) assertFiniteAnchor("start position", position);
86
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originPosition, _nullishCoalesce(position, () => ( this.positionAt(t))));
87
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originTime, t);
88
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _paused, false);
89
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _holdUntilOrigin, false);
90
+ }
91
+ /**
92
+ * Arm a SCHEDULED start: anchor at a (typically future) reference time and
93
+ * unpause, with the position holding at `position` until `t` arrives —
94
+ * the clock-side mirror of a sample-accurate `play(when)`. Transitions
95
+ * during the pre-roll keep the armed origin: {@link setRate} changes the
96
+ * slope after `t` without collapsing the hold, {@link seekTo} re-arms the
97
+ * held position, and {@link pause} cancels the pending start.
98
+ */
99
+ startAt(t, position) {
100
+ assertFiniteAnchor("startAt time", t);
101
+ assertFiniteAnchor("startAt position", position);
102
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originPosition, position);
103
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originTime, t);
104
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _paused, false);
105
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _holdUntilOrigin, true);
106
+ }
107
+ /** Fold elapsed time into the anchor; `positionAt()` is constant afterwards. */
108
+ pause(t) {
109
+ assertFiniteAnchor("pause time", t);
110
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originPosition, this.positionAt(t));
111
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originTime, t);
112
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _paused, true);
113
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _holdUntilOrigin, false);
114
+ }
115
+ /**
116
+ * Re-anchor at a new position; preserves the paused/playing state. During
117
+ * an armed pre-roll the scheduled origin time is kept (the pending start
118
+ * stays pending at the new position).
119
+ */
120
+ seekTo(position, t) {
121
+ assertFiniteAnchor("seek position", position);
122
+ assertFiniteAnchor("seek time", t);
123
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originPosition, position);
124
+ if (!(_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _holdUntilOrigin) && t < _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originTime))) {
125
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originTime, t);
126
+ }
127
+ }
128
+ /**
129
+ * Re-anchor so the position is continuous across the rate change:
130
+ * `originPosition = positionAt(t); originTime = t; rate = r`.
131
+ * Throws RangeError unless `r` is finite and > 0.
132
+ */
133
+ setRate(r, t) {
134
+ if (!Number.isFinite(r) || r <= 0) {
135
+ throw new RangeError(`TransportClock rate must be finite and > 0, got ${r}.`);
136
+ }
137
+ assertFiniteAnchor("setRate time", t);
138
+ if (_chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _holdUntilOrigin) && t < _chunk7ZTZZ5PNcjs.__privateGet.call(void 0, this, _originTime)) {
139
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _rate, r);
140
+ return;
141
+ }
142
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originPosition, this.positionAt(t));
143
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _originTime, t);
144
+ _chunk7ZTZZ5PNcjs.__privateSet.call(void 0, this, _rate, r);
145
+ }
146
+ };
147
+ _originTime = new WeakMap();
148
+ _originPosition = new WeakMap();
149
+ _rate = new WeakMap();
150
+ _paused = new WeakMap();
151
+ _holdUntilOrigin = new WeakMap();
152
+ _now = new WeakMap();
153
+ function assertFiniteAnchor(name, value) {
154
+ if (!Number.isFinite(value)) {
155
+ throw new RangeError(`TransportClock ${name} must be a finite number, got ${value}.`);
156
+ }
157
+ }
158
+ var MAX_TEMPO_GRID_BPM = 1e3;
159
+ var MAX_TEMPO_GRID_BEATS_PER_BAR = 64;
160
+ function createTempoGrid(init) {
161
+ const bpm = _optionalChain([init, 'optionalAccess', _ => _.bpm]);
162
+ const anchor = _nullishCoalesce(_optionalChain([init, 'optionalAccess', _2 => _2.anchor]), () => ( 0));
163
+ const beatsPerBar = _nullishCoalesce(_optionalChain([init, 'optionalAccess', _3 => _3.beatsPerBar]), () => ( 4));
164
+ if (typeof bpm !== "number" || !Number.isFinite(bpm) || bpm <= 0 || bpm > MAX_TEMPO_GRID_BPM) {
165
+ throw new RangeError(`TempoGrid bpm must be finite, > 0 and <= ${MAX_TEMPO_GRID_BPM}, got ${bpm}.`);
166
+ }
167
+ if (typeof anchor !== "number" || !Number.isFinite(anchor)) throw new RangeError(`TempoGrid anchor must be finite, got ${anchor}.`);
168
+ if (!Number.isInteger(beatsPerBar) || beatsPerBar < 1 || beatsPerBar > MAX_TEMPO_GRID_BEATS_PER_BAR) {
169
+ throw new RangeError(`TempoGrid beatsPerBar must be an integer from 1 to ${MAX_TEMPO_GRID_BEATS_PER_BAR}, got ${beatsPerBar}.`);
170
+ }
171
+ return Object.freeze({ bpm, anchor, beatsPerBar });
172
+ }
173
+ function tempoGridBeatLength(grid) {
174
+ return 60 / grid.bpm;
175
+ }
176
+ function tempoGridPosition(grid, position) {
177
+ const beat = (position - grid.anchor) / tempoGridBeatLength(grid);
178
+ const whole = Math.floor(beat + 1e-9);
179
+ const phase = Math.max(0, beat - whole);
180
+ const bar = Math.floor(whole / grid.beatsPerBar);
181
+ return Object.freeze({ beat, bar, beatInBar: whole - bar * grid.beatsPerBar, phase });
182
+ }
183
+ function tempoGridBeatPosition(grid, beat) {
184
+ return grid.anchor + beat * tempoGridBeatLength(grid);
185
+ }
186
+ function snapToTempoGrid(grid, position, options = {}) {
187
+ const division = _nullishCoalesce(options.division, () => ( 1));
188
+ if (!Number.isFinite(division) || division <= 0) throw new RangeError(`TempoGrid division must be finite and > 0, got ${division}.`);
189
+ const step = tempoGridBeatLength(grid) / division;
190
+ const index = (position - grid.anchor) / step;
191
+ const rounded = options.direction === "forward" ? Math.ceil(index - 1e-9) : options.direction === "backward" ? Math.floor(index + 1e-9) : Math.round(index);
192
+ return grid.anchor + rounded * step;
193
+ }
194
+ function tempoGridJump(grid, from, to) {
195
+ const length = tempoGridBeatLength(grid);
196
+ const target = Math.round((to - grid.anchor) / length);
197
+ return grid.anchor + (target + tempoGridPosition(grid, from).phase) * length;
198
+ }
199
+ function tempoGridLines(grid, start, end, division = 1) {
200
+ if (!Number.isFinite(division) || division <= 0) throw new RangeError(`TempoGrid division must be finite and > 0, got ${division}.`);
201
+ const step = tempoGridBeatLength(grid) / division;
202
+ const first = Math.ceil((start - grid.anchor) / step - 1e-9) || 0;
203
+ const last = Math.floor((end - grid.anchor) / step + 1e-9);
204
+ const lines = [];
205
+ if (!(last >= first) || last - first > 1e5) return lines;
206
+ for (let index = first; index <= last; index += 1) {
207
+ const beat = index / division;
208
+ lines.push({
209
+ position: grid.anchor + index * step,
210
+ beat,
211
+ downbeat: Number.isInteger(beat) && (beat % grid.beatsPerBar + grid.beatsPerBar) % grid.beatsPerBar === 0
212
+ });
213
+ }
214
+ return lines;
215
+ }
216
+ function tempoGridMapping(grid) {
217
+ return Object.freeze({
218
+ positionToSeconds: (beat) => tempoGridBeatPosition(grid, beat),
219
+ secondsToPosition: (position) => tempoGridPosition(grid, position).beat
220
+ });
221
+ }
222
+ function tapTempo(times, resetSeconds = 2) {
223
+ let start = times.length - 1;
224
+ while (start > 0 && times[start] - times[start - 1] > 0 && times[start] - times[start - 1] <= resetSeconds) start -= 1;
225
+ const run = times.slice(start).filter((time) => Number.isFinite(time));
226
+ if (run.length < 2) return void 0;
227
+ const intervals = run.slice(1).map((time, index) => time - run[index]).filter((value) => value > 0).sort((a, b) => a - b);
228
+ if (!intervals.length) return void 0;
229
+ const middle = intervals.length >> 1;
230
+ const median = intervals.length % 2 ? intervals[middle] : (intervals[middle - 1] + intervals[middle]) / 2;
231
+ const bpm = 60 / median;
232
+ return bpm > 0 && bpm <= MAX_TEMPO_GRID_BPM ? bpm : void 0;
233
+ }
234
+ var TempoClock = class _TempoClock {
235
+ constructor(clock, grid) {
236
+ this.clock = clock;
237
+ this.grid = createTempoGrid(grid);
238
+ Object.freeze(this);
239
+ }
240
+ /** Same clock, another grid. */
241
+ withGrid(grid) {
242
+ return new _TempoClock(this.clock, grid);
243
+ }
244
+ /** Beat, bar and phase at reference time `t`. */
245
+ positionAt(t) {
246
+ return tempoGridPosition(this.grid, this.clock.positionAt(t));
247
+ }
248
+ /** Continuous beat index at reference time `t`. */
249
+ beatAt(t) {
250
+ return this.positionAt(t).beat;
251
+ }
252
+ /** Tempo heard at the current rate: grid bpm × clock rate. */
253
+ get effectiveBpm() {
254
+ return this.grid.bpm * this.clock.rate;
255
+ }
256
+ /**
257
+ * Reference time of the next grid line strictly after `t` (`division`
258
+ * lines per beat) — the instant to schedule a quantized action. Throws
259
+ * RangeError while the clock is paused, like {@link TransportClock.timeAt}.
260
+ */
261
+ nextGridTime(t, division = 1) {
262
+ const position = this.clock.positionAt(t);
263
+ let line = snapToTempoGrid(this.grid, position, { division, direction: "forward" });
264
+ if (line <= position + 1e-9) line += tempoGridBeatLength(this.grid) / division;
265
+ return this.clock.timeAt(line);
266
+ }
267
+ /** Reference time at which a beat index plays. Throws RangeError while paused. */
268
+ timeAtBeat(beat) {
269
+ return this.clock.timeAt(tempoGridBeatPosition(this.grid, beat));
270
+ }
271
+ };
272
+ var TICKS_PER_QUARTER = 480;
273
+ var DEFAULT_MUSICAL_TEMPO = Object.freeze({ bpm: 120, beatsPerBar: 4, beatUnit: 4 });
274
+ function createMusicalTempo(init = {}) {
275
+ const bpm = _nullishCoalesce(init.bpm, () => ( 120)), beatsPerBar = _nullishCoalesce(init.beatsPerBar, () => ( 4)), beatUnit = _nullishCoalesce(init.beatUnit, () => ( 4));
276
+ if (!Number.isFinite(bpm) || bpm <= 0 || bpm > MAX_TEMPO_GRID_BPM) throw new RangeError(`Tempo must be finite, > 0 and <= ${MAX_TEMPO_GRID_BPM} bpm.`);
277
+ if (!Number.isInteger(beatsPerBar) || beatsPerBar < 1 || beatsPerBar > MAX_TEMPO_GRID_BEATS_PER_BAR) throw new RangeError("Beats per bar must be an integer from 1 to 64.");
278
+ if (![1, 2, 4, 8, 16, 32].includes(beatUnit)) throw new RangeError("The beat unit must be 1, 2, 4, 8, 16 or 32.");
279
+ return Object.freeze({ bpm, beatsPerBar, beatUnit });
280
+ }
281
+ var tickSeconds = (tempo) => 60 / tempo.bpm / TICKS_PER_QUARTER;
282
+ var ticksPerBeat = (tempo) => TICKS_PER_QUARTER * 4 / tempo.beatUnit;
283
+ var ticksPerBar = (tempo) => ticksPerBeat(tempo) * tempo.beatsPerBar;
284
+ var NOTE_VALUE = /^(\d+)(n|nd|nt)$/;
285
+ function timeValueTicks(text, tempo = DEFAULT_MUSICAL_TEMPO) {
286
+ const value = text.trim().toLowerCase();
287
+ const note = NOTE_VALUE.exec(value);
288
+ if (note) {
289
+ const division = Number(note[1]);
290
+ if (division < 1 || division > 128 || (division & division - 1) !== 0) throw new RangeError(`${text} is not a note value: use 1n, 2n, 4n \u2026 128n.`);
291
+ const base = TICKS_PER_QUARTER * 4 / division;
292
+ return note[2] === "nd" ? base * 1.5 : note[2] === "nt" ? base * 2 / 3 : base;
293
+ }
294
+ const bbt = /^(\d+)\.(\d+)\.(\d+(?:\.\d+)?)$/.exec(value);
295
+ if (bbt) return Number(bbt[1]) * ticksPerBar(tempo) + Number(bbt[2]) * ticksPerBeat(tempo) + Number(bbt[3]);
296
+ const ticks = /^(\d+(?:\.\d+)?)\s*ticks?$/.exec(value);
297
+ if (ticks) return Number(ticks[1]);
298
+ return void 0;
299
+ }
300
+ function timeValueSeconds(text, tempo = DEFAULT_MUSICAL_TEMPO) {
301
+ const ticks = timeValueTicks(text, tempo);
302
+ if (ticks !== void 0) return ticks * tickSeconds(tempo);
303
+ const value = text.trim().toLowerCase();
304
+ const match = /^(-?\d+(?:\.\d+)?)\s*(ms|s|hz)?$/.exec(value);
305
+ if (!match) throw new SyntaxError(`${text} is not a time value: use 4n, 8nt, 1.0.0, 480 ticks, 250ms, 0.5s or 2hz.`);
306
+ const amount = Number(match[1]);
307
+ if (match[2] === "s") return amount;
308
+ if (match[2] === "hz") {
309
+ if (amount <= 0) throw new RangeError("A frequency must be > 0 Hz.");
310
+ return 1 / amount;
311
+ }
312
+ return amount / 1e3;
313
+ }
314
+ function barsBeatsTicksAt(seconds, tempo, anchor = 0) {
315
+ const total = Math.max(0, (seconds - anchor) / tickSeconds(tempo) + 1e-6);
316
+ const bar = Math.floor(total / ticksPerBar(tempo));
317
+ const inBar = total - bar * ticksPerBar(tempo);
318
+ const beat = Math.floor(inBar / ticksPerBeat(tempo));
319
+ return Object.freeze({ bar: bar + 1, beat: beat + 1, tick: Math.floor(inBar - beat * ticksPerBeat(tempo)) });
320
+ }
321
+ function secondsAtBarsBeatsTicks(position, tempo, anchor = 0) {
322
+ const ticks = (position.bar - 1) * ticksPerBar(tempo) + (position.beat - 1) * ticksPerBeat(tempo) + position.tick;
323
+ return anchor + ticks * tickSeconds(tempo);
324
+ }
325
+ function formatBarsBeatsTicks(position) {
326
+ return `${position.bar}.${position.beat}.${position.tick}`;
327
+ }
328
+ function nextGridTime(position, interval, anchor = 0) {
329
+ if (!(interval > 0)) throw new RangeError("A grid interval must be > 0.");
330
+ return anchor + Math.ceil((position - anchor) / interval - 1e-9) * interval;
331
+ }
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+
356
+
357
+
358
+
359
+ exports.TransportClock = TransportClock; exports.MAX_TEMPO_GRID_BPM = MAX_TEMPO_GRID_BPM; exports.MAX_TEMPO_GRID_BEATS_PER_BAR = MAX_TEMPO_GRID_BEATS_PER_BAR; exports.createTempoGrid = createTempoGrid; exports.tempoGridBeatLength = tempoGridBeatLength; exports.tempoGridPosition = tempoGridPosition; exports.tempoGridBeatPosition = tempoGridBeatPosition; exports.snapToTempoGrid = snapToTempoGrid; exports.tempoGridJump = tempoGridJump; exports.tempoGridLines = tempoGridLines; exports.tempoGridMapping = tempoGridMapping; exports.tapTempo = tapTempo; exports.TempoClock = TempoClock; exports.TICKS_PER_QUARTER = TICKS_PER_QUARTER; exports.DEFAULT_MUSICAL_TEMPO = DEFAULT_MUSICAL_TEMPO; exports.createMusicalTempo = createMusicalTempo; exports.tickSeconds = tickSeconds; exports.ticksPerBeat = ticksPerBeat; exports.ticksPerBar = ticksPerBar; exports.timeValueTicks = timeValueTicks; exports.timeValueSeconds = timeValueSeconds; exports.barsBeatsTicksAt = barsBeatsTicksAt; exports.secondsAtBarsBeatsTicks = secondsAtBarsBeatsTicks; exports.formatBarsBeatsTicks = formatBarsBeatsTicks; exports.nextGridTime = nextGridTime;
360
+ //# sourceMappingURL=chunk-TA3TNJZU.cjs.map