@libraz/libsonare 1.5.5 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -20
- package/dist/analysis.d.ts +5809 -0
- package/dist/analysis.js +2574 -0
- package/dist/analysis.js.map +1 -0
- package/dist/index.d.ts +884 -55
- package/dist/index.js +1302 -292
- package/dist/index.js.map +1 -1
- package/dist/schemas/realtime-voice-changer-preset-pack.schema.json +27 -0
- package/dist/schemas/realtime-voice-changer-preset.schema.json +140 -0
- package/dist/sonare-analysis.js +2 -0
- package/dist/sonare-analysis.wasm +0 -0
- package/dist/sonare.js +1 -1
- package/dist/sonare.wasm +0 -0
- package/dist/worker.d.ts +65 -0
- package/dist/worker.js +734 -0
- package/dist/worker.js.map +1 -0
- package/dist/worklet.d.ts +628 -88
- package/dist/worklet.js +1816 -266
- package/dist/worklet.js.map +1 -1
- package/package.json +23 -11
- package/src/_chain_config.ts +5 -3
- package/src/analysis.ts +137 -0
- package/src/analysis_helpers.ts +40 -29
- package/src/audio.ts +7 -2
- package/src/clip_page_streamer.ts +62 -8
- package/src/codes.ts +87 -64
- package/src/effects_mastering.ts +1 -0
- package/src/effects_transform.ts +179 -10
- package/src/errors.ts +1 -0
- package/src/feature_core.ts +140 -2
- package/src/feature_music.ts +25 -3
- package/src/feature_pitch.ts +70 -1
- package/src/feature_spectral.ts +295 -7
- package/src/feature_spectrogram.ts +203 -3
- package/src/features.ts +16 -1
- package/src/index.ts +120 -8
- package/src/mastering_chain.ts +20 -8
- package/src/mastering_core.ts +5 -0
- package/src/mastering_dynamics.ts +7 -1
- package/src/metering.ts +6 -1
- package/src/mixer.ts +3 -3
- package/src/opfs_clip_pages.ts +26 -1
- package/src/project.ts +13 -0
- package/src/project_class.ts +204 -23
- package/src/project_internal.ts +38 -34
- package/src/project_types.ts +114 -11
- package/src/public_types.ts +68 -0
- package/src/public_types_mastering.ts +22 -0
- package/src/public_types_mixing.ts +27 -2
- package/src/public_types_music.ts +9 -0
- package/src/public_types_realtime.ts +23 -5
- package/src/public_types_spectral.ts +33 -0
- package/src/quick_analysis.ts +46 -10
- package/src/realtime_engine.ts +167 -6
- package/src/realtime_voice_changer.ts +51 -77
- package/src/sonare-analysis.js.d.ts +8 -0
- package/src/sonare.js.d.ts +340 -6
- package/src/stream_analyzer.ts +6 -1
- package/src/streaming_processors.ts +15 -0
- package/src/web_midi.ts +46 -11
- package/src/worker.ts +196 -0
- package/src/worker_client.ts +352 -0
- package/src/worker_protocol.ts +59 -0
- package/src/worklet/engine-automation.ts +2 -1
- package/src/worklet/engine-capture-facade.ts +13 -4
- package/src/worklet/engine-clips.ts +12 -3
- package/src/worklet/engine-node.ts +264 -21
- package/src/worklet/engine-offline.ts +7 -2
- package/src/worklet/engine-parameter-facade.ts +55 -5
- package/src/worklet/engine-processor.ts +435 -62
- package/src/worklet/engine-register.ts +9 -1
- package/src/worklet/engine-strips.ts +19 -3
- package/src/worklet/engine-sync.ts +2 -6
- package/src/worklet/engine-tempo-facade.ts +8 -6
- package/src/worklet/engine.ts +390 -13
- package/src/worklet/guards.ts +121 -8
- package/src/worklet/messages.ts +166 -8
- package/src/worklet/protocol.ts +305 -17
- package/src/worklet/voice-changer-processor.ts +12 -15
- package/src/worklet.ts +20 -1
package/dist/worklet.d.ts
CHANGED
|
@@ -1,71 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type PanMode = 'balance' | 'stereoPan' | 'stereo-pan' | 'dualPan' | 'dual-pan' | number;
|
|
4
|
-
/**
|
|
5
|
-
* Interpolation curve for scheduled automation events
|
|
6
|
-
* (see {@link Mixer.scheduleInsertAutomation}).
|
|
7
|
-
*/
|
|
8
|
-
type AutomationCurve = 'linear' | 'exponential' | 'hold' | 's-curve';
|
|
9
|
-
/**
|
|
10
|
-
* Pan law applied when computing left/right gains from a pan position
|
|
11
|
-
* (see {@link Mixer.setPanLaw}). Maps to the underlying integer code.
|
|
12
|
-
*/
|
|
13
|
-
type PanLaw = 'const3dB' | 'const4.5dB' | 'const6dB' | 'linear0dB';
|
|
14
|
-
/** Pre/post-fader send timing (see {@link Mixer.addSend}). */
|
|
15
|
-
type SendTiming = 'preFader' | 'postFader';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Equalizer band type (string union mirroring `sonare::mastering::eq::EqBandType`).
|
|
19
|
-
*/
|
|
20
|
-
type EqBandType = 'Peak' | 'LowShelf' | 'HighShelf' | 'LowPass' | 'HighPass' | 'BandPass' | 'Notch' | 'TiltShelf' | 'FlatTilt';
|
|
21
|
-
/** Biquad coefficient design mode. */
|
|
22
|
-
type EqCoeffMode = 'Rbj' | 'Vicanek';
|
|
23
|
-
/** Stereo placement for an EQ band. */
|
|
24
|
-
type EqStereoPlacement = 'Stereo' | 'Left' | 'Right' | 'Mid' | 'Side';
|
|
25
|
-
/** Per-band phase behaviour. */
|
|
26
|
-
type EqBandPhase = 'Inherit' | 'ZeroLatency' | 'NaturalPhase' | 'LinearPhase';
|
|
27
|
-
/**
|
|
28
|
-
* Equalizer band configuration accepted by {@link StreamingEqualizer.setBand}.
|
|
29
|
-
*
|
|
30
|
-
* All fields are optional; omitted values fall back to the C++ band defaults
|
|
31
|
-
* (Peak, 1000 Hz, 0 dB gain, Butterworth Q, disabled).
|
|
32
|
-
*/
|
|
33
|
-
interface EqBand {
|
|
34
|
-
type?: EqBandType;
|
|
35
|
-
frequencyHz?: number;
|
|
36
|
-
gainDb?: number;
|
|
37
|
-
q?: number;
|
|
38
|
-
enabled?: boolean;
|
|
39
|
-
coeffMode?: EqCoeffMode;
|
|
40
|
-
slopeDbOct?: number;
|
|
41
|
-
placement?: EqStereoPlacement;
|
|
42
|
-
phase?: EqBandPhase;
|
|
43
|
-
soloed?: boolean;
|
|
44
|
-
bypassed?: boolean;
|
|
45
|
-
proportionalQ?: boolean;
|
|
46
|
-
proportionalQStrength?: number;
|
|
47
|
-
dynamic?: boolean;
|
|
48
|
-
thresholdDb?: number;
|
|
49
|
-
autoThreshold?: boolean;
|
|
50
|
-
ratio?: number;
|
|
51
|
-
rangeDb?: number;
|
|
52
|
-
attackMs?: number;
|
|
53
|
-
releaseMs?: number;
|
|
54
|
-
lookaheadMs?: number;
|
|
55
|
-
externalSidechain?: boolean;
|
|
56
|
-
sidechainFreqHz?: number;
|
|
57
|
-
sidechainQ?: number;
|
|
58
|
-
}
|
|
59
|
-
type VoicePresetId = 'neutral-monitor' | 'bright-idol' | 'soft-whisper' | 'deep-narrator' | 'robot-mascot' | 'dark-villain';
|
|
60
|
-
interface RealtimeVoiceChangerPreset {
|
|
61
|
-
schemaVersion: 1;
|
|
62
|
-
id?: string;
|
|
63
|
-
name?: string;
|
|
64
|
-
description?: string;
|
|
65
|
-
macros?: Record<string, number>;
|
|
66
|
-
dsp?: Record<string, unknown>;
|
|
67
|
-
}
|
|
68
|
-
type RealtimeVoiceChangerConfigInput = VoicePresetId | RealtimeVoiceChangerPreset;
|
|
1
|
+
import { WasmExternalMidiEvent, WasmEngineTransportState, WasmEngineTempoSegment, WasmEngineTimeSignatureSegment, WasmEngineParameterInfo, WasmEngineAutomationPoint, WasmEngineMarker, WasmEngineMetronomeConfig, WasmEngineGraphSpec, WasmEngineClip, WasmClipPageRequest, WasmEngineCaptureStatus, WasmEngineProcessWithMonitorResult, WasmEngineBounceOptions, WasmEngineBounceResult, WasmEngineFreezeOptions, WasmEngineFreezeResult, WasmEngineTelemetry, WasmEngineMeterTelemetry, WasmEngineMeterTelemetryWide, WasmEngineScopeTelemetry, SonareModule } from './sonare.js';
|
|
69
2
|
|
|
70
3
|
declare const SYNTH_ENGINE_MODES: readonly ["default", "subtractive", "fm", "karplus-strong", "modal", "additive", "percussion", "piano", "pipe-organ", "bowed-string", "reed", "brass", "flute", "plucked-string", "vocal", "free-reed"];
|
|
71
4
|
declare const SYNTH_OSC_WAVEFORMS: readonly ["default", "sine", "saw", "square", "triangle", "noise"];
|
|
@@ -119,6 +52,8 @@ interface SynthPatch {
|
|
|
119
52
|
* `(destination_id, patch)` bindings instead. Defaults to `0`.
|
|
120
53
|
*/
|
|
121
54
|
destinationId?: number;
|
|
55
|
+
/** Resolve MIDI channels from incoming GM bank/program changes; defaults to false. */
|
|
56
|
+
useGmPrograms?: boolean;
|
|
122
57
|
/** Base preset name (see {@link synthPresetNames}); omit for the init patch. */
|
|
123
58
|
preset?: string;
|
|
124
59
|
engineMode?: SynthEngineMode | number;
|
|
@@ -182,6 +117,131 @@ interface ProjectMidiCcBinding {
|
|
|
182
117
|
maxValue: number;
|
|
183
118
|
}
|
|
184
119
|
|
|
120
|
+
type PanMode = 'balance' | 'pan' | 'stereoPan' | 'stereo-pan' | 'dualPan' | 'dual-pan' | number;
|
|
121
|
+
/**
|
|
122
|
+
* Interpolation curve for scheduled automation events
|
|
123
|
+
* (see {@link Mixer.scheduleInsertAutomation}).
|
|
124
|
+
*/
|
|
125
|
+
type AutomationCurve = 'linear' | 'exponential' | 'hold' | 's-curve';
|
|
126
|
+
/**
|
|
127
|
+
* Pan law applied when computing left/right gains from a pan position
|
|
128
|
+
* (see {@link Mixer.setPanLaw}). On mono strips it changes the centre gain;
|
|
129
|
+
* on stereo Balance strips it changes only the far-channel taper, while centre
|
|
130
|
+
* remains unity. Maps to the underlying integer code.
|
|
131
|
+
*/
|
|
132
|
+
type PanLaw = 'const3dB' | 'const4.5dB' | 'const6dB' | 'linear0dB';
|
|
133
|
+
/** Accepted pan-law name aliases for mixer and realtime-engine inputs. */
|
|
134
|
+
type PanLawName = PanLaw | 'const-3db' | '-3db' | 'const-4.5db' | '-4.5db' | 'const-6db' | '-6db' | 'linear-0db' | 'linear' | '0db';
|
|
135
|
+
/** Pan-law name or raw C ABI ordinal. */
|
|
136
|
+
type PanLawInput = PanLawName | number;
|
|
137
|
+
/** Pre/post-fader send timing (see {@link Mixer.addSend}). */
|
|
138
|
+
type SendTiming = 'preFader' | 'postFader';
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Equalizer band type (string union mirroring `sonare::mastering::eq::EqBandType`).
|
|
142
|
+
*/
|
|
143
|
+
type EqBandType = 'Peak' | 'LowShelf' | 'HighShelf' | 'LowPass' | 'HighPass' | 'BandPass' | 'Notch' | 'TiltShelf' | 'FlatTilt';
|
|
144
|
+
/** Biquad coefficient design mode. */
|
|
145
|
+
type EqCoeffMode = 'Rbj' | 'Vicanek';
|
|
146
|
+
/** Stereo placement for an EQ band. */
|
|
147
|
+
type EqStereoPlacement = 'Stereo' | 'Left' | 'Right' | 'Mid' | 'Side';
|
|
148
|
+
/** Per-band phase behaviour. */
|
|
149
|
+
type EqBandPhase = 'Inherit' | 'ZeroLatency' | 'NaturalPhase' | 'LinearPhase';
|
|
150
|
+
/**
|
|
151
|
+
* Equalizer band configuration accepted by {@link StreamingEqualizer.setBand}.
|
|
152
|
+
*
|
|
153
|
+
* All fields are optional; omitted values fall back to the C++ band defaults
|
|
154
|
+
* (Peak, 1000 Hz, 0 dB gain, Butterworth Q, disabled).
|
|
155
|
+
*/
|
|
156
|
+
interface EqBand {
|
|
157
|
+
type?: EqBandType;
|
|
158
|
+
frequencyHz?: number;
|
|
159
|
+
gainDb?: number;
|
|
160
|
+
q?: number;
|
|
161
|
+
enabled?: boolean;
|
|
162
|
+
coeffMode?: EqCoeffMode;
|
|
163
|
+
slopeDbOct?: number;
|
|
164
|
+
placement?: EqStereoPlacement;
|
|
165
|
+
phase?: EqBandPhase;
|
|
166
|
+
soloed?: boolean;
|
|
167
|
+
bypassed?: boolean;
|
|
168
|
+
proportionalQ?: boolean;
|
|
169
|
+
proportionalQStrength?: number;
|
|
170
|
+
dynamic?: boolean;
|
|
171
|
+
thresholdDb?: number;
|
|
172
|
+
autoThreshold?: boolean;
|
|
173
|
+
ratio?: number;
|
|
174
|
+
rangeDb?: number;
|
|
175
|
+
attackMs?: number;
|
|
176
|
+
releaseMs?: number;
|
|
177
|
+
lookaheadMs?: number;
|
|
178
|
+
externalSidechain?: boolean;
|
|
179
|
+
sidechainFreqHz?: number;
|
|
180
|
+
sidechainQ?: number;
|
|
181
|
+
}
|
|
182
|
+
type VoicePresetId = 'neutral-monitor' | 'bright-idol' | 'soft-whisper' | 'deep-narrator' | 'robot-mascot' | 'dark-villain';
|
|
183
|
+
type VoicePresetCategory = 'monitor' | 'bright' | 'soft' | 'deep' | 'robot' | 'dark' | 'custom';
|
|
184
|
+
interface RealtimeVoiceChangerPresetMetadata {
|
|
185
|
+
schemaVersion: 1;
|
|
186
|
+
id: string;
|
|
187
|
+
name: string;
|
|
188
|
+
description?: string;
|
|
189
|
+
category: VoicePresetCategory;
|
|
190
|
+
}
|
|
191
|
+
type RealtimeVoiceChangerPreset = (RealtimeVoiceChangerPresetMetadata & {
|
|
192
|
+
dsp: Record<string, unknown>;
|
|
193
|
+
macros?: never;
|
|
194
|
+
}) | (RealtimeVoiceChangerPresetMetadata & {
|
|
195
|
+
macros: Record<string, number>;
|
|
196
|
+
dsp?: never;
|
|
197
|
+
});
|
|
198
|
+
type RealtimeVoiceChangerConfigInput = VoicePresetId | RealtimeVoiceChangerPreset;
|
|
199
|
+
/**
|
|
200
|
+
* Flat (POD) realtime voice-changer configuration. Keys are camelCase to match
|
|
201
|
+
* the Node addon getter, so a preset config reads identically across both JS
|
|
202
|
+
* surfaces (the underlying C ABI / Python POD uses the snake_case equivalents).
|
|
203
|
+
*/
|
|
204
|
+
interface RealtimeVoiceChangerPodConfig {
|
|
205
|
+
inputGainDb: number;
|
|
206
|
+
outputGainDb: number;
|
|
207
|
+
wetMix: number;
|
|
208
|
+
retuneSemitones: number;
|
|
209
|
+
retuneMix: number;
|
|
210
|
+
retuneGrainSize: number;
|
|
211
|
+
formantFactor: number;
|
|
212
|
+
formantAmount: number;
|
|
213
|
+
formantBody: number;
|
|
214
|
+
formantBrightness: number;
|
|
215
|
+
formantNasal: number;
|
|
216
|
+
eqHighpassHz: number;
|
|
217
|
+
eqBodyDb: number;
|
|
218
|
+
eqPresenceDb: number;
|
|
219
|
+
eqAirDb: number;
|
|
220
|
+
gateThresholdDb: number;
|
|
221
|
+
gateAttackMs: number;
|
|
222
|
+
gateReleaseMs: number;
|
|
223
|
+
gateRangeDb: number;
|
|
224
|
+
compressorThresholdDb: number;
|
|
225
|
+
compressorRatio: number;
|
|
226
|
+
compressorAttackMs: number;
|
|
227
|
+
compressorReleaseMs: number;
|
|
228
|
+
compressorMakeupGainDb: number;
|
|
229
|
+
deesserFrequencyHz: number;
|
|
230
|
+
deesserThresholdDb: number;
|
|
231
|
+
deesserRatio: number;
|
|
232
|
+
deesserRangeDb: number;
|
|
233
|
+
reverbMix: number;
|
|
234
|
+
reverbTimeMs: number;
|
|
235
|
+
reverbDamping: number;
|
|
236
|
+
reverbSeed: number;
|
|
237
|
+
limiterCeilingDb: number;
|
|
238
|
+
limiterReleaseMs: number;
|
|
239
|
+
/** Non-zero enables the 4x-oversampled inter-sample-peak limiter (default enabled). */
|
|
240
|
+
limiterEnableIspLimiter: boolean;
|
|
241
|
+
/** True-peak ceiling in dBTP applied by the ISP limiter (default -1.0). */
|
|
242
|
+
limiterIspCeilingDbtp: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
185
245
|
type EngineClip = WasmEngineClip;
|
|
186
246
|
type ClipPageRequest = WasmClipPageRequest;
|
|
187
247
|
type EngineParameterInfo = WasmEngineParameterInfo;
|
|
@@ -190,6 +250,7 @@ type EngineMarker = WasmEngineMarker;
|
|
|
190
250
|
type EngineMetronomeConfig = WasmEngineMetronomeConfig;
|
|
191
251
|
type EngineGraphSpec = WasmEngineGraphSpec;
|
|
192
252
|
type EngineCaptureStatus = WasmEngineCaptureStatus;
|
|
253
|
+
type EngineCaptureSource = EngineCaptureStatus['source'] | number;
|
|
193
254
|
type EngineBounceOptions = WasmEngineBounceOptions;
|
|
194
255
|
type EngineBounceResult = WasmEngineBounceResult;
|
|
195
256
|
type EngineFreezeOptions = WasmEngineFreezeOptions;
|
|
@@ -226,6 +287,8 @@ interface EngineTrackLane {
|
|
|
226
287
|
*/
|
|
227
288
|
sourceChannelLayout?: number;
|
|
228
289
|
}
|
|
290
|
+
/** Per-track cue/monitor tap mode: off, pre-fader listen, or after-fader listen. */
|
|
291
|
+
type EngineTrackMonitorMode = 'off' | 'pfl' | 'afl' | 0 | 1 | 2;
|
|
229
292
|
interface EngineBus {
|
|
230
293
|
busId: number;
|
|
231
294
|
gainDb?: number;
|
|
@@ -269,8 +332,8 @@ interface MidiCcBindOptions {
|
|
|
269
332
|
}
|
|
270
333
|
declare class RealtimeEngine {
|
|
271
334
|
private native;
|
|
272
|
-
constructor(sampleRate?: number, maxBlockSize?: number, commandCapacity?: number, telemetryCapacity?: number);
|
|
273
|
-
prepare(sampleRate: number, maxBlockSize: number, commandCapacity?: number, telemetryCapacity?: number): void;
|
|
335
|
+
constructor(sampleRate?: number, maxBlockSize?: number, commandCapacity?: number, telemetryCapacity?: number, maxChannels?: number);
|
|
336
|
+
prepare(sampleRate: number, maxBlockSize: number, commandCapacity?: number, telemetryCapacity?: number, maxChannels?: number): void;
|
|
274
337
|
/** Queue a sample-accurate parameter change (engine kSetParam). */
|
|
275
338
|
setParameter(paramId: number, value: number, renderFrame?: number): void;
|
|
276
339
|
/** Queue a smoothed parameter change (engine kSetParamSmoothed). */
|
|
@@ -282,6 +345,8 @@ declare class RealtimeEngine {
|
|
|
282
345
|
*/
|
|
283
346
|
setParamSmoothingMs(smoothingMs: number): void;
|
|
284
347
|
setSoloMute(laneIndex: number, solo: boolean, mute: boolean, renderFrame?: number): void;
|
|
348
|
+
/** Queue a per-track PFL/AFL monitor tap mode change. */
|
|
349
|
+
setTrackMonitorMode(laneIndex: number, mode: EngineTrackMonitorMode, renderFrame?: number): void;
|
|
285
350
|
setMidiClips(clips: readonly EngineMidiClipSchedule[]): void;
|
|
286
351
|
setBuiltinInstrument(config?: {
|
|
287
352
|
destinationId?: number;
|
|
@@ -316,6 +381,7 @@ declare class RealtimeEngine {
|
|
|
316
381
|
destinationId?: number;
|
|
317
382
|
gain?: number;
|
|
318
383
|
polyphony?: number;
|
|
384
|
+
preferModelForModeledFamilies?: boolean;
|
|
319
385
|
}, destinationId?: number): void;
|
|
320
386
|
clearMidiInstrument(destinationId?: number): void;
|
|
321
387
|
midiInstrumentCount(): number;
|
|
@@ -349,6 +415,7 @@ declare class RealtimeEngine {
|
|
|
349
415
|
setExternalMidiClockEnabled(enabled: boolean): void;
|
|
350
416
|
/** Count of external-MIDI events dropped because the output queue was full. */
|
|
351
417
|
externalMidiDroppedCount(): number;
|
|
418
|
+
externalMidiPendingCount(): number;
|
|
352
419
|
/**
|
|
353
420
|
* Drain queued external-MIDI events, already lowered to MIDI 1.0 byte
|
|
354
421
|
* messages ready to write to a Web MIDI output port. Call once per audio
|
|
@@ -357,6 +424,13 @@ declare class RealtimeEngine {
|
|
|
357
424
|
* queued for the next call (lossless); call again to drain the rest.
|
|
358
425
|
*/
|
|
359
426
|
drainExternalMidi(maxRecords?: number): WasmExternalMidiEvent[];
|
|
427
|
+
/** Scalar, allocation-free external-MIDI drain for AudioWorklet SAB output. */
|
|
428
|
+
popExternalMidiToScratch(): boolean;
|
|
429
|
+
externalMidiScratchDestinationId(): number;
|
|
430
|
+
externalMidiScratchRenderFrame(): number;
|
|
431
|
+
externalMidiScratchByteWord(): number;
|
|
432
|
+
externalMidiScratchByteCount(): number;
|
|
433
|
+
consumeExternalMidiScratch(): void;
|
|
360
434
|
pushMidiInputNoteOn(group: number, channel: number, note: number, velocity: number, portTimeSamples?: number): void;
|
|
361
435
|
pushMidiInputNoteOff(group: number, channel: number, note: number, velocity?: number, portTimeSamples?: number): void;
|
|
362
436
|
pushMidiInputCc(group: number, channel: number, controller: number, value: number, portTimeSamples?: number): void;
|
|
@@ -369,6 +443,8 @@ declare class RealtimeEngine {
|
|
|
369
443
|
* immediate. Mirrors the Node/Python/C-ABI `pushMidiCc`.
|
|
370
444
|
*/
|
|
371
445
|
pushMidiCc(destinationId: number, group: number, channel: number, controller: number, value: number, renderFrame?: number): void;
|
|
446
|
+
/** Queue one immediate MIDI 1.0 channel-voice UMP word for a destination. */
|
|
447
|
+
pushMidiUmp(destinationId: number, word0: number, renderFrame?: number): void;
|
|
372
448
|
/**
|
|
373
449
|
* Queue an immediate (live) MIDI SysEx frame to a MIDI destination. `data` is
|
|
374
450
|
* the full message including the leading 0xF0 and trailing 0xF7 (1..512
|
|
@@ -398,6 +474,8 @@ declare class RealtimeEngine {
|
|
|
398
474
|
* settled values instead of ramping in from defaults.
|
|
399
475
|
*/
|
|
400
476
|
settleParameters(): void;
|
|
477
|
+
/** Drains queued commands on an offline/control-only engine immediately. */
|
|
478
|
+
flushControlCommands(): void;
|
|
401
479
|
seekPpq(ppq: number, renderFrame?: number): void;
|
|
402
480
|
/** Set a finite tempo in the range (0, 100000] BPM. */
|
|
403
481
|
setTempo(bpm: number): void;
|
|
@@ -475,7 +553,7 @@ declare class RealtimeEngine {
|
|
|
475
553
|
/** Sets a track lane strip's pan position in realtime (glitch-free). */
|
|
476
554
|
setTrackStripPan(trackId: number, pan: number): void;
|
|
477
555
|
/** Sets a track lane strip's pan law in realtime. */
|
|
478
|
-
setTrackStripPanLaw(trackId: number, panLaw:
|
|
556
|
+
setTrackStripPanLaw(trackId: number, panLaw: PanLawInput): void;
|
|
479
557
|
/** Sets a track lane strip's pan mode in realtime. */
|
|
480
558
|
setTrackStripPanMode(trackId: number, panMode: PanMode | number): void;
|
|
481
559
|
/** Sets a track lane strip's dual-pan left/right positions in realtime. */
|
|
@@ -490,16 +568,29 @@ declare class RealtimeEngine {
|
|
|
490
568
|
clearClipPage(providerId: number, pageIndex: number): void;
|
|
491
569
|
destroyClipPageProvider(providerId: number): void;
|
|
492
570
|
popClipPageRequest(): ClipPageRequest | null;
|
|
571
|
+
/**
|
|
572
|
+
* Moves one native request into the binding's persistent scalar scratch.
|
|
573
|
+
* This avoids creating an embind JS object in AudioWorklet process().
|
|
574
|
+
*/
|
|
575
|
+
popClipPageRequestToScratch(): boolean;
|
|
576
|
+
clipPageRequestScratchClipId(): number;
|
|
577
|
+
clipPageRequestScratchSample(): number;
|
|
578
|
+
/** Cumulative page misses dropped because the native bounded request queue was full. */
|
|
579
|
+
clipPageRequestOverflowCount(): number;
|
|
493
580
|
setCaptureBuffer(numChannels: number, capacityFrames: number): void;
|
|
494
581
|
armCapture(armed?: boolean): void;
|
|
495
582
|
setCapturePunch(startSample: number, endSample: number, enabled?: boolean): void;
|
|
496
|
-
setCaptureSource(source:
|
|
583
|
+
setCaptureSource(source: EngineCaptureSource): void;
|
|
497
584
|
/** Positive values delay capture relative to the punch window. */
|
|
498
585
|
setRecordOffsetSamples(offsetSamples: number): void;
|
|
499
586
|
setInputMonitor(enabled: boolean, gain?: number): void;
|
|
500
587
|
resetCapture(): void;
|
|
501
588
|
captureStatus(): EngineCaptureStatus;
|
|
502
589
|
capturedAudio(): Float32Array[];
|
|
590
|
+
/**
|
|
591
|
+
* Renders in place, adding engine output to `channels`. Zero each plane first
|
|
592
|
+
* when it contains no upstream input.
|
|
593
|
+
*/
|
|
503
594
|
process(channels: Float32Array[]): Float32Array[];
|
|
504
595
|
/**
|
|
505
596
|
* Allocates persistent per-channel WASM-heap scratch for the zero-copy
|
|
@@ -516,6 +607,7 @@ declare class RealtimeEngine {
|
|
|
516
607
|
getChannelBuffer(channel: number, numFrames: number): Float32Array;
|
|
517
608
|
/**
|
|
518
609
|
* Runs the engine in place over the prepared per-channel scratch buffers.
|
|
610
|
+
* Zero each active span first when it contains no upstream input.
|
|
519
611
|
* Allocation-free: safe to call on the AudioWorklet render thread after
|
|
520
612
|
* `prepareChannels`.
|
|
521
613
|
*/
|
|
@@ -525,6 +617,18 @@ declare class RealtimeEngine {
|
|
|
525
617
|
bounceOffline(options: EngineBounceOptions): EngineBounceResult;
|
|
526
618
|
freezeOffline(options: EngineFreezeOptions): EngineFreezeResult;
|
|
527
619
|
drainTelemetry(maxRecords?: number): EngineTelemetry[];
|
|
620
|
+
popTelemetryToScratch(): boolean;
|
|
621
|
+
telemetryScratchType(): number;
|
|
622
|
+
telemetryScratchError(): number;
|
|
623
|
+
telemetryScratchRenderFrame(): number;
|
|
624
|
+
telemetryScratchTimelineSample(): number;
|
|
625
|
+
telemetryScratchAudibleTimelineSample(): number;
|
|
626
|
+
telemetryScratchGraphLatencySamplesQ8(): number;
|
|
627
|
+
telemetryScratchValue(): number;
|
|
628
|
+
popMeterTelemetryToScratch(): boolean;
|
|
629
|
+
meterScratchTargetId(): number;
|
|
630
|
+
meterScratchRenderFrame(): number;
|
|
631
|
+
meterScratchValue(field: number): number;
|
|
528
632
|
drainMeterTelemetry(maxRecords?: number): EngineMeterTelemetry[];
|
|
529
633
|
/**
|
|
530
634
|
* Drains pending meter telemetry as per-plane (wide) records for a surround
|
|
@@ -544,6 +648,14 @@ declare class RealtimeEngine {
|
|
|
544
648
|
configureScopeTelemetry(intervalFrames: number, bandCount: number): number;
|
|
545
649
|
/** Drains pending spectrum + vectorscope snapshots (per mix target). */
|
|
546
650
|
drainScopeTelemetry(maxRecords?: number): EngineScopeTelemetry[];
|
|
651
|
+
popScopeTelemetryToScratch(): boolean;
|
|
652
|
+
scopeScratchTargetId(): number;
|
|
653
|
+
scopeScratchRenderFrame(): number;
|
|
654
|
+
scopeScratchBandCount(): number;
|
|
655
|
+
scopeScratchBand(index: number): number;
|
|
656
|
+
scopeScratchPointCount(): number;
|
|
657
|
+
scopeScratchPointLeft(index: number): number;
|
|
658
|
+
scopeScratchPointRight(index: number): number;
|
|
547
659
|
destroy(): void;
|
|
548
660
|
}
|
|
549
661
|
declare class ClipPageProvider {
|
|
@@ -556,6 +668,161 @@ declare class ClipPageProvider {
|
|
|
556
668
|
destroy(): void;
|
|
557
669
|
}
|
|
558
670
|
|
|
671
|
+
interface OpfsClipPageProviderOptions {
|
|
672
|
+
path: string;
|
|
673
|
+
numChannels: number;
|
|
674
|
+
numSamples: number;
|
|
675
|
+
pageFrames: number;
|
|
676
|
+
dataOffsetBytes?: number;
|
|
677
|
+
worker?: Worker;
|
|
678
|
+
terminateWorkerOnClose?: boolean;
|
|
679
|
+
/** Internal bridge hook used to mirror a supplied page into an AudioWorklet. */
|
|
680
|
+
onPageSupplied?: (pageIndex: number, channels: Float32Array[]) => void;
|
|
681
|
+
/** Internal bridge hook used to mirror an eviction into an AudioWorklet. */
|
|
682
|
+
onPageCleared?: (pageIndex: number) => void;
|
|
683
|
+
/** Internal bridge hook called after the local provider is destroyed. */
|
|
684
|
+
onClose?: () => void;
|
|
685
|
+
}
|
|
686
|
+
interface OpfsClipPageProviderBinding {
|
|
687
|
+
provider: ClipPageProvider;
|
|
688
|
+
supplyPage(pageIndex: number): Promise<boolean>;
|
|
689
|
+
supplyRequest(request: ClipPageRequest): Promise<boolean>;
|
|
690
|
+
/** Evict one resident page from every configured consumer. */
|
|
691
|
+
clearPage?(pageIndex: number): void;
|
|
692
|
+
close(): void;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Minimal engine surface the streamer drives. {@link RealtimeEngine} satisfies
|
|
697
|
+
* this structurally; tests can supply a lightweight stand-in.
|
|
698
|
+
*/
|
|
699
|
+
interface ClipPageStreamerEngine {
|
|
700
|
+
/** Drain one pending audio-thread page-miss request, or `null` when empty. */
|
|
701
|
+
popClipPageRequest(): ClipPageStreamerRequest | null;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* A page miss reported by either a direct engine (`sample`) or the worklet
|
|
705
|
+
* bridge (`pageIndex`). Exactly one position form is required.
|
|
706
|
+
*/
|
|
707
|
+
interface ClipPageStreamerRequest {
|
|
708
|
+
clipId: number;
|
|
709
|
+
sample?: number;
|
|
710
|
+
pageIndex?: number;
|
|
711
|
+
}
|
|
712
|
+
/** A paged clip the streamer keeps fed from its backing store. */
|
|
713
|
+
interface ClipPageStreamSource {
|
|
714
|
+
/** Clip schedule id passed to `setClips` (matches {@link ClipPageRequest.clipId}). */
|
|
715
|
+
clipId: number;
|
|
716
|
+
/** OPFS-backed page provider binding for this clip. */
|
|
717
|
+
binding: OpfsClipPageProviderBinding;
|
|
718
|
+
/** Page size in frames (must equal the provider's `pageFrames`). */
|
|
719
|
+
pageFrames: number;
|
|
720
|
+
/** Total sample count of the clip source. */
|
|
721
|
+
numSamples: number;
|
|
722
|
+
}
|
|
723
|
+
interface ClipPageStreamerOptions {
|
|
724
|
+
/**
|
|
725
|
+
* Pages to prefetch ahead of the page a miss was reported for. Larger values
|
|
726
|
+
* hide fetch latency at the cost of more resident memory. Default 2.
|
|
727
|
+
*/
|
|
728
|
+
readAheadPages?: number;
|
|
729
|
+
/**
|
|
730
|
+
* Pages to retain behind the playback frontier before eviction, so a small
|
|
731
|
+
* backward seek does not immediately miss. Default 1.
|
|
732
|
+
*/
|
|
733
|
+
retainBehindPages?: number;
|
|
734
|
+
/**
|
|
735
|
+
* Upper bound on requests drained per {@link ClipPageStreamer.pump} call, so a
|
|
736
|
+
* burst of misses cannot spin unbounded. Default 256.
|
|
737
|
+
*/
|
|
738
|
+
maxRequestsPerPump?: number;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Keeps OPFS-paged clips fed within a bounded sliding window around the live
|
|
742
|
+
* playback position, so a multitrack arrangement never holds its full PCM in
|
|
743
|
+
* WASM memory.
|
|
744
|
+
*
|
|
745
|
+
* The audio thread reports a page miss whenever the {@link ClipPlayer} reads a
|
|
746
|
+
* sample whose page is not resident. {@link pump} drains those requests, fetches
|
|
747
|
+
* the missing page plus a read-ahead window from each clip's backing store, and
|
|
748
|
+
* evicts pages that fall outside the window via the provider's `clear`. The
|
|
749
|
+
* resident set per clip is therefore bounded to
|
|
750
|
+
* `retainBehindPages + readAheadPages + 1` pages regardless of clip length.
|
|
751
|
+
*
|
|
752
|
+
* Call {@link pump} on a cadence that keeps up with playback — typically once
|
|
753
|
+
* per animation frame or per worklet control tick on the main/control thread
|
|
754
|
+
* (never the audio thread; fetches are asynchronous).
|
|
755
|
+
*/
|
|
756
|
+
declare class ClipPageStreamer {
|
|
757
|
+
private readonly engine;
|
|
758
|
+
private readonly readAheadPages;
|
|
759
|
+
private readonly retainBehindPages;
|
|
760
|
+
private readonly maxRequestsPerPump;
|
|
761
|
+
private readonly sources;
|
|
762
|
+
private closed;
|
|
763
|
+
constructor(engine: ClipPageStreamerEngine, options?: ClipPageStreamerOptions);
|
|
764
|
+
/**
|
|
765
|
+
* Register a paged clip. Pages already supplied to the provider before
|
|
766
|
+
* registration (for example a primed first page) should be passed in
|
|
767
|
+
* `initialResidentPages` so they participate in eviction.
|
|
768
|
+
*/
|
|
769
|
+
addSource(source: ClipPageStreamSource, initialResidentPages?: Iterable<number>): void;
|
|
770
|
+
/** Stop tracking a clip. Does not close its binding (the caller owns that). */
|
|
771
|
+
removeSource(clipId: number): void;
|
|
772
|
+
/**
|
|
773
|
+
* Explicitly start a new playback generation after a host seek/loop. Resident
|
|
774
|
+
* pages are evicted and any older in-flight fetch is cleared when it settles.
|
|
775
|
+
* The next miss establishes the new bounded window.
|
|
776
|
+
*/
|
|
777
|
+
resetSource(clipId: number): void;
|
|
778
|
+
/**
|
|
779
|
+
* Drain pending page-miss requests, fetch the missing pages plus their
|
|
780
|
+
* read-ahead window, and evict out-of-window pages. Resolves once this round's
|
|
781
|
+
* fetches settle. Concurrent fetches are serialized inside each binding.
|
|
782
|
+
*/
|
|
783
|
+
pump(): Promise<void>;
|
|
784
|
+
/** Close every registered clip's binding and stop tracking. */
|
|
785
|
+
close(): void;
|
|
786
|
+
private serviceFrontier;
|
|
787
|
+
private resetState;
|
|
788
|
+
private clearPage;
|
|
789
|
+
}
|
|
790
|
+
interface OpfsClipStreamOptions extends OpfsClipPageProviderOptions {
|
|
791
|
+
/** Clip schedule id used in `setClips` (matches the page-miss request clipId). */
|
|
792
|
+
clipId: number;
|
|
793
|
+
/**
|
|
794
|
+
* Leading pages fetched synchronously before returning, so playback can start
|
|
795
|
+
* without an immediate miss. Default 1.
|
|
796
|
+
*/
|
|
797
|
+
primePages?: number;
|
|
798
|
+
}
|
|
799
|
+
interface OpfsClipStream {
|
|
800
|
+
binding: OpfsClipPageProviderBinding;
|
|
801
|
+
/** Pass as `addClip`'s buffer argument to schedule the streaming clip. */
|
|
802
|
+
provider: ClipPageProvider;
|
|
803
|
+
}
|
|
804
|
+
/** Structural seam implemented by the AudioWorklet-backed `SonareEngine`. */
|
|
805
|
+
interface WorkletOpfsClipStreamHost {
|
|
806
|
+
attachOpfsClipStream(options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* One-call wiring of an OPFS-backed streaming clip: creates the page provider,
|
|
810
|
+
* primes the leading pages, and registers it with `streamer` so later misses are
|
|
811
|
+
* serviced within the bounded window. Returns the binding (for `close`) and the
|
|
812
|
+
* provider to schedule via `addClip(trackId, provider, startPpq, { id: clipId })`.
|
|
813
|
+
*
|
|
814
|
+
* @param streamer Shared streamer pumped on the control thread.
|
|
815
|
+
* @param engine Engine the provider is created on (the same one `streamer` drives).
|
|
816
|
+
* @param options Provider options plus `clipId` and optional `primePages`.
|
|
817
|
+
*/
|
|
818
|
+
declare function attachOpfsClipStream(streamer: ClipPageStreamer, engine: RealtimeEngine, options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
|
|
819
|
+
/**
|
|
820
|
+
* Worklet overload: delegates to `SonareEngine.attachOpfsClipStream`, which
|
|
821
|
+
* creates the remote provider and drives this same sliding-window policy from
|
|
822
|
+
* worklet page-miss messages.
|
|
823
|
+
*/
|
|
824
|
+
declare function attachOpfsClipStream(engine: WorkletOpfsClipStreamHost, options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
|
|
825
|
+
|
|
559
826
|
/**
|
|
560
827
|
* sonare - Audio Analysis Library
|
|
561
828
|
*
|
|
@@ -630,6 +897,10 @@ declare function decodeFrame(lo: number, hi: number): number;
|
|
|
630
897
|
declare const SONARE_ENGINE_RING_HEADER_INTS = 5;
|
|
631
898
|
declare const SONARE_ENGINE_COMMAND_RECORD_BYTES = 32;
|
|
632
899
|
declare const SONARE_ENGINE_TELEMETRY_RECORD_BYTES = 48;
|
|
900
|
+
declare const SONARE_CLIP_PAGE_REQUEST_RING_HEADER_INTS = 5;
|
|
901
|
+
declare const SONARE_CLIP_PAGE_REQUEST_RING_RECORD_UINT32S = 2;
|
|
902
|
+
declare const SONARE_EXTERNAL_MIDI_RING_HEADER_INTS = 5;
|
|
903
|
+
declare const SONARE_EXTERNAL_MIDI_RING_RECORD_UINT32S = 4;
|
|
633
904
|
declare enum SonareEngineCommandType {
|
|
634
905
|
SetParam = 0,
|
|
635
906
|
SetParamSmoothed = 1,
|
|
@@ -648,7 +919,8 @@ declare enum SonareEngineCommandType {
|
|
|
648
919
|
Punch = 14,
|
|
649
920
|
SetMetronome = 15,
|
|
650
921
|
SetMarker = 16,
|
|
651
|
-
SeekMarker = 17
|
|
922
|
+
SeekMarker = 17,
|
|
923
|
+
SetTrackMonitorMode = 26
|
|
652
924
|
}
|
|
653
925
|
declare enum SonareEngineTelemetryType {
|
|
654
926
|
ProcessBlock = 0,
|
|
@@ -673,7 +945,9 @@ declare enum SonareEngineTelemetryError {
|
|
|
673
945
|
ClipPageUnderrun = 15,
|
|
674
946
|
InsertAutomationOverflow = 16,
|
|
675
947
|
MidiClockOverflow = 17,
|
|
676
|
-
MetronomeOverflow = 18
|
|
948
|
+
MetronomeOverflow = 18,
|
|
949
|
+
InvalidCommand = 19,
|
|
950
|
+
MaxChannelsExceeded = 20
|
|
677
951
|
}
|
|
678
952
|
interface SonareMeterRingBuffer {
|
|
679
953
|
sharedBuffer: SharedArrayBuffer;
|
|
@@ -724,6 +998,27 @@ interface SonareScopeRingReadResult {
|
|
|
724
998
|
nextReadIndex: number;
|
|
725
999
|
scopes: SonareWorkletScopeSnapshot[];
|
|
726
1000
|
}
|
|
1001
|
+
interface SonareExternalMidiRingEvent {
|
|
1002
|
+
destinationId: number;
|
|
1003
|
+
renderFrame: number;
|
|
1004
|
+
byteWord: number;
|
|
1005
|
+
byteCount: number;
|
|
1006
|
+
}
|
|
1007
|
+
interface SonareExternalMidiRingBuffer {
|
|
1008
|
+
sharedBuffer: SharedArrayBuffer;
|
|
1009
|
+
header: Int32Array;
|
|
1010
|
+
records: Uint32Array;
|
|
1011
|
+
capacity: number;
|
|
1012
|
+
}
|
|
1013
|
+
interface SharedExternalMidiRingWriter {
|
|
1014
|
+
header: Int32Array;
|
|
1015
|
+
records: Uint32Array;
|
|
1016
|
+
capacity: number;
|
|
1017
|
+
}
|
|
1018
|
+
interface SonareExternalMidiRingReadResult {
|
|
1019
|
+
events: SonareExternalMidiRingEvent[];
|
|
1020
|
+
dropped: number;
|
|
1021
|
+
}
|
|
727
1022
|
interface SonareEngineCommandRecord {
|
|
728
1023
|
type: SonareEngineCommandType | number;
|
|
729
1024
|
targetId?: number;
|
|
@@ -756,6 +1051,26 @@ interface SonareEngineTelemetryRingReadResult {
|
|
|
756
1051
|
nextReadIndex: number;
|
|
757
1052
|
telemetry: SonareEngineTelemetryRecord[];
|
|
758
1053
|
}
|
|
1054
|
+
interface SonareClipPageRequest {
|
|
1055
|
+
clipId: number;
|
|
1056
|
+
pageIndex: number;
|
|
1057
|
+
}
|
|
1058
|
+
interface SonareClipPageRequestRingBuffer {
|
|
1059
|
+
sharedBuffer: SharedArrayBuffer;
|
|
1060
|
+
header: Int32Array;
|
|
1061
|
+
records: Uint32Array;
|
|
1062
|
+
capacity: number;
|
|
1063
|
+
}
|
|
1064
|
+
interface SharedClipPageRequestRingWriter {
|
|
1065
|
+
header: Int32Array;
|
|
1066
|
+
records: Uint32Array;
|
|
1067
|
+
capacity: number;
|
|
1068
|
+
}
|
|
1069
|
+
interface SonareClipPageRequestRingReadResult {
|
|
1070
|
+
requests: SonareClipPageRequest[];
|
|
1071
|
+
/** Cumulative uint32 drop count for native and SAB-ring overflows. */
|
|
1072
|
+
dropped: number;
|
|
1073
|
+
}
|
|
759
1074
|
declare function sonareMeterRingBufferByteLength(capacity: number): number;
|
|
760
1075
|
declare function createSonareMeterRingBuffer(capacity?: number): SonareMeterRingBuffer;
|
|
761
1076
|
declare function readSonareMeterRingBuffer(ring: SonareMeterRingBuffer, readIndex?: number): SonareMeterRingReadResult;
|
|
@@ -767,6 +1082,22 @@ declare function createSonareScopeRingBuffer(capacity?: number, bands?: number,
|
|
|
767
1082
|
declare function readSonareScopeRingBuffer(ring: SonareScopeRingBuffer, readIndex?: number): SonareScopeRingReadResult;
|
|
768
1083
|
declare function sonareEngineCommandRingBufferByteLength(capacity: number): number;
|
|
769
1084
|
declare function sonareEngineTelemetryRingBufferByteLength(capacity: number): number;
|
|
1085
|
+
declare function sonareClipPageRequestRingBufferByteLength(capacity: number): number;
|
|
1086
|
+
declare function sonareExternalMidiRingBufferByteLength(capacity: number): number;
|
|
1087
|
+
declare function createSonareExternalMidiRingBuffer(capacity?: number): SonareExternalMidiRingBuffer;
|
|
1088
|
+
/** Write one lowered MIDI-1 event without allocations from the audio worklet. */
|
|
1089
|
+
declare function pushSonareExternalMidiRingBuffer(ring: SharedExternalMidiRingWriter, destinationId: number, renderFrame: number, byteWord: number, byteCount: number): boolean;
|
|
1090
|
+
/** Main-thread drain. It is intentionally the only place MIDI byte arrays are built. */
|
|
1091
|
+
declare function readSonareExternalMidiRingBuffer(ring: SonareExternalMidiRingBuffer): SonareExternalMidiRingReadResult;
|
|
1092
|
+
declare function createSonareClipPageRequestRingBuffer(capacity?: number): SonareClipPageRequestRingBuffer;
|
|
1093
|
+
/**
|
|
1094
|
+
* Writes one request without allocating. Invalid uint32 coordinates and a full
|
|
1095
|
+
* ring are counted as drops so the main thread can surface a bounded-loss
|
|
1096
|
+
* diagnostic without receiving a worklet postMessage.
|
|
1097
|
+
*/
|
|
1098
|
+
declare function pushSonareClipPageRequestRingBuffer(ring: SharedClipPageRequestRingWriter, clipId: number, pageIndex: number): boolean;
|
|
1099
|
+
/** Drains the SPSC request ring on the main thread. Object creation is here, never in process(). */
|
|
1100
|
+
declare function readSonareClipPageRequestRingBuffer(ring: SonareClipPageRequestRingBuffer): SonareClipPageRequestRingReadResult;
|
|
770
1101
|
declare function createSonareEngineCommandRingBuffer(capacity?: number): SonareEngineCommandRingBuffer;
|
|
771
1102
|
declare function createSonareEngineTelemetryRingBuffer(capacity?: number): SonareEngineTelemetryRingBuffer;
|
|
772
1103
|
declare function pushSonareEngineCommandRingBuffer(ring: SonareEngineCommandRingBuffer, command: SonareEngineCommandRecord): boolean;
|
|
@@ -805,6 +1136,16 @@ interface SonareRealtimeEngineWorkletProcessorOptions {
|
|
|
805
1136
|
scopeBands?: number;
|
|
806
1137
|
scopeSharedBuffer?: SharedArrayBuffer;
|
|
807
1138
|
scopeRingCapacity?: number;
|
|
1139
|
+
/**
|
|
1140
|
+
* Lock-free SPSC queue for clip-page cache misses. Supplying this is required
|
|
1141
|
+
* for realtime-safe OPFS streaming: it avoids both embind object creation and
|
|
1142
|
+
* postMessage structured cloning from AudioWorklet process().
|
|
1143
|
+
*/
|
|
1144
|
+
clipPageRequestSharedBuffer?: SharedArrayBuffer;
|
|
1145
|
+
clipPageRequestRingCapacity?: number;
|
|
1146
|
+
/** Lock-free worklet-to-main-thread MIDI-1 output ring. */
|
|
1147
|
+
externalMidiSharedBuffer?: SharedArrayBuffer;
|
|
1148
|
+
externalMidiRingCapacity?: number;
|
|
808
1149
|
}
|
|
809
1150
|
interface SonareRealtimeVoiceChangerWorkletProcessorOptions {
|
|
810
1151
|
preset?: RealtimeVoiceChangerConfigInput;
|
|
@@ -814,7 +1155,8 @@ interface SonareRealtimeVoiceChangerWorkletProcessorOptions {
|
|
|
814
1155
|
}
|
|
815
1156
|
interface SonareRealtimeVoiceChangerSetConfigMessage {
|
|
816
1157
|
type: 'setConfig';
|
|
817
|
-
|
|
1158
|
+
/** Pre-normalized by the main thread; never JSON parsed in the worklet. */
|
|
1159
|
+
config: RealtimeVoiceChangerPodConfig;
|
|
818
1160
|
}
|
|
819
1161
|
interface SonareRealtimeVoiceChangerResetMessage {
|
|
820
1162
|
type: 'reset';
|
|
@@ -829,6 +1171,10 @@ interface SonareRealtimeEngineNodeCapabilities {
|
|
|
829
1171
|
sharedArrayBuffer: boolean;
|
|
830
1172
|
atomics: boolean;
|
|
831
1173
|
audioWorklet: boolean;
|
|
1174
|
+
/** True only when clip-page misses use the bounded SAB ring. */
|
|
1175
|
+
clipPageRequestsRealtimeSafe: boolean;
|
|
1176
|
+
/** True when external MIDI uses the SAB output ring rather than postMessage. */
|
|
1177
|
+
externalMidiRealtimeSafe: boolean;
|
|
832
1178
|
engineAbiVersion?: number;
|
|
833
1179
|
expectedEngineAbiVersion?: number;
|
|
834
1180
|
abiCompatible?: boolean;
|
|
@@ -885,9 +1231,15 @@ interface SonareWorkletExternalMidiMessage {
|
|
|
885
1231
|
type: 'externalMidi';
|
|
886
1232
|
events: SonareWorkletExternalMidiEvent[];
|
|
887
1233
|
}
|
|
888
|
-
|
|
1234
|
+
/** A control-plane sync message that the worklet rejected without crashing. */
|
|
1235
|
+
interface SonareEngineSyncErrorMessage {
|
|
1236
|
+
type: 'syncError';
|
|
1237
|
+
syncType: SonareEngineSyncMessage['type'];
|
|
1238
|
+
message: string;
|
|
1239
|
+
}
|
|
1240
|
+
type SonareWorkletTransportMessage = SonareWorkletMeterSnapshot | SonareWorkletSpectrumSnapshot | SonareWorkletExternalMidiMessage | SonareEngineClipPageRequestMessage | SonareEngineTelemetryRecord;
|
|
889
1241
|
interface WorkletTransport {
|
|
890
|
-
postMessage?: (message: SonareWorkletTransportMessage |
|
|
1242
|
+
postMessage?: (message: SonareWorkletTransportMessage | SonareEngineCaptureResponseMessageInternal | SonareEngineTransportResponseMessage | SonareEngineSyncErrorMessage, transfer?: Transferable[]) => void;
|
|
891
1243
|
onMeter?: (meter: SonareWorkletMeterSnapshot) => void;
|
|
892
1244
|
onSpectrum?: (spectrum: SonareWorkletSpectrumSnapshot) => void;
|
|
893
1245
|
}
|
|
@@ -904,7 +1256,8 @@ interface SonareEngineSyncClipsDeltaMessage {
|
|
|
904
1256
|
interface SonareEngineSyncClipPageProviderMessage {
|
|
905
1257
|
type: 'syncClipPageProvider';
|
|
906
1258
|
clipId: number;
|
|
907
|
-
clip
|
|
1259
|
+
/** Omitted when an OPFS stream is primed before its clip is scheduled. */
|
|
1260
|
+
clip?: EngineClip;
|
|
908
1261
|
numChannels: number;
|
|
909
1262
|
numSamples: number;
|
|
910
1263
|
pageFrames: number;
|
|
@@ -916,10 +1269,41 @@ interface SonareEngineSyncClipPageMessage {
|
|
|
916
1269
|
pageIndex: number;
|
|
917
1270
|
channels: Float32Array[];
|
|
918
1271
|
}
|
|
1272
|
+
/** Evicts one page after the main-thread sliding window advances. */
|
|
1273
|
+
interface SonareEngineSyncClipPageClearMessage {
|
|
1274
|
+
type: 'syncClipPageClear';
|
|
1275
|
+
clipId: number;
|
|
1276
|
+
pageIndex: number;
|
|
1277
|
+
}
|
|
1278
|
+
/** Releases a provider whose clip was removed or whose stream was closed. */
|
|
1279
|
+
interface SonareEngineSyncClipPageDestroyMessage {
|
|
1280
|
+
type: 'syncClipPageDestroy';
|
|
1281
|
+
clipId: number;
|
|
1282
|
+
}
|
|
919
1283
|
/** Makes a fully supplied paged clip visible to the audio engine. */
|
|
920
1284
|
interface SonareEngineSyncClipPageCommitMessage {
|
|
921
1285
|
type: 'syncClipPageCommit';
|
|
922
1286
|
clipId: number;
|
|
1287
|
+
/**
|
|
1288
|
+
* Clip schedule to publish with a provider that was primed before its
|
|
1289
|
+
* schedule was known. The original pre-baked push path supplies it on the
|
|
1290
|
+
* provider message instead.
|
|
1291
|
+
*/
|
|
1292
|
+
clip?: EngineClip;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* A bounded batch of page misses emitted by the AudioWorklet. The main thread
|
|
1296
|
+
* resolves these from OPFS and responds with `syncClipPage`; a missing page is
|
|
1297
|
+
* silent until that response arrives.
|
|
1298
|
+
*/
|
|
1299
|
+
interface SonareEngineClipPageRequestMessage {
|
|
1300
|
+
type: 'clipPageRequest';
|
|
1301
|
+
requests: Array<{
|
|
1302
|
+
clipId: number;
|
|
1303
|
+
pageIndex: number;
|
|
1304
|
+
}>;
|
|
1305
|
+
/** Number of misses dropped because a bounded native or SAB request queue was full. */
|
|
1306
|
+
dropped?: number;
|
|
923
1307
|
}
|
|
924
1308
|
interface SonareEngineSyncMidiClipsMessage {
|
|
925
1309
|
type: 'syncMidiClips';
|
|
@@ -938,6 +1322,11 @@ interface SonareEngineSyncAutomationMessage {
|
|
|
938
1322
|
paramId: number;
|
|
939
1323
|
points: EngineAutomationPoint[];
|
|
940
1324
|
}
|
|
1325
|
+
/** Replaces the live engine's registered custom-parameter set. */
|
|
1326
|
+
interface SonareEngineSyncParametersMessage {
|
|
1327
|
+
type: 'syncParameters';
|
|
1328
|
+
parameters: EngineParameterInfo[];
|
|
1329
|
+
}
|
|
941
1330
|
interface SonareEngineSyncTempoMessage {
|
|
942
1331
|
type: 'syncTempo';
|
|
943
1332
|
bpm: number;
|
|
@@ -1068,6 +1457,7 @@ interface SonareEngineSyncSf2InstrumentMessage {
|
|
|
1068
1457
|
destinationId?: number;
|
|
1069
1458
|
gain?: number;
|
|
1070
1459
|
polyphony?: number;
|
|
1460
|
+
preferModelForModeledFamilies?: boolean;
|
|
1071
1461
|
};
|
|
1072
1462
|
}
|
|
1073
1463
|
interface SonareEngineSyncLoadSoundFontMessage {
|
|
@@ -1098,6 +1488,12 @@ interface SonareEngineSyncMidiCcMessage {
|
|
|
1098
1488
|
value: number;
|
|
1099
1489
|
renderFrame: number;
|
|
1100
1490
|
}
|
|
1491
|
+
interface SonareEngineSyncMidiUmpMessage {
|
|
1492
|
+
type: 'syncMidiUmp';
|
|
1493
|
+
destinationId: number;
|
|
1494
|
+
word0: number;
|
|
1495
|
+
renderFrame: number;
|
|
1496
|
+
}
|
|
1101
1497
|
interface SonareEngineSyncMidiSysexMessage {
|
|
1102
1498
|
type: 'syncMidiSysex';
|
|
1103
1499
|
destinationId: number;
|
|
@@ -1117,12 +1513,42 @@ interface SonareEngineSyncExternalMidiClockMessage {
|
|
|
1117
1513
|
type: 'syncExternalMidiClock';
|
|
1118
1514
|
enabled: boolean;
|
|
1119
1515
|
}
|
|
1120
|
-
|
|
1516
|
+
interface SonareEngineSyncMidiInputSourceMessage {
|
|
1517
|
+
type: 'syncMidiInputSource' | 'syncClearMidiInputSource';
|
|
1518
|
+
destinationId?: number;
|
|
1519
|
+
}
|
|
1520
|
+
interface SonareEngineSyncMidiCcBindingMessage {
|
|
1521
|
+
type: 'syncMidiCcBinding';
|
|
1522
|
+
channel: number;
|
|
1523
|
+
controller: number;
|
|
1524
|
+
paramId: number;
|
|
1525
|
+
minValue: number;
|
|
1526
|
+
maxValue: number;
|
|
1527
|
+
}
|
|
1528
|
+
interface SonareEngineSyncMidiInputEventMessage {
|
|
1529
|
+
type: 'syncMidiInputNoteOn' | 'syncMidiInputNoteOff' | 'syncMidiInputCc';
|
|
1530
|
+
group: number;
|
|
1531
|
+
channel: number;
|
|
1532
|
+
data0: number;
|
|
1533
|
+
data1: number;
|
|
1534
|
+
portTimeSamples: number;
|
|
1535
|
+
}
|
|
1536
|
+
/** Releases the realtime engine and all worklet-owned clip buffers. */
|
|
1537
|
+
interface SonareEngineDestroyMessage {
|
|
1538
|
+
type: 'destroy';
|
|
1539
|
+
}
|
|
1540
|
+
type SonareEngineSyncMessage = SonareEngineSyncClipsMessage | SonareEngineSyncClipsDeltaMessage | SonareEngineSyncClipPageProviderMessage | SonareEngineSyncClipPageMessage | SonareEngineSyncClipPageClearMessage | SonareEngineSyncClipPageCommitMessage | SonareEngineSyncClipPageDestroyMessage | SonareEngineSyncMidiClipsMessage | SonareEngineSyncMarkersMessage | SonareEngineSyncMetronomeMessage | SonareEngineSyncAutomationMessage | SonareEngineSyncParametersMessage | SonareEngineSyncTempoMessage | SonareEngineSyncMixerMessage | SonareEngineSyncCaptureMessage | SonareEngineSyncTrackStripEqBandMessage | SonareEngineSyncMasterStripEqBandMessage | SonareEngineSyncTrackStripInsertBypassedMessage | SonareEngineSyncMasterStripInsertBypassedMessage | SonareEngineSyncTrackStripInsertParamByNameMessage | SonareEngineSyncMasterStripInsertParamByNameMessage | SonareEngineSyncBusStripInsertParamByNameMessage | SonareEngineSyncTrackStripPanMessage | SonareEngineSyncTrackStripPanLawMessage | SonareEngineSyncTrackStripPanModeMessage | SonareEngineSyncTrackStripDualPanMessage | SonareEngineSyncTrackStripChannelDelaySamplesMessage | SonareEngineSyncBuiltinInstrumentMessage | SonareEngineSyncSynthInstrumentMessage | SonareEngineSyncSf2InstrumentMessage | SonareEngineSyncLoadSoundFontMessage | SonareEngineSyncMidiFxMessage | SonareEngineSyncMidiNoteMessage | SonareEngineSyncMidiCcMessage | SonareEngineSyncMidiUmpMessage | SonareEngineSyncMidiSysexMessage | SonareEngineSyncMidiPanicMessage | SonareEngineSyncMidiDestinationExternalMessage | SonareEngineSyncExternalMidiClockMessage | SonareEngineSyncMidiInputSourceMessage | SonareEngineSyncMidiCcBindingMessage | SonareEngineSyncMidiInputEventMessage | SonareEngineDestroyMessage;
|
|
1121
1541
|
interface SonareEngineCaptureRequestMessage {
|
|
1122
1542
|
type: 'captureRequest';
|
|
1123
1543
|
requestId: number;
|
|
1124
1544
|
op: 'status' | 'read' | 'reset';
|
|
1125
1545
|
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Public capture response shape retained for source compatibility.
|
|
1548
|
+
*
|
|
1549
|
+
* The worklet wire protocol is stricter than this legacy structural type; use
|
|
1550
|
+
* `SonareEngineCaptureResponseMessageInternal` inside the implementation.
|
|
1551
|
+
*/
|
|
1126
1552
|
interface SonareEngineCaptureResponseMessage {
|
|
1127
1553
|
type: 'captureResponse';
|
|
1128
1554
|
requestId: number;
|
|
@@ -1131,6 +1557,31 @@ interface SonareEngineCaptureResponseMessage {
|
|
|
1131
1557
|
channels?: Float32Array[] | number[][];
|
|
1132
1558
|
error?: string;
|
|
1133
1559
|
}
|
|
1560
|
+
interface SonareEngineCaptureStatusResponseMessageInternal {
|
|
1561
|
+
type: 'captureResponse';
|
|
1562
|
+
requestId: number;
|
|
1563
|
+
ok: true;
|
|
1564
|
+
status: EngineCaptureStatus;
|
|
1565
|
+
}
|
|
1566
|
+
interface SonareEngineCaptureReadResponseMessageInternal {
|
|
1567
|
+
type: 'captureResponse';
|
|
1568
|
+
requestId: number;
|
|
1569
|
+
ok: true;
|
|
1570
|
+
channels: Float32Array[];
|
|
1571
|
+
}
|
|
1572
|
+
interface SonareEngineCaptureResetResponseMessageInternal {
|
|
1573
|
+
type: 'captureResponse';
|
|
1574
|
+
requestId: number;
|
|
1575
|
+
ok: true;
|
|
1576
|
+
}
|
|
1577
|
+
interface SonareEngineCaptureErrorResponseMessageInternal {
|
|
1578
|
+
type: 'captureResponse';
|
|
1579
|
+
requestId: number;
|
|
1580
|
+
ok: false;
|
|
1581
|
+
error: string;
|
|
1582
|
+
}
|
|
1583
|
+
/** Strict wire response type used only by the worklet implementation. */
|
|
1584
|
+
type SonareEngineCaptureResponseMessageInternal = SonareEngineCaptureStatusResponseMessageInternal | SonareEngineCaptureReadResponseMessageInternal | SonareEngineCaptureResetResponseMessageInternal | SonareEngineCaptureErrorResponseMessageInternal;
|
|
1134
1585
|
interface SonareEngineTransportRequestMessage {
|
|
1135
1586
|
type: 'transportRequest';
|
|
1136
1587
|
requestId: number;
|
|
@@ -1194,6 +1645,12 @@ declare class SonareEngine {
|
|
|
1194
1645
|
private nextMarkerId;
|
|
1195
1646
|
private transportPlaying;
|
|
1196
1647
|
private readonly pendingInstrumentSync;
|
|
1648
|
+
private readonly workletClipPageRequests;
|
|
1649
|
+
private readonly workletPageProviderClipIds;
|
|
1650
|
+
private workletClipStreamer;
|
|
1651
|
+
private workletClipPump;
|
|
1652
|
+
private workletClipPagePollTimer;
|
|
1653
|
+
private unsubscribeWorkletClipRequests;
|
|
1197
1654
|
private destroyed;
|
|
1198
1655
|
private constructor();
|
|
1199
1656
|
static create(context: BaseAudioContext, options?: SonareEngineOptions): Promise<SonareEngine>;
|
|
@@ -1275,7 +1732,13 @@ declare class SonareEngine {
|
|
|
1275
1732
|
*/
|
|
1276
1733
|
automationLaneCount(): number;
|
|
1277
1734
|
listParameters(): EngineParameterInfo[];
|
|
1735
|
+
/** Registers a custom parameter on the offline mirror and worklet engine. */
|
|
1736
|
+
addParameter(info: EngineParameterInfo): void;
|
|
1737
|
+
/** Clears custom parameters and their automation lanes on both engines. */
|
|
1738
|
+
clearParameters(): void;
|
|
1278
1739
|
setSoloMute(target: string | number, solo: boolean, mute: boolean): boolean;
|
|
1740
|
+
/** Queues a per-track PFL/AFL monitor tap mode change. */
|
|
1741
|
+
setTrackMonitorMode(target: string | number, mode: EngineTrackMonitorMode, renderFrame?: number): boolean;
|
|
1279
1742
|
setStripGain(target: string | number, db: number): boolean;
|
|
1280
1743
|
setStripPan(target: string | number, pan: number): boolean;
|
|
1281
1744
|
/**
|
|
@@ -1324,7 +1787,18 @@ declare class SonareEngine {
|
|
|
1324
1787
|
setBusStripInsertParamByName(busId: number, insertIndex: number, paramName: string, value: number): void;
|
|
1325
1788
|
setStripInsertParamByName(target: string | number, insertIndex: number, paramName: string, value: number): void;
|
|
1326
1789
|
setMasterChain(sceneJson: string): void;
|
|
1327
|
-
|
|
1790
|
+
/**
|
|
1791
|
+
* Creates and primes an OPFS-backed page provider for this live worklet
|
|
1792
|
+
* engine. Pass the returned `provider` to {@link addClip} in place of a
|
|
1793
|
+
* `Float32Array[]`; the `clipId` in `options` must equal that clip's explicit
|
|
1794
|
+
* `opts.id`. Subsequent cache misses are fetched on the main thread and
|
|
1795
|
+
* supplied back to the worklet through its bounded pull protocol.
|
|
1796
|
+
*/
|
|
1797
|
+
attachOpfsClipStream(options: OpfsClipStreamOptions): Promise<{
|
|
1798
|
+
binding: OpfsClipPageProviderBinding;
|
|
1799
|
+
provider: ClipPageProvider;
|
|
1800
|
+
}>;
|
|
1801
|
+
addClip(trackId: string | number, buffer: Float32Array[] | ClipPageProvider, startPpq: number, opts?: Partial<Omit<EngineClip, 'channels' | 'pageProvider' | 'startPpq'>>): number;
|
|
1328
1802
|
removeClip(clipId: number): void;
|
|
1329
1803
|
setMidiClips(schedules: readonly EngineMidiClipSchedule[]): void;
|
|
1330
1804
|
setBuiltinInstrument(trackId: string | number, config?: {
|
|
@@ -1336,6 +1810,7 @@ declare class SonareEngine {
|
|
|
1336
1810
|
destinationId?: number;
|
|
1337
1811
|
gain?: number;
|
|
1338
1812
|
polyphony?: number;
|
|
1813
|
+
preferModelForModeledFamilies?: boolean;
|
|
1339
1814
|
}): void;
|
|
1340
1815
|
/**
|
|
1341
1816
|
* Route a track's MIDI to the external output (drained via {@link onMidiOut})
|
|
@@ -1363,9 +1838,20 @@ declare class SonareEngine {
|
|
|
1363
1838
|
pushMidiNoteOn(trackId: string | number, group: number, channel: number, note: number, velocity: number, renderFrame?: number): void;
|
|
1364
1839
|
pushMidiNoteOff(trackId: string | number, group: number, channel: number, note: number, velocity?: number, renderFrame?: number): void;
|
|
1365
1840
|
pushMidiCc(trackId: string | number, group: number, channel: number, controller: number, value: number, renderFrame?: number): void;
|
|
1841
|
+
pushMidiUmp(trackId: string | number, word0: number, renderFrame?: number): void;
|
|
1366
1842
|
pushMidiSysex(trackId: string | number, data: Uint8Array, renderFrame?: number): void;
|
|
1843
|
+
bindMidiCc(channel: number, controller: number, paramId: number, options?: MidiCcBindOptions): void;
|
|
1844
|
+
setMidiInputSource(destinationId?: number): void;
|
|
1845
|
+
clearMidiInputSource(): void;
|
|
1846
|
+
pushMidiInputNoteOn(group: number, channel: number, note: number, velocity: number, portTimeSamples?: number): void;
|
|
1847
|
+
pushMidiInputNoteOff(group: number, channel: number, note: number, velocity?: number, portTimeSamples?: number): void;
|
|
1848
|
+
pushMidiInputCc(group: number, channel: number, controller: number, value: number, portTimeSamples?: number): void;
|
|
1367
1849
|
pushMidiPanic(renderFrame?: number): void;
|
|
1368
1850
|
configureCapture(options: CaptureOptions): void;
|
|
1851
|
+
/**
|
|
1852
|
+
* Arms the engine-global capture path. `trackId` is retained for source
|
|
1853
|
+
* compatibility and must be `0`; per-track capture is not implemented.
|
|
1854
|
+
*/
|
|
1369
1855
|
armRecord(trackId: string | number, enabled: boolean): boolean;
|
|
1370
1856
|
punch(inPpq: number, outPpq: number): boolean;
|
|
1371
1857
|
captureStatus(): Promise<EngineCaptureStatus>;
|
|
@@ -1402,11 +1888,24 @@ declare class SonareEngine {
|
|
|
1402
1888
|
pollMeters(): SonareWorkletMeterSnapshot[];
|
|
1403
1889
|
pollScope(): SonareWorkletScopeSnapshot[];
|
|
1404
1890
|
destroy(): void;
|
|
1891
|
+
private ensureWorkletClipStreamer;
|
|
1892
|
+
/**
|
|
1893
|
+
* SAB requests have no postMessage wake-up by design. Polling on the main
|
|
1894
|
+
* thread is therefore intentionally outside the audio callback; 8 ms keeps
|
|
1895
|
+
* the bounded OPFS prefetch frontier responsive without adding worklet GC.
|
|
1896
|
+
*/
|
|
1897
|
+
private startWorkletClipPagePolling;
|
|
1898
|
+
private pumpWorkletClipPages;
|
|
1899
|
+
private enqueueWorkletClipPageRequest;
|
|
1900
|
+
private popWorkletClipPageRequest;
|
|
1901
|
+
private commitWorkletClipPageProvider;
|
|
1405
1902
|
private mixerLanes;
|
|
1406
1903
|
private syncMixer;
|
|
1407
1904
|
private postInstrumentSync;
|
|
1408
1905
|
private flushPendingInstrumentSync;
|
|
1409
1906
|
private postSync;
|
|
1907
|
+
private flushOfflineMirror;
|
|
1908
|
+
private sendMirroredCommand;
|
|
1410
1909
|
private get mixerContext();
|
|
1411
1910
|
private get stripContext();
|
|
1412
1911
|
private get automationContext();
|
|
@@ -1418,6 +1917,7 @@ declare class SonareEngine {
|
|
|
1418
1917
|
private stripParamId;
|
|
1419
1918
|
private sendSmoothedParam;
|
|
1420
1919
|
private resolveParamId;
|
|
1920
|
+
private syncParameters;
|
|
1421
1921
|
private resolveTargetId;
|
|
1422
1922
|
private ensureTrackLane;
|
|
1423
1923
|
private ensureBus;
|
|
@@ -1430,14 +1930,20 @@ declare class SonareRealtimeEngineNode {
|
|
|
1430
1930
|
readonly telemetryRing?: SonareEngineTelemetryRingBuffer;
|
|
1431
1931
|
readonly meterRing?: SonareMeterRingBuffer;
|
|
1432
1932
|
readonly scopeRing?: SonareScopeRingBuffer;
|
|
1933
|
+
readonly clipPageRequestRing?: SonareClipPageRequestRingBuffer;
|
|
1934
|
+
readonly externalMidiRing?: SonareExternalMidiRingBuffer;
|
|
1433
1935
|
readonly ready: Promise<void>;
|
|
1434
1936
|
private telemetryReadIndex;
|
|
1435
1937
|
private meterReadIndex;
|
|
1436
1938
|
private scopeReadIndex;
|
|
1939
|
+
private clipPageRequestDroppedRead;
|
|
1940
|
+
private ringPollTimer;
|
|
1437
1941
|
private telemetryListeners;
|
|
1438
1942
|
private meterListeners;
|
|
1439
1943
|
private scopeListeners;
|
|
1440
1944
|
private midiOutListeners;
|
|
1945
|
+
private clipPageRequestListeners;
|
|
1946
|
+
private syncErrorListeners;
|
|
1441
1947
|
private captureRequestId;
|
|
1442
1948
|
private readonly captureRequests;
|
|
1443
1949
|
private transportRequestId;
|
|
@@ -1446,6 +1952,8 @@ declare class SonareRealtimeEngineNode {
|
|
|
1446
1952
|
private rejectReady;
|
|
1447
1953
|
private destroyed;
|
|
1448
1954
|
private constructor();
|
|
1955
|
+
/** Subscribes to control-plane sync rejections reported by the worklet. */
|
|
1956
|
+
onSyncError(listener: (message: SonareEngineSyncErrorMessage) => void): () => void;
|
|
1449
1957
|
static create(context: BaseAudioContext, options?: SonareRealtimeEngineNodeOptions): Promise<SonareRealtimeEngineNode>;
|
|
1450
1958
|
play(sampleTime?: number): boolean;
|
|
1451
1959
|
stop(sampleTime?: number): boolean;
|
|
@@ -1459,6 +1967,14 @@ declare class SonareRealtimeEngineNode {
|
|
|
1459
1967
|
pollTelemetry(): SonareEngineTelemetryRecord[];
|
|
1460
1968
|
pollMeters(): SonareWorkletMeterSnapshot[];
|
|
1461
1969
|
pollScope(): SonareWorkletScopeSnapshot[];
|
|
1970
|
+
/** Drain lowered MIDI-1 records from the SAB ring on the main thread. */
|
|
1971
|
+
pollMidiOut(): SonareWorkletExternalMidiEvent[];
|
|
1972
|
+
/**
|
|
1973
|
+
* Drains bounded paged-clip misses from the SAB ring and forwards one batch
|
|
1974
|
+
* to subscribers. In postMessage mode the legacy handler remains available,
|
|
1975
|
+
* but that degraded path is not realtime-safe for OPFS streaming.
|
|
1976
|
+
*/
|
|
1977
|
+
pollClipPageRequests(): SonareEngineClipPageRequestMessage | undefined;
|
|
1462
1978
|
onTelemetry(callback: (telemetry: SonareEngineTelemetryRecord) => void): () => void;
|
|
1463
1979
|
onMeter(callback: (meter: SonareWorkletMeterSnapshot) => void): () => void;
|
|
1464
1980
|
onScope(callback: (scope: SonareWorkletScopeSnapshot) => void): () => void;
|
|
@@ -1468,10 +1984,18 @@ declare class SonareRealtimeEngineNode {
|
|
|
1468
1984
|
* Web MIDI output port. Returns an unsubscribe function.
|
|
1469
1985
|
*/
|
|
1470
1986
|
onMidiOut(callback: (events: SonareWorkletExternalMidiEvent[]) => void): () => void;
|
|
1987
|
+
/**
|
|
1988
|
+
* Subscribe to bounded batches of paged-clip misses from the worklet. The
|
|
1989
|
+
* callback runs on the main thread and may initiate asynchronous OPFS I/O.
|
|
1990
|
+
*/
|
|
1991
|
+
onClipPageRequests(callback: (message: SonareEngineClipPageRequestMessage) => void): () => void;
|
|
1471
1992
|
destroy(): void;
|
|
1472
1993
|
private emitTelemetry;
|
|
1994
|
+
private startRingPolling;
|
|
1995
|
+
private stopRingPollingIfUnused;
|
|
1473
1996
|
private emitMeter;
|
|
1474
1997
|
private emitMidiOut;
|
|
1998
|
+
private emitClipPageRequests;
|
|
1475
1999
|
private emitScope;
|
|
1476
2000
|
private sendCaptureRequest;
|
|
1477
2001
|
private sendTransportRequest;
|
|
@@ -1496,6 +2020,8 @@ declare class SonareRealtimeEngineWorkletProcessor {
|
|
|
1496
2020
|
private telemetryRing?;
|
|
1497
2021
|
private meterRing?;
|
|
1498
2022
|
private scopeRing?;
|
|
2023
|
+
private clipPageRequestRing?;
|
|
2024
|
+
private externalMidiRing?;
|
|
1499
2025
|
private transport?;
|
|
1500
2026
|
private meterIntervalFrames;
|
|
1501
2027
|
private lastMeterFrame;
|
|
@@ -1503,24 +2029,40 @@ declare class SonareRealtimeEngineWorkletProcessor {
|
|
|
1503
2029
|
private channelBuffers;
|
|
1504
2030
|
private readonly liveClips;
|
|
1505
2031
|
private readonly pagedClipProviders;
|
|
2032
|
+
private readonly pagedClipPageFrames;
|
|
1506
2033
|
private readonly pendingPagedClips;
|
|
2034
|
+
private readonly clipPageRequestClipIds;
|
|
2035
|
+
private readonly clipPageRequestPageIndices;
|
|
2036
|
+
private clipPageRequestOverflowReported;
|
|
1507
2037
|
constructor(options?: SonareRealtimeEngineWorkletProcessorOptions, transport?: WorkletTransport);
|
|
1508
2038
|
process(inputs: WorkletInput, outputs: WorkletOutput): boolean;
|
|
1509
2039
|
private reacquireChannelBuffers;
|
|
1510
2040
|
receiveCommand(command: SonareEngineCommandRecord): void;
|
|
1511
2041
|
receiveSync(message: SonareEngineSyncMessage): void;
|
|
2042
|
+
private applySync;
|
|
1512
2043
|
receiveCaptureRequest(message: SonareEngineCaptureRequestMessage): void;
|
|
1513
2044
|
receiveTransportRequest(message: SonareEngineTransportRequestMessage): void;
|
|
1514
2045
|
destroy(): void;
|
|
1515
2046
|
private drainCommands;
|
|
2047
|
+
private safeApplyCommand;
|
|
1516
2048
|
private applyCommand;
|
|
1517
2049
|
private publishTelemetry;
|
|
2050
|
+
private writeTelemetryScratch;
|
|
1518
2051
|
private publishTelemetryRecord;
|
|
1519
2052
|
private publishMeters;
|
|
2053
|
+
private writeMeterScratch;
|
|
1520
2054
|
private writeMeterRing;
|
|
1521
2055
|
private publishScope;
|
|
2056
|
+
private writeScopeScratch;
|
|
1522
2057
|
private publishExternalMidi;
|
|
1523
|
-
|
|
2058
|
+
/**
|
|
2059
|
+
* Forward a bounded batch of native page misses to the main thread. This
|
|
2060
|
+
* deliberately runs after audio rendering: a cache miss is silence for this
|
|
2061
|
+
* block, and OPFS I/O must never delay `process()`.
|
|
2062
|
+
*/
|
|
2063
|
+
private publishClipPageRequests;
|
|
2064
|
+
private removePagedClipProvider;
|
|
2065
|
+
private clearPagedClipProviders;
|
|
1524
2066
|
private commandRingFromSharedBuffer;
|
|
1525
2067
|
private telemetryRingFromSharedBuffer;
|
|
1526
2068
|
}
|
|
@@ -1571,16 +2113,14 @@ declare class SonareRealtimeVoiceChangerWorkletProcessor {
|
|
|
1571
2113
|
private readonly channelCount;
|
|
1572
2114
|
private monoInput;
|
|
1573
2115
|
private monoOutput;
|
|
2116
|
+
private bufferGeneration;
|
|
1574
2117
|
private planarChannels;
|
|
1575
2118
|
private destroyed;
|
|
1576
2119
|
constructor(options?: SonareRealtimeVoiceChangerWorkletProcessorOptions);
|
|
1577
2120
|
/**
|
|
1578
|
-
* Handles a control-plane message from the main thread.
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1581
|
-
* DSP coefficient recomputation here. `setConfig` MUST NOT be deferred
|
|
1582
|
-
* into `process()` because that would block the audio thread for longer
|
|
1583
|
-
* than one render quantum (e.g. 128 samples / 44.1 kHz = ~2.9 ms).
|
|
2121
|
+
* Handles a control-plane message from the main thread. AudioWorklet port
|
|
2122
|
+
* handlers run on the same audio rendering thread as `process()`: this path
|
|
2123
|
+
* therefore accepts only a pre-normalized POD and never parses JSON.
|
|
1584
2124
|
*/
|
|
1585
2125
|
receiveMessage(message: SonareRealtimeVoiceChangerMessage): void;
|
|
1586
2126
|
process(inputs: WorkletInput, outputs: WorkletOutput): boolean;
|
|
@@ -1602,4 +2142,4 @@ declare class SonareRealtimeVoiceChangerWorkletProcessor {
|
|
|
1602
2142
|
}
|
|
1603
2143
|
declare function registerSonareRealtimeVoiceChangerWorkletProcessor(name?: string): void;
|
|
1604
2144
|
|
|
1605
|
-
export { SONARE_ENGINE_COMMAND_RECORD_BYTES, SONARE_ENGINE_RING_HEADER_INTS, SONARE_ENGINE_TELEMETRY_RECORD_BYTES, SONARE_METER_RING_HEADER_INTS, SONARE_METER_RING_RECORD_FLOATS, SONARE_SCOPE_RING_HEADER_INTS, SONARE_SPECTRUM_RING_HEADER_INTS, SonareEngine, type SonareEngineCaptureRequestMessage, type SonareEngineCaptureResponseMessage, type SonareEngineCommandRecord, type SonareEngineCommandRingBuffer, SonareEngineCommandType, type SonareEngineOptions, type SonareEngineSyncAutomationMessage, type SonareEngineSyncBuiltinInstrumentMessage, type SonareEngineSyncCaptureMessage, type SonareEngineSyncClipsDeltaMessage, type SonareEngineSyncClipsMessage, type SonareEngineSyncLoadSoundFontMessage, type SonareEngineSyncMarkersMessage, type SonareEngineSyncMasterStripEqBandMessage, type SonareEngineSyncMasterStripInsertBypassedMessage, type SonareEngineSyncMessage, type SonareEngineSyncMetronomeMessage, type SonareEngineSyncMidiCcMessage, type SonareEngineSyncMidiClipsMessage, type SonareEngineSyncMidiNoteMessage, type SonareEngineSyncMidiPanicMessage, type SonareEngineSyncMixerMessage, type SonareEngineSyncSf2InstrumentMessage, type SonareEngineSyncSynthInstrumentMessage, type SonareEngineSyncTempoMessage, type SonareEngineSyncTrackStripEqBandMessage, type SonareEngineSyncTrackStripInsertBypassedMessage, SonareEngineTelemetryError, type SonareEngineTelemetryRecord, type SonareEngineTelemetryRingBuffer, type SonareEngineTelemetryRingReadResult, SonareEngineTelemetryType, type SonareEngineTransportFacade, type SonareEngineTransportRequestMessage, type SonareEngineTransportResponseMessage, type SonareMeterRingBuffer, type SonareMeterRingReadResult, SonareRealtimeEngineNode, type SonareRealtimeEngineNodeCapabilities, type SonareRealtimeEngineNodeOptions, SonareRealtimeEngineWorkletProcessor, type SonareRealtimeEngineWorkletProcessorOptions, type SonareRealtimeVoiceChangerDestroyMessage, type SonareRealtimeVoiceChangerMessage, type SonareRealtimeVoiceChangerResetMessage, type SonareRealtimeVoiceChangerSetConfigMessage, SonareRealtimeVoiceChangerWorkletProcessor, type SonareRealtimeVoiceChangerWorkletProcessorOptions, type SonareScopeRingBuffer, type SonareScopeRingReadResult, type SonareSpectrumRingBuffer, type SonareSpectrumRingReadResult, type SonareWorkletDestroyMessage, type SonareWorkletMessage, type SonareWorkletMeterSnapshot, SonareWorkletProcessor, type SonareWorkletProcessorOptions, type SonareWorkletScheduleInsertAutomationMessage, type SonareWorkletScopeSnapshot, type SonareWorkletSetMeterIntervalMessage, type SonareWorkletSpectrumSnapshot, type SonareWorkletTransportMessage, createSonareEngineCommandRingBuffer, createSonareEngineTelemetryRingBuffer, createSonareMeterRingBuffer, createSonareScopeRingBuffer, createSonareSpectrumRingBuffer, decodeFrame, encodeFrameHi, encodeFrameLo, init, isInitialized, popSonareEngineCommandRingBuffer, pushSonareEngineCommandRingBuffer, readSonareEngineTelemetryRingBuffer, readSonareMeterRingBuffer, readSonareScopeRingBuffer, readSonareSpectrumRingBuffer, registerSonareRealtimeEngineWorkletProcessor, registerSonareRealtimeVoiceChangerWorkletProcessor, registerSonareWorkletProcessor, sonareEngineCommandRingBufferByteLength, sonareEngineTelemetryRingBufferByteLength, sonareMeterRingBufferByteLength, sonareScopeRingBufferByteLength, sonareSpectrumRingBufferByteLength, writeSonareEngineTelemetryRingBuffer };
|
|
2145
|
+
export { type OpfsClipStream, type OpfsClipStreamOptions, SONARE_CLIP_PAGE_REQUEST_RING_HEADER_INTS, SONARE_CLIP_PAGE_REQUEST_RING_RECORD_UINT32S, SONARE_ENGINE_COMMAND_RECORD_BYTES, SONARE_ENGINE_RING_HEADER_INTS, SONARE_ENGINE_TELEMETRY_RECORD_BYTES, SONARE_EXTERNAL_MIDI_RING_HEADER_INTS, SONARE_EXTERNAL_MIDI_RING_RECORD_UINT32S, SONARE_METER_RING_HEADER_INTS, SONARE_METER_RING_RECORD_FLOATS, SONARE_SCOPE_RING_HEADER_INTS, SONARE_SPECTRUM_RING_HEADER_INTS, type SonareClipPageRequest, type SonareClipPageRequestRingBuffer, type SonareClipPageRequestRingReadResult, SonareEngine, type SonareEngineCaptureRequestMessage, type SonareEngineCaptureResponseMessage, type SonareEngineClipPageRequestMessage, type SonareEngineCommandRecord, type SonareEngineCommandRingBuffer, SonareEngineCommandType, type SonareEngineOptions, type SonareEngineSyncAutomationMessage, type SonareEngineSyncBuiltinInstrumentMessage, type SonareEngineSyncCaptureMessage, type SonareEngineSyncClipsDeltaMessage, type SonareEngineSyncClipsMessage, type SonareEngineSyncLoadSoundFontMessage, type SonareEngineSyncMarkersMessage, type SonareEngineSyncMasterStripEqBandMessage, type SonareEngineSyncMasterStripInsertBypassedMessage, type SonareEngineSyncMessage, type SonareEngineSyncMetronomeMessage, type SonareEngineSyncMidiCcMessage, type SonareEngineSyncMidiClipsMessage, type SonareEngineSyncMidiNoteMessage, type SonareEngineSyncMidiPanicMessage, type SonareEngineSyncMixerMessage, type SonareEngineSyncSf2InstrumentMessage, type SonareEngineSyncSynthInstrumentMessage, type SonareEngineSyncTempoMessage, type SonareEngineSyncTrackStripEqBandMessage, type SonareEngineSyncTrackStripInsertBypassedMessage, SonareEngineTelemetryError, type SonareEngineTelemetryRecord, type SonareEngineTelemetryRingBuffer, type SonareEngineTelemetryRingReadResult, SonareEngineTelemetryType, type SonareEngineTransportFacade, type SonareEngineTransportRequestMessage, type SonareEngineTransportResponseMessage, type SonareExternalMidiRingBuffer, type SonareExternalMidiRingReadResult, type SonareMeterRingBuffer, type SonareMeterRingReadResult, SonareRealtimeEngineNode, type SonareRealtimeEngineNodeCapabilities, type SonareRealtimeEngineNodeOptions, SonareRealtimeEngineWorkletProcessor, type SonareRealtimeEngineWorkletProcessorOptions, type SonareRealtimeVoiceChangerDestroyMessage, type SonareRealtimeVoiceChangerMessage, type SonareRealtimeVoiceChangerResetMessage, type SonareRealtimeVoiceChangerSetConfigMessage, SonareRealtimeVoiceChangerWorkletProcessor, type SonareRealtimeVoiceChangerWorkletProcessorOptions, type SonareScopeRingBuffer, type SonareScopeRingReadResult, type SonareSpectrumRingBuffer, type SonareSpectrumRingReadResult, type SonareWorkletDestroyMessage, type SonareWorkletMessage, type SonareWorkletMeterSnapshot, SonareWorkletProcessor, type SonareWorkletProcessorOptions, type SonareWorkletScheduleInsertAutomationMessage, type SonareWorkletScopeSnapshot, type SonareWorkletSetMeterIntervalMessage, type SonareWorkletSpectrumSnapshot, type SonareWorkletTransportMessage, attachOpfsClipStream, createSonareClipPageRequestRingBuffer, createSonareEngineCommandRingBuffer, createSonareEngineTelemetryRingBuffer, createSonareExternalMidiRingBuffer, createSonareMeterRingBuffer, createSonareScopeRingBuffer, createSonareSpectrumRingBuffer, decodeFrame, encodeFrameHi, encodeFrameLo, init, isInitialized, popSonareEngineCommandRingBuffer, pushSonareClipPageRequestRingBuffer, pushSonareEngineCommandRingBuffer, pushSonareExternalMidiRingBuffer, readSonareClipPageRequestRingBuffer, readSonareEngineTelemetryRingBuffer, readSonareExternalMidiRingBuffer, readSonareMeterRingBuffer, readSonareScopeRingBuffer, readSonareSpectrumRingBuffer, registerSonareRealtimeEngineWorkletProcessor, registerSonareRealtimeVoiceChangerWorkletProcessor, registerSonareWorkletProcessor, sonareClipPageRequestRingBufferByteLength, sonareEngineCommandRingBufferByteLength, sonareEngineTelemetryRingBufferByteLength, sonareExternalMidiRingBufferByteLength, sonareMeterRingBufferByteLength, sonareScopeRingBufferByteLength, sonareSpectrumRingBufferByteLength, writeSonareEngineTelemetryRingBuffer };
|