@libraz/libsonare 1.5.4 → 1.6.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 +5730 -0
- package/dist/analysis.js +2464 -0
- package/dist/analysis.js.map +1 -0
- package/dist/index.d.ts +873 -63
- package/dist/index.js +1037 -265
- 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 +707 -0
- package/dist/worker.js.map +1 -0
- package/dist/worklet.d.ts +596 -86
- package/dist/worklet.js +1658 -235
- package/dist/worklet.js.map +1 -1
- package/package.json +23 -11
- package/src/_chain_config.ts +5 -23
- package/src/analysis.ts +137 -0
- package/src/analysis_helpers.ts +29 -0
- package/src/audio.ts +5 -3
- package/src/clip_page_streamer.ts +62 -8
- package/src/codes.ts +51 -64
- package/src/effects_mastering.ts +1 -0
- package/src/effects_transform.ts +12 -6
- package/src/errors.ts +1 -0
- package/src/feature_core.ts +159 -3
- package/src/feature_music.ts +35 -16
- package/src/feature_pitch.ts +75 -6
- package/src/feature_spectral.ts +234 -8
- package/src/feature_spectrogram.ts +186 -5
- package/src/features.ts +16 -1
- package/src/index.ts +104 -7
- package/src/mastering_chain.ts +20 -8
- package/src/mastering_core.ts +7 -0
- package/src/mastering_dynamics.ts +7 -1
- package/src/metering.ts +51 -5
- package/src/mixer.ts +14 -1
- package/src/opfs_clip_pages.ts +26 -1
- package/src/project.ts +7 -0
- package/src/project_class.ts +74 -13
- package/src/project_internal.ts +24 -29
- package/src/project_types.ts +69 -10
- package/src/public_types.ts +68 -0
- package/src/public_types_mastering.ts +28 -0
- package/src/public_types_mixing.ts +11 -2
- package/src/public_types_music.ts +13 -0
- package/src/public_types_spectral.ts +43 -3
- package/src/quick_analysis.ts +48 -12
- package/src/realtime_engine.ts +162 -4
- package/src/realtime_voice_changer.ts +51 -77
- package/src/sonare-analysis.js.d.ts +8 -0
- package/src/sonare.js.d.ts +305 -9
- package/src/streaming_processors.ts +22 -1
- package/src/validation.ts +6 -0
- package/src/web_midi.ts +36 -4
- 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 +212 -4
- package/src/worklet/engine-offline.ts +7 -2
- package/src/worklet/engine-parameter-facade.ts +26 -5
- package/src/worklet/engine-processor.ts +383 -42
- package/src/worklet/engine-register.ts +8 -0
- package/src/worklet/engine-strips.ts +17 -1
- package/src/worklet/engine-sync.ts +2 -6
- package/src/worklet/engine-tempo-facade.ts +8 -6
- package/src/worklet/engine.ts +380 -13
- package/src/worklet/guards.ts +22 -1
- package/src/worklet/messages.ts +141 -9
- package/src/worklet/protocol.ts +303 -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"];
|
|
@@ -166,6 +99,135 @@ interface SynthPatch {
|
|
|
166
99
|
/** Gain-neutral bus saturation [0, 1]. */
|
|
167
100
|
busDrive?: number;
|
|
168
101
|
}
|
|
102
|
+
type ProjectMidiCcBindingKind = 0 | 1 | 2 | 3;
|
|
103
|
+
/** MIDI CC <-> automation binding descriptor used by CC learn/conversion helpers. */
|
|
104
|
+
interface ProjectMidiCcBinding {
|
|
105
|
+
ccNumber: number;
|
|
106
|
+
/** MIDI channel 0..15, or 255 for any channel. */
|
|
107
|
+
channel: number;
|
|
108
|
+
/** 0 = 7-bit CC, 1 = 14-bit CC, 2 = RPN, 3 = NRPN. */
|
|
109
|
+
kind: ProjectMidiCcBindingKind;
|
|
110
|
+
ccLsbNumber?: number;
|
|
111
|
+
selectorMsb?: number;
|
|
112
|
+
selectorLsb?: number;
|
|
113
|
+
paramId: number;
|
|
114
|
+
minValue: number;
|
|
115
|
+
maxValue: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
type PanMode = 'balance' | 'pan' | 'stereoPan' | 'stereo-pan' | 'dualPan' | 'dual-pan' | number;
|
|
119
|
+
/**
|
|
120
|
+
* Interpolation curve for scheduled automation events
|
|
121
|
+
* (see {@link Mixer.scheduleInsertAutomation}).
|
|
122
|
+
*/
|
|
123
|
+
type AutomationCurve = 'linear' | 'exponential' | 'hold' | 's-curve';
|
|
124
|
+
/**
|
|
125
|
+
* Pan law applied when computing left/right gains from a pan position
|
|
126
|
+
* (see {@link Mixer.setPanLaw}). On mono strips it changes the centre gain;
|
|
127
|
+
* on stereo Balance strips it changes only the far-channel taper, while centre
|
|
128
|
+
* remains unity. Maps to the underlying integer code.
|
|
129
|
+
*/
|
|
130
|
+
type PanLaw = 'const3dB' | 'const4.5dB' | 'const6dB' | 'linear0dB';
|
|
131
|
+
/** Pre/post-fader send timing (see {@link Mixer.addSend}). */
|
|
132
|
+
type SendTiming = 'preFader' | 'postFader';
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Equalizer band type (string union mirroring `sonare::mastering::eq::EqBandType`).
|
|
136
|
+
*/
|
|
137
|
+
type EqBandType = 'Peak' | 'LowShelf' | 'HighShelf' | 'LowPass' | 'HighPass' | 'BandPass' | 'Notch' | 'TiltShelf' | 'FlatTilt';
|
|
138
|
+
/** Biquad coefficient design mode. */
|
|
139
|
+
type EqCoeffMode = 'Rbj' | 'Vicanek';
|
|
140
|
+
/** Stereo placement for an EQ band. */
|
|
141
|
+
type EqStereoPlacement = 'Stereo' | 'Left' | 'Right' | 'Mid' | 'Side';
|
|
142
|
+
/** Per-band phase behaviour. */
|
|
143
|
+
type EqBandPhase = 'Inherit' | 'ZeroLatency' | 'NaturalPhase' | 'LinearPhase';
|
|
144
|
+
/**
|
|
145
|
+
* Equalizer band configuration accepted by {@link StreamingEqualizer.setBand}.
|
|
146
|
+
*
|
|
147
|
+
* All fields are optional; omitted values fall back to the C++ band defaults
|
|
148
|
+
* (Peak, 1000 Hz, 0 dB gain, Butterworth Q, disabled).
|
|
149
|
+
*/
|
|
150
|
+
interface EqBand {
|
|
151
|
+
type?: EqBandType;
|
|
152
|
+
frequencyHz?: number;
|
|
153
|
+
gainDb?: number;
|
|
154
|
+
q?: number;
|
|
155
|
+
enabled?: boolean;
|
|
156
|
+
coeffMode?: EqCoeffMode;
|
|
157
|
+
slopeDbOct?: number;
|
|
158
|
+
placement?: EqStereoPlacement;
|
|
159
|
+
phase?: EqBandPhase;
|
|
160
|
+
soloed?: boolean;
|
|
161
|
+
bypassed?: boolean;
|
|
162
|
+
proportionalQ?: boolean;
|
|
163
|
+
proportionalQStrength?: number;
|
|
164
|
+
dynamic?: boolean;
|
|
165
|
+
thresholdDb?: number;
|
|
166
|
+
autoThreshold?: boolean;
|
|
167
|
+
ratio?: number;
|
|
168
|
+
rangeDb?: number;
|
|
169
|
+
attackMs?: number;
|
|
170
|
+
releaseMs?: number;
|
|
171
|
+
lookaheadMs?: number;
|
|
172
|
+
externalSidechain?: boolean;
|
|
173
|
+
sidechainFreqHz?: number;
|
|
174
|
+
sidechainQ?: number;
|
|
175
|
+
}
|
|
176
|
+
type VoicePresetId = 'neutral-monitor' | 'bright-idol' | 'soft-whisper' | 'deep-narrator' | 'robot-mascot' | 'dark-villain';
|
|
177
|
+
interface RealtimeVoiceChangerPreset {
|
|
178
|
+
schemaVersion: 1;
|
|
179
|
+
id?: string;
|
|
180
|
+
name?: string;
|
|
181
|
+
description?: string;
|
|
182
|
+
macros?: Record<string, number>;
|
|
183
|
+
dsp?: Record<string, unknown>;
|
|
184
|
+
}
|
|
185
|
+
type RealtimeVoiceChangerConfigInput = VoicePresetId | RealtimeVoiceChangerPreset;
|
|
186
|
+
/**
|
|
187
|
+
* Flat (POD) realtime voice-changer configuration. Keys are camelCase to match
|
|
188
|
+
* the Node addon getter, so a preset config reads identically across both JS
|
|
189
|
+
* surfaces (the underlying C ABI / Python POD uses the snake_case equivalents).
|
|
190
|
+
*/
|
|
191
|
+
interface RealtimeVoiceChangerPodConfig {
|
|
192
|
+
inputGainDb: number;
|
|
193
|
+
outputGainDb: number;
|
|
194
|
+
wetMix: number;
|
|
195
|
+
retuneSemitones: number;
|
|
196
|
+
retuneMix: number;
|
|
197
|
+
retuneGrainSize: number;
|
|
198
|
+
formantFactor: number;
|
|
199
|
+
formantAmount: number;
|
|
200
|
+
formantBody: number;
|
|
201
|
+
formantBrightness: number;
|
|
202
|
+
formantNasal: number;
|
|
203
|
+
eqHighpassHz: number;
|
|
204
|
+
eqBodyDb: number;
|
|
205
|
+
eqPresenceDb: number;
|
|
206
|
+
eqAirDb: number;
|
|
207
|
+
gateThresholdDb: number;
|
|
208
|
+
gateAttackMs: number;
|
|
209
|
+
gateReleaseMs: number;
|
|
210
|
+
gateRangeDb: number;
|
|
211
|
+
compressorThresholdDb: number;
|
|
212
|
+
compressorRatio: number;
|
|
213
|
+
compressorAttackMs: number;
|
|
214
|
+
compressorReleaseMs: number;
|
|
215
|
+
compressorMakeupGainDb: number;
|
|
216
|
+
deesserFrequencyHz: number;
|
|
217
|
+
deesserThresholdDb: number;
|
|
218
|
+
deesserRatio: number;
|
|
219
|
+
deesserRangeDb: number;
|
|
220
|
+
reverbMix: number;
|
|
221
|
+
reverbTimeMs: number;
|
|
222
|
+
reverbDamping: number;
|
|
223
|
+
reverbSeed: number;
|
|
224
|
+
limiterCeilingDb: number;
|
|
225
|
+
limiterReleaseMs: number;
|
|
226
|
+
/** Non-zero enables the 4x-oversampled inter-sample-peak limiter (default enabled). */
|
|
227
|
+
limiterEnableIspLimiter: boolean;
|
|
228
|
+
/** True-peak ceiling in dBTP applied by the ISP limiter (default -1.0). */
|
|
229
|
+
limiterIspCeilingDbtp: number;
|
|
230
|
+
}
|
|
169
231
|
|
|
170
232
|
type EngineClip = WasmEngineClip;
|
|
171
233
|
type ClipPageRequest = WasmClipPageRequest;
|
|
@@ -175,6 +237,7 @@ type EngineMarker = WasmEngineMarker;
|
|
|
175
237
|
type EngineMetronomeConfig = WasmEngineMetronomeConfig;
|
|
176
238
|
type EngineGraphSpec = WasmEngineGraphSpec;
|
|
177
239
|
type EngineCaptureStatus = WasmEngineCaptureStatus;
|
|
240
|
+
type EngineCaptureSource = EngineCaptureStatus['source'] | number;
|
|
178
241
|
type EngineBounceOptions = WasmEngineBounceOptions;
|
|
179
242
|
type EngineBounceResult = WasmEngineBounceResult;
|
|
180
243
|
type EngineFreezeOptions = WasmEngineFreezeOptions;
|
|
@@ -254,8 +317,8 @@ interface MidiCcBindOptions {
|
|
|
254
317
|
}
|
|
255
318
|
declare class RealtimeEngine {
|
|
256
319
|
private native;
|
|
257
|
-
constructor(sampleRate?: number, maxBlockSize?: number, commandCapacity?: number, telemetryCapacity?: number);
|
|
258
|
-
prepare(sampleRate: number, maxBlockSize: number, commandCapacity?: number, telemetryCapacity?: number): void;
|
|
320
|
+
constructor(sampleRate?: number, maxBlockSize?: number, commandCapacity?: number, telemetryCapacity?: number, maxChannels?: number);
|
|
321
|
+
prepare(sampleRate: number, maxBlockSize: number, commandCapacity?: number, telemetryCapacity?: number, maxChannels?: number): void;
|
|
259
322
|
/** Queue a sample-accurate parameter change (engine kSetParam). */
|
|
260
323
|
setParameter(paramId: number, value: number, renderFrame?: number): void;
|
|
261
324
|
/** Queue a smoothed parameter change (engine kSetParamSmoothed). */
|
|
@@ -301,6 +364,7 @@ declare class RealtimeEngine {
|
|
|
301
364
|
destinationId?: number;
|
|
302
365
|
gain?: number;
|
|
303
366
|
polyphony?: number;
|
|
367
|
+
preferModelForModeledFamilies?: boolean;
|
|
304
368
|
}, destinationId?: number): void;
|
|
305
369
|
clearMidiInstrument(destinationId?: number): void;
|
|
306
370
|
midiInstrumentCount(): number;
|
|
@@ -310,6 +374,8 @@ declare class RealtimeEngine {
|
|
|
310
374
|
* mapped into [minValue, maxValue] for `paramId`.
|
|
311
375
|
*/
|
|
312
376
|
bindMidiCc(channel: number, controller: number, paramId: number, options?: MidiCcBindOptions): void;
|
|
377
|
+
/** Bind a 7/14-bit CC, RPN, or NRPN descriptor to a live parameter. */
|
|
378
|
+
bindMidiCcBinding(binding: ProjectMidiCcBinding): void;
|
|
313
379
|
clearMidiCcBindings(): void;
|
|
314
380
|
midiCcBindingCount(): number;
|
|
315
381
|
/** Install/replace a live non-destructive MIDI-FX insert for one destination. */
|
|
@@ -332,6 +398,7 @@ declare class RealtimeEngine {
|
|
|
332
398
|
setExternalMidiClockEnabled(enabled: boolean): void;
|
|
333
399
|
/** Count of external-MIDI events dropped because the output queue was full. */
|
|
334
400
|
externalMidiDroppedCount(): number;
|
|
401
|
+
externalMidiPendingCount(): number;
|
|
335
402
|
/**
|
|
336
403
|
* Drain queued external-MIDI events, already lowered to MIDI 1.0 byte
|
|
337
404
|
* messages ready to write to a Web MIDI output port. Call once per audio
|
|
@@ -340,6 +407,13 @@ declare class RealtimeEngine {
|
|
|
340
407
|
* queued for the next call (lossless); call again to drain the rest.
|
|
341
408
|
*/
|
|
342
409
|
drainExternalMidi(maxRecords?: number): WasmExternalMidiEvent[];
|
|
410
|
+
/** Scalar, allocation-free external-MIDI drain for AudioWorklet SAB output. */
|
|
411
|
+
popExternalMidiToScratch(): boolean;
|
|
412
|
+
externalMidiScratchDestinationId(): number;
|
|
413
|
+
externalMidiScratchRenderFrame(): number;
|
|
414
|
+
externalMidiScratchByteWord(): number;
|
|
415
|
+
externalMidiScratchByteCount(): number;
|
|
416
|
+
consumeExternalMidiScratch(): void;
|
|
343
417
|
pushMidiInputNoteOn(group: number, channel: number, note: number, velocity: number, portTimeSamples?: number): void;
|
|
344
418
|
pushMidiInputNoteOff(group: number, channel: number, note: number, velocity?: number, portTimeSamples?: number): void;
|
|
345
419
|
pushMidiInputCc(group: number, channel: number, controller: number, value: number, portTimeSamples?: number): void;
|
|
@@ -352,6 +426,8 @@ declare class RealtimeEngine {
|
|
|
352
426
|
* immediate. Mirrors the Node/Python/C-ABI `pushMidiCc`.
|
|
353
427
|
*/
|
|
354
428
|
pushMidiCc(destinationId: number, group: number, channel: number, controller: number, value: number, renderFrame?: number): void;
|
|
429
|
+
/** Queue one immediate MIDI 1.0 channel-voice UMP word for a destination. */
|
|
430
|
+
pushMidiUmp(destinationId: number, word0: number, renderFrame?: number): void;
|
|
355
431
|
/**
|
|
356
432
|
* Queue an immediate (live) MIDI SysEx frame to a MIDI destination. `data` is
|
|
357
433
|
* the full message including the leading 0xF0 and trailing 0xF7 (1..512
|
|
@@ -381,7 +457,10 @@ declare class RealtimeEngine {
|
|
|
381
457
|
* settled values instead of ramping in from defaults.
|
|
382
458
|
*/
|
|
383
459
|
settleParameters(): void;
|
|
460
|
+
/** Drains queued commands on an offline/control-only engine immediately. */
|
|
461
|
+
flushControlCommands(): void;
|
|
384
462
|
seekPpq(ppq: number, renderFrame?: number): void;
|
|
463
|
+
/** Set a finite tempo in the range (0, 100000] BPM. */
|
|
385
464
|
setTempo(bpm: number): void;
|
|
386
465
|
setTempoSegments(segments: readonly EngineTempoSegment[]): void;
|
|
387
466
|
setTimeSignature(numerator: number, denominator: number): void;
|
|
@@ -400,6 +479,7 @@ declare class RealtimeEngine {
|
|
|
400
479
|
marker(id: number): EngineMarker;
|
|
401
480
|
seekMarker(markerId: number, renderFrame?: number): void;
|
|
402
481
|
setLoopFromMarkers(startMarkerId: number, endMarkerId: number): void;
|
|
482
|
+
/** Set a metronome config; click lengths are limited to one second. */
|
|
403
483
|
setMetronome(config: EngineMetronomeConfig): void;
|
|
404
484
|
metronome(): Required<EngineMetronomeConfig>;
|
|
405
485
|
countInEndSample(startSample: number, bars: number): number;
|
|
@@ -471,15 +551,29 @@ declare class RealtimeEngine {
|
|
|
471
551
|
clearClipPage(providerId: number, pageIndex: number): void;
|
|
472
552
|
destroyClipPageProvider(providerId: number): void;
|
|
473
553
|
popClipPageRequest(): ClipPageRequest | null;
|
|
554
|
+
/**
|
|
555
|
+
* Moves one native request into the binding's persistent scalar scratch.
|
|
556
|
+
* This avoids creating an embind JS object in AudioWorklet process().
|
|
557
|
+
*/
|
|
558
|
+
popClipPageRequestToScratch(): boolean;
|
|
559
|
+
clipPageRequestScratchClipId(): number;
|
|
560
|
+
clipPageRequestScratchSample(): number;
|
|
561
|
+
/** Cumulative page misses dropped because the native bounded request queue was full. */
|
|
562
|
+
clipPageRequestOverflowCount(): number;
|
|
474
563
|
setCaptureBuffer(numChannels: number, capacityFrames: number): void;
|
|
475
564
|
armCapture(armed?: boolean): void;
|
|
476
565
|
setCapturePunch(startSample: number, endSample: number, enabled?: boolean): void;
|
|
477
|
-
setCaptureSource(source:
|
|
566
|
+
setCaptureSource(source: EngineCaptureSource): void;
|
|
567
|
+
/** Positive values delay capture relative to the punch window. */
|
|
478
568
|
setRecordOffsetSamples(offsetSamples: number): void;
|
|
479
569
|
setInputMonitor(enabled: boolean, gain?: number): void;
|
|
480
570
|
resetCapture(): void;
|
|
481
571
|
captureStatus(): EngineCaptureStatus;
|
|
482
572
|
capturedAudio(): Float32Array[];
|
|
573
|
+
/**
|
|
574
|
+
* Renders in place, adding engine output to `channels`. Zero each plane first
|
|
575
|
+
* when it contains no upstream input.
|
|
576
|
+
*/
|
|
483
577
|
process(channels: Float32Array[]): Float32Array[];
|
|
484
578
|
/**
|
|
485
579
|
* Allocates persistent per-channel WASM-heap scratch for the zero-copy
|
|
@@ -496,6 +590,7 @@ declare class RealtimeEngine {
|
|
|
496
590
|
getChannelBuffer(channel: number, numFrames: number): Float32Array;
|
|
497
591
|
/**
|
|
498
592
|
* Runs the engine in place over the prepared per-channel scratch buffers.
|
|
593
|
+
* Zero each active span first when it contains no upstream input.
|
|
499
594
|
* Allocation-free: safe to call on the AudioWorklet render thread after
|
|
500
595
|
* `prepareChannels`.
|
|
501
596
|
*/
|
|
@@ -505,6 +600,18 @@ declare class RealtimeEngine {
|
|
|
505
600
|
bounceOffline(options: EngineBounceOptions): EngineBounceResult;
|
|
506
601
|
freezeOffline(options: EngineFreezeOptions): EngineFreezeResult;
|
|
507
602
|
drainTelemetry(maxRecords?: number): EngineTelemetry[];
|
|
603
|
+
popTelemetryToScratch(): boolean;
|
|
604
|
+
telemetryScratchType(): number;
|
|
605
|
+
telemetryScratchError(): number;
|
|
606
|
+
telemetryScratchRenderFrame(): number;
|
|
607
|
+
telemetryScratchTimelineSample(): number;
|
|
608
|
+
telemetryScratchAudibleTimelineSample(): number;
|
|
609
|
+
telemetryScratchGraphLatencySamplesQ8(): number;
|
|
610
|
+
telemetryScratchValue(): number;
|
|
611
|
+
popMeterTelemetryToScratch(): boolean;
|
|
612
|
+
meterScratchTargetId(): number;
|
|
613
|
+
meterScratchRenderFrame(): number;
|
|
614
|
+
meterScratchValue(field: number): number;
|
|
508
615
|
drainMeterTelemetry(maxRecords?: number): EngineMeterTelemetry[];
|
|
509
616
|
/**
|
|
510
617
|
* Drains pending meter telemetry as per-plane (wide) records for a surround
|
|
@@ -524,6 +631,14 @@ declare class RealtimeEngine {
|
|
|
524
631
|
configureScopeTelemetry(intervalFrames: number, bandCount: number): number;
|
|
525
632
|
/** Drains pending spectrum + vectorscope snapshots (per mix target). */
|
|
526
633
|
drainScopeTelemetry(maxRecords?: number): EngineScopeTelemetry[];
|
|
634
|
+
popScopeTelemetryToScratch(): boolean;
|
|
635
|
+
scopeScratchTargetId(): number;
|
|
636
|
+
scopeScratchRenderFrame(): number;
|
|
637
|
+
scopeScratchBandCount(): number;
|
|
638
|
+
scopeScratchBand(index: number): number;
|
|
639
|
+
scopeScratchPointCount(): number;
|
|
640
|
+
scopeScratchPointLeft(index: number): number;
|
|
641
|
+
scopeScratchPointRight(index: number): number;
|
|
527
642
|
destroy(): void;
|
|
528
643
|
}
|
|
529
644
|
declare class ClipPageProvider {
|
|
@@ -536,6 +651,161 @@ declare class ClipPageProvider {
|
|
|
536
651
|
destroy(): void;
|
|
537
652
|
}
|
|
538
653
|
|
|
654
|
+
interface OpfsClipPageProviderOptions {
|
|
655
|
+
path: string;
|
|
656
|
+
numChannels: number;
|
|
657
|
+
numSamples: number;
|
|
658
|
+
pageFrames: number;
|
|
659
|
+
dataOffsetBytes?: number;
|
|
660
|
+
worker?: Worker;
|
|
661
|
+
terminateWorkerOnClose?: boolean;
|
|
662
|
+
/** Internal bridge hook used to mirror a supplied page into an AudioWorklet. */
|
|
663
|
+
onPageSupplied?: (pageIndex: number, channels: Float32Array[]) => void;
|
|
664
|
+
/** Internal bridge hook used to mirror an eviction into an AudioWorklet. */
|
|
665
|
+
onPageCleared?: (pageIndex: number) => void;
|
|
666
|
+
/** Internal bridge hook called after the local provider is destroyed. */
|
|
667
|
+
onClose?: () => void;
|
|
668
|
+
}
|
|
669
|
+
interface OpfsClipPageProviderBinding {
|
|
670
|
+
provider: ClipPageProvider;
|
|
671
|
+
supplyPage(pageIndex: number): Promise<boolean>;
|
|
672
|
+
supplyRequest(request: ClipPageRequest): Promise<boolean>;
|
|
673
|
+
/** Evict one resident page from every configured consumer. */
|
|
674
|
+
clearPage?(pageIndex: number): void;
|
|
675
|
+
close(): void;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Minimal engine surface the streamer drives. {@link RealtimeEngine} satisfies
|
|
680
|
+
* this structurally; tests can supply a lightweight stand-in.
|
|
681
|
+
*/
|
|
682
|
+
interface ClipPageStreamerEngine {
|
|
683
|
+
/** Drain one pending audio-thread page-miss request, or `null` when empty. */
|
|
684
|
+
popClipPageRequest(): ClipPageStreamerRequest | null;
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* A page miss reported by either a direct engine (`sample`) or the worklet
|
|
688
|
+
* bridge (`pageIndex`). Exactly one position form is required.
|
|
689
|
+
*/
|
|
690
|
+
interface ClipPageStreamerRequest {
|
|
691
|
+
clipId: number;
|
|
692
|
+
sample?: number;
|
|
693
|
+
pageIndex?: number;
|
|
694
|
+
}
|
|
695
|
+
/** A paged clip the streamer keeps fed from its backing store. */
|
|
696
|
+
interface ClipPageStreamSource {
|
|
697
|
+
/** Clip schedule id passed to `setClips` (matches {@link ClipPageRequest.clipId}). */
|
|
698
|
+
clipId: number;
|
|
699
|
+
/** OPFS-backed page provider binding for this clip. */
|
|
700
|
+
binding: OpfsClipPageProviderBinding;
|
|
701
|
+
/** Page size in frames (must equal the provider's `pageFrames`). */
|
|
702
|
+
pageFrames: number;
|
|
703
|
+
/** Total sample count of the clip source. */
|
|
704
|
+
numSamples: number;
|
|
705
|
+
}
|
|
706
|
+
interface ClipPageStreamerOptions {
|
|
707
|
+
/**
|
|
708
|
+
* Pages to prefetch ahead of the page a miss was reported for. Larger values
|
|
709
|
+
* hide fetch latency at the cost of more resident memory. Default 2.
|
|
710
|
+
*/
|
|
711
|
+
readAheadPages?: number;
|
|
712
|
+
/**
|
|
713
|
+
* Pages to retain behind the playback frontier before eviction, so a small
|
|
714
|
+
* backward seek does not immediately miss. Default 1.
|
|
715
|
+
*/
|
|
716
|
+
retainBehindPages?: number;
|
|
717
|
+
/**
|
|
718
|
+
* Upper bound on requests drained per {@link ClipPageStreamer.pump} call, so a
|
|
719
|
+
* burst of misses cannot spin unbounded. Default 256.
|
|
720
|
+
*/
|
|
721
|
+
maxRequestsPerPump?: number;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Keeps OPFS-paged clips fed within a bounded sliding window around the live
|
|
725
|
+
* playback position, so a multitrack arrangement never holds its full PCM in
|
|
726
|
+
* WASM memory.
|
|
727
|
+
*
|
|
728
|
+
* The audio thread reports a page miss whenever the {@link ClipPlayer} reads a
|
|
729
|
+
* sample whose page is not resident. {@link pump} drains those requests, fetches
|
|
730
|
+
* the missing page plus a read-ahead window from each clip's backing store, and
|
|
731
|
+
* evicts pages that fall outside the window via the provider's `clear`. The
|
|
732
|
+
* resident set per clip is therefore bounded to
|
|
733
|
+
* `retainBehindPages + readAheadPages + 1` pages regardless of clip length.
|
|
734
|
+
*
|
|
735
|
+
* Call {@link pump} on a cadence that keeps up with playback — typically once
|
|
736
|
+
* per animation frame or per worklet control tick on the main/control thread
|
|
737
|
+
* (never the audio thread; fetches are asynchronous).
|
|
738
|
+
*/
|
|
739
|
+
declare class ClipPageStreamer {
|
|
740
|
+
private readonly engine;
|
|
741
|
+
private readonly readAheadPages;
|
|
742
|
+
private readonly retainBehindPages;
|
|
743
|
+
private readonly maxRequestsPerPump;
|
|
744
|
+
private readonly sources;
|
|
745
|
+
private closed;
|
|
746
|
+
constructor(engine: ClipPageStreamerEngine, options?: ClipPageStreamerOptions);
|
|
747
|
+
/**
|
|
748
|
+
* Register a paged clip. Pages already supplied to the provider before
|
|
749
|
+
* registration (for example a primed first page) should be passed in
|
|
750
|
+
* `initialResidentPages` so they participate in eviction.
|
|
751
|
+
*/
|
|
752
|
+
addSource(source: ClipPageStreamSource, initialResidentPages?: Iterable<number>): void;
|
|
753
|
+
/** Stop tracking a clip. Does not close its binding (the caller owns that). */
|
|
754
|
+
removeSource(clipId: number): void;
|
|
755
|
+
/**
|
|
756
|
+
* Explicitly start a new playback generation after a host seek/loop. Resident
|
|
757
|
+
* pages are evicted and any older in-flight fetch is cleared when it settles.
|
|
758
|
+
* The next miss establishes the new bounded window.
|
|
759
|
+
*/
|
|
760
|
+
resetSource(clipId: number): void;
|
|
761
|
+
/**
|
|
762
|
+
* Drain pending page-miss requests, fetch the missing pages plus their
|
|
763
|
+
* read-ahead window, and evict out-of-window pages. Resolves once this round's
|
|
764
|
+
* fetches settle. Concurrent fetches are serialized inside each binding.
|
|
765
|
+
*/
|
|
766
|
+
pump(): Promise<void>;
|
|
767
|
+
/** Close every registered clip's binding and stop tracking. */
|
|
768
|
+
close(): void;
|
|
769
|
+
private serviceFrontier;
|
|
770
|
+
private resetState;
|
|
771
|
+
private clearPage;
|
|
772
|
+
}
|
|
773
|
+
interface OpfsClipStreamOptions extends OpfsClipPageProviderOptions {
|
|
774
|
+
/** Clip schedule id used in `setClips` (matches the page-miss request clipId). */
|
|
775
|
+
clipId: number;
|
|
776
|
+
/**
|
|
777
|
+
* Leading pages fetched synchronously before returning, so playback can start
|
|
778
|
+
* without an immediate miss. Default 1.
|
|
779
|
+
*/
|
|
780
|
+
primePages?: number;
|
|
781
|
+
}
|
|
782
|
+
interface OpfsClipStream {
|
|
783
|
+
binding: OpfsClipPageProviderBinding;
|
|
784
|
+
/** Pass as `addClip`'s buffer argument to schedule the streaming clip. */
|
|
785
|
+
provider: ClipPageProvider;
|
|
786
|
+
}
|
|
787
|
+
/** Structural seam implemented by the AudioWorklet-backed `SonareEngine`. */
|
|
788
|
+
interface WorkletOpfsClipStreamHost {
|
|
789
|
+
attachOpfsClipStream(options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* One-call wiring of an OPFS-backed streaming clip: creates the page provider,
|
|
793
|
+
* primes the leading pages, and registers it with `streamer` so later misses are
|
|
794
|
+
* serviced within the bounded window. Returns the binding (for `close`) and the
|
|
795
|
+
* provider to schedule via `addClip(trackId, provider, startPpq, { id: clipId })`.
|
|
796
|
+
*
|
|
797
|
+
* @param streamer Shared streamer pumped on the control thread.
|
|
798
|
+
* @param engine Engine the provider is created on (the same one `streamer` drives).
|
|
799
|
+
* @param options Provider options plus `clipId` and optional `primePages`.
|
|
800
|
+
*/
|
|
801
|
+
declare function attachOpfsClipStream(streamer: ClipPageStreamer, engine: RealtimeEngine, options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
|
|
802
|
+
/**
|
|
803
|
+
* Worklet overload: delegates to `SonareEngine.attachOpfsClipStream`, which
|
|
804
|
+
* creates the remote provider and drives this same sliding-window policy from
|
|
805
|
+
* worklet page-miss messages.
|
|
806
|
+
*/
|
|
807
|
+
declare function attachOpfsClipStream(engine: WorkletOpfsClipStreamHost, options: OpfsClipStreamOptions): Promise<OpfsClipStream>;
|
|
808
|
+
|
|
539
809
|
/**
|
|
540
810
|
* sonare - Audio Analysis Library
|
|
541
811
|
*
|
|
@@ -610,6 +880,10 @@ declare function decodeFrame(lo: number, hi: number): number;
|
|
|
610
880
|
declare const SONARE_ENGINE_RING_HEADER_INTS = 5;
|
|
611
881
|
declare const SONARE_ENGINE_COMMAND_RECORD_BYTES = 32;
|
|
612
882
|
declare const SONARE_ENGINE_TELEMETRY_RECORD_BYTES = 48;
|
|
883
|
+
declare const SONARE_CLIP_PAGE_REQUEST_RING_HEADER_INTS = 5;
|
|
884
|
+
declare const SONARE_CLIP_PAGE_REQUEST_RING_RECORD_UINT32S = 2;
|
|
885
|
+
declare const SONARE_EXTERNAL_MIDI_RING_HEADER_INTS = 5;
|
|
886
|
+
declare const SONARE_EXTERNAL_MIDI_RING_RECORD_UINT32S = 4;
|
|
613
887
|
declare enum SonareEngineCommandType {
|
|
614
888
|
SetParam = 0,
|
|
615
889
|
SetParamSmoothed = 1,
|
|
@@ -651,7 +925,10 @@ declare enum SonareEngineTelemetryError {
|
|
|
651
925
|
SmoothedParameterCapacity = 13,
|
|
652
926
|
CommandBacklogDeferred = 14,
|
|
653
927
|
ClipPageUnderrun = 15,
|
|
654
|
-
InsertAutomationOverflow = 16
|
|
928
|
+
InsertAutomationOverflow = 16,
|
|
929
|
+
MidiClockOverflow = 17,
|
|
930
|
+
MetronomeOverflow = 18,
|
|
931
|
+
InvalidCommand = 19
|
|
655
932
|
}
|
|
656
933
|
interface SonareMeterRingBuffer {
|
|
657
934
|
sharedBuffer: SharedArrayBuffer;
|
|
@@ -702,6 +979,27 @@ interface SonareScopeRingReadResult {
|
|
|
702
979
|
nextReadIndex: number;
|
|
703
980
|
scopes: SonareWorkletScopeSnapshot[];
|
|
704
981
|
}
|
|
982
|
+
interface SonareExternalMidiRingEvent {
|
|
983
|
+
destinationId: number;
|
|
984
|
+
renderFrame: number;
|
|
985
|
+
byteWord: number;
|
|
986
|
+
byteCount: number;
|
|
987
|
+
}
|
|
988
|
+
interface SonareExternalMidiRingBuffer {
|
|
989
|
+
sharedBuffer: SharedArrayBuffer;
|
|
990
|
+
header: Int32Array;
|
|
991
|
+
records: Uint32Array;
|
|
992
|
+
capacity: number;
|
|
993
|
+
}
|
|
994
|
+
interface SharedExternalMidiRingWriter {
|
|
995
|
+
header: Int32Array;
|
|
996
|
+
records: Uint32Array;
|
|
997
|
+
capacity: number;
|
|
998
|
+
}
|
|
999
|
+
interface SonareExternalMidiRingReadResult {
|
|
1000
|
+
events: SonareExternalMidiRingEvent[];
|
|
1001
|
+
dropped: number;
|
|
1002
|
+
}
|
|
705
1003
|
interface SonareEngineCommandRecord {
|
|
706
1004
|
type: SonareEngineCommandType | number;
|
|
707
1005
|
targetId?: number;
|
|
@@ -734,6 +1032,26 @@ interface SonareEngineTelemetryRingReadResult {
|
|
|
734
1032
|
nextReadIndex: number;
|
|
735
1033
|
telemetry: SonareEngineTelemetryRecord[];
|
|
736
1034
|
}
|
|
1035
|
+
interface SonareClipPageRequest {
|
|
1036
|
+
clipId: number;
|
|
1037
|
+
pageIndex: number;
|
|
1038
|
+
}
|
|
1039
|
+
interface SonareClipPageRequestRingBuffer {
|
|
1040
|
+
sharedBuffer: SharedArrayBuffer;
|
|
1041
|
+
header: Int32Array;
|
|
1042
|
+
records: Uint32Array;
|
|
1043
|
+
capacity: number;
|
|
1044
|
+
}
|
|
1045
|
+
interface SharedClipPageRequestRingWriter {
|
|
1046
|
+
header: Int32Array;
|
|
1047
|
+
records: Uint32Array;
|
|
1048
|
+
capacity: number;
|
|
1049
|
+
}
|
|
1050
|
+
interface SonareClipPageRequestRingReadResult {
|
|
1051
|
+
requests: SonareClipPageRequest[];
|
|
1052
|
+
/** Cumulative uint32 drop count for native and SAB-ring overflows. */
|
|
1053
|
+
dropped: number;
|
|
1054
|
+
}
|
|
737
1055
|
declare function sonareMeterRingBufferByteLength(capacity: number): number;
|
|
738
1056
|
declare function createSonareMeterRingBuffer(capacity?: number): SonareMeterRingBuffer;
|
|
739
1057
|
declare function readSonareMeterRingBuffer(ring: SonareMeterRingBuffer, readIndex?: number): SonareMeterRingReadResult;
|
|
@@ -745,6 +1063,22 @@ declare function createSonareScopeRingBuffer(capacity?: number, bands?: number,
|
|
|
745
1063
|
declare function readSonareScopeRingBuffer(ring: SonareScopeRingBuffer, readIndex?: number): SonareScopeRingReadResult;
|
|
746
1064
|
declare function sonareEngineCommandRingBufferByteLength(capacity: number): number;
|
|
747
1065
|
declare function sonareEngineTelemetryRingBufferByteLength(capacity: number): number;
|
|
1066
|
+
declare function sonareClipPageRequestRingBufferByteLength(capacity: number): number;
|
|
1067
|
+
declare function sonareExternalMidiRingBufferByteLength(capacity: number): number;
|
|
1068
|
+
declare function createSonareExternalMidiRingBuffer(capacity?: number): SonareExternalMidiRingBuffer;
|
|
1069
|
+
/** Write one lowered MIDI-1 event without allocations from the audio worklet. */
|
|
1070
|
+
declare function pushSonareExternalMidiRingBuffer(ring: SharedExternalMidiRingWriter, destinationId: number, renderFrame: number, byteWord: number, byteCount: number): boolean;
|
|
1071
|
+
/** Main-thread drain. It is intentionally the only place MIDI byte arrays are built. */
|
|
1072
|
+
declare function readSonareExternalMidiRingBuffer(ring: SonareExternalMidiRingBuffer): SonareExternalMidiRingReadResult;
|
|
1073
|
+
declare function createSonareClipPageRequestRingBuffer(capacity?: number): SonareClipPageRequestRingBuffer;
|
|
1074
|
+
/**
|
|
1075
|
+
* Writes one request without allocating. Invalid uint32 coordinates and a full
|
|
1076
|
+
* ring are counted as drops so the main thread can surface a bounded-loss
|
|
1077
|
+
* diagnostic without receiving a worklet postMessage.
|
|
1078
|
+
*/
|
|
1079
|
+
declare function pushSonareClipPageRequestRingBuffer(ring: SharedClipPageRequestRingWriter, clipId: number, pageIndex: number): boolean;
|
|
1080
|
+
/** Drains the SPSC request ring on the main thread. Object creation is here, never in process(). */
|
|
1081
|
+
declare function readSonareClipPageRequestRingBuffer(ring: SonareClipPageRequestRingBuffer): SonareClipPageRequestRingReadResult;
|
|
748
1082
|
declare function createSonareEngineCommandRingBuffer(capacity?: number): SonareEngineCommandRingBuffer;
|
|
749
1083
|
declare function createSonareEngineTelemetryRingBuffer(capacity?: number): SonareEngineTelemetryRingBuffer;
|
|
750
1084
|
declare function pushSonareEngineCommandRingBuffer(ring: SonareEngineCommandRingBuffer, command: SonareEngineCommandRecord): boolean;
|
|
@@ -783,6 +1117,16 @@ interface SonareRealtimeEngineWorkletProcessorOptions {
|
|
|
783
1117
|
scopeBands?: number;
|
|
784
1118
|
scopeSharedBuffer?: SharedArrayBuffer;
|
|
785
1119
|
scopeRingCapacity?: number;
|
|
1120
|
+
/**
|
|
1121
|
+
* Lock-free SPSC queue for clip-page cache misses. Supplying this is required
|
|
1122
|
+
* for realtime-safe OPFS streaming: it avoids both embind object creation and
|
|
1123
|
+
* postMessage structured cloning from AudioWorklet process().
|
|
1124
|
+
*/
|
|
1125
|
+
clipPageRequestSharedBuffer?: SharedArrayBuffer;
|
|
1126
|
+
clipPageRequestRingCapacity?: number;
|
|
1127
|
+
/** Lock-free worklet-to-main-thread MIDI-1 output ring. */
|
|
1128
|
+
externalMidiSharedBuffer?: SharedArrayBuffer;
|
|
1129
|
+
externalMidiRingCapacity?: number;
|
|
786
1130
|
}
|
|
787
1131
|
interface SonareRealtimeVoiceChangerWorkletProcessorOptions {
|
|
788
1132
|
preset?: RealtimeVoiceChangerConfigInput;
|
|
@@ -792,7 +1136,8 @@ interface SonareRealtimeVoiceChangerWorkletProcessorOptions {
|
|
|
792
1136
|
}
|
|
793
1137
|
interface SonareRealtimeVoiceChangerSetConfigMessage {
|
|
794
1138
|
type: 'setConfig';
|
|
795
|
-
|
|
1139
|
+
/** Pre-normalized by the main thread; never JSON parsed in the worklet. */
|
|
1140
|
+
config: RealtimeVoiceChangerPodConfig;
|
|
796
1141
|
}
|
|
797
1142
|
interface SonareRealtimeVoiceChangerResetMessage {
|
|
798
1143
|
type: 'reset';
|
|
@@ -807,6 +1152,10 @@ interface SonareRealtimeEngineNodeCapabilities {
|
|
|
807
1152
|
sharedArrayBuffer: boolean;
|
|
808
1153
|
atomics: boolean;
|
|
809
1154
|
audioWorklet: boolean;
|
|
1155
|
+
/** True only when clip-page misses use the bounded SAB ring. */
|
|
1156
|
+
clipPageRequestsRealtimeSafe: boolean;
|
|
1157
|
+
/** True when external MIDI uses the SAB output ring rather than postMessage. */
|
|
1158
|
+
externalMidiRealtimeSafe: boolean;
|
|
810
1159
|
engineAbiVersion?: number;
|
|
811
1160
|
expectedEngineAbiVersion?: number;
|
|
812
1161
|
abiCompatible?: boolean;
|
|
@@ -863,9 +1212,15 @@ interface SonareWorkletExternalMidiMessage {
|
|
|
863
1212
|
type: 'externalMidi';
|
|
864
1213
|
events: SonareWorkletExternalMidiEvent[];
|
|
865
1214
|
}
|
|
866
|
-
|
|
1215
|
+
/** A control-plane sync message that the worklet rejected without crashing. */
|
|
1216
|
+
interface SonareEngineSyncErrorMessage {
|
|
1217
|
+
type: 'syncError';
|
|
1218
|
+
syncType: SonareEngineSyncMessage['type'];
|
|
1219
|
+
message: string;
|
|
1220
|
+
}
|
|
1221
|
+
type SonareWorkletTransportMessage = SonareWorkletMeterSnapshot | SonareWorkletSpectrumSnapshot | SonareWorkletExternalMidiMessage | SonareEngineClipPageRequestMessage | SonareEngineTelemetryRecord;
|
|
867
1222
|
interface WorkletTransport {
|
|
868
|
-
postMessage?: (message: SonareWorkletTransportMessage | SonareEngineCaptureResponseMessage | SonareEngineTransportResponseMessage, transfer?: Transferable[]) => void;
|
|
1223
|
+
postMessage?: (message: SonareWorkletTransportMessage | SonareEngineCaptureResponseMessage | SonareEngineTransportResponseMessage | SonareEngineSyncErrorMessage, transfer?: Transferable[]) => void;
|
|
869
1224
|
onMeter?: (meter: SonareWorkletMeterSnapshot) => void;
|
|
870
1225
|
onSpectrum?: (spectrum: SonareWorkletSpectrumSnapshot) => void;
|
|
871
1226
|
}
|
|
@@ -882,7 +1237,8 @@ interface SonareEngineSyncClipsDeltaMessage {
|
|
|
882
1237
|
interface SonareEngineSyncClipPageProviderMessage {
|
|
883
1238
|
type: 'syncClipPageProvider';
|
|
884
1239
|
clipId: number;
|
|
885
|
-
clip
|
|
1240
|
+
/** Omitted when an OPFS stream is primed before its clip is scheduled. */
|
|
1241
|
+
clip?: EngineClip;
|
|
886
1242
|
numChannels: number;
|
|
887
1243
|
numSamples: number;
|
|
888
1244
|
pageFrames: number;
|
|
@@ -894,10 +1250,41 @@ interface SonareEngineSyncClipPageMessage {
|
|
|
894
1250
|
pageIndex: number;
|
|
895
1251
|
channels: Float32Array[];
|
|
896
1252
|
}
|
|
1253
|
+
/** Evicts one page after the main-thread sliding window advances. */
|
|
1254
|
+
interface SonareEngineSyncClipPageClearMessage {
|
|
1255
|
+
type: 'syncClipPageClear';
|
|
1256
|
+
clipId: number;
|
|
1257
|
+
pageIndex: number;
|
|
1258
|
+
}
|
|
1259
|
+
/** Releases a provider whose clip was removed or whose stream was closed. */
|
|
1260
|
+
interface SonareEngineSyncClipPageDestroyMessage {
|
|
1261
|
+
type: 'syncClipPageDestroy';
|
|
1262
|
+
clipId: number;
|
|
1263
|
+
}
|
|
897
1264
|
/** Makes a fully supplied paged clip visible to the audio engine. */
|
|
898
1265
|
interface SonareEngineSyncClipPageCommitMessage {
|
|
899
1266
|
type: 'syncClipPageCommit';
|
|
900
1267
|
clipId: number;
|
|
1268
|
+
/**
|
|
1269
|
+
* Clip schedule to publish with a provider that was primed before its
|
|
1270
|
+
* schedule was known. The original pre-baked push path supplies it on the
|
|
1271
|
+
* provider message instead.
|
|
1272
|
+
*/
|
|
1273
|
+
clip?: EngineClip;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* A bounded batch of page misses emitted by the AudioWorklet. The main thread
|
|
1277
|
+
* resolves these from OPFS and responds with `syncClipPage`; a missing page is
|
|
1278
|
+
* silent until that response arrives.
|
|
1279
|
+
*/
|
|
1280
|
+
interface SonareEngineClipPageRequestMessage {
|
|
1281
|
+
type: 'clipPageRequest';
|
|
1282
|
+
requests: Array<{
|
|
1283
|
+
clipId: number;
|
|
1284
|
+
pageIndex: number;
|
|
1285
|
+
}>;
|
|
1286
|
+
/** Number of misses dropped because a bounded native or SAB request queue was full. */
|
|
1287
|
+
dropped?: number;
|
|
901
1288
|
}
|
|
902
1289
|
interface SonareEngineSyncMidiClipsMessage {
|
|
903
1290
|
type: 'syncMidiClips';
|
|
@@ -916,6 +1303,11 @@ interface SonareEngineSyncAutomationMessage {
|
|
|
916
1303
|
paramId: number;
|
|
917
1304
|
points: EngineAutomationPoint[];
|
|
918
1305
|
}
|
|
1306
|
+
/** Replaces the live engine's registered custom-parameter set. */
|
|
1307
|
+
interface SonareEngineSyncParametersMessage {
|
|
1308
|
+
type: 'syncParameters';
|
|
1309
|
+
parameters: EngineParameterInfo[];
|
|
1310
|
+
}
|
|
919
1311
|
interface SonareEngineSyncTempoMessage {
|
|
920
1312
|
type: 'syncTempo';
|
|
921
1313
|
bpm: number;
|
|
@@ -1046,6 +1438,7 @@ interface SonareEngineSyncSf2InstrumentMessage {
|
|
|
1046
1438
|
destinationId?: number;
|
|
1047
1439
|
gain?: number;
|
|
1048
1440
|
polyphony?: number;
|
|
1441
|
+
preferModelForModeledFamilies?: boolean;
|
|
1049
1442
|
};
|
|
1050
1443
|
}
|
|
1051
1444
|
interface SonareEngineSyncLoadSoundFontMessage {
|
|
@@ -1076,6 +1469,12 @@ interface SonareEngineSyncMidiCcMessage {
|
|
|
1076
1469
|
value: number;
|
|
1077
1470
|
renderFrame: number;
|
|
1078
1471
|
}
|
|
1472
|
+
interface SonareEngineSyncMidiUmpMessage {
|
|
1473
|
+
type: 'syncMidiUmp';
|
|
1474
|
+
destinationId: number;
|
|
1475
|
+
word0: number;
|
|
1476
|
+
renderFrame: number;
|
|
1477
|
+
}
|
|
1079
1478
|
interface SonareEngineSyncMidiSysexMessage {
|
|
1080
1479
|
type: 'syncMidiSysex';
|
|
1081
1480
|
destinationId: number;
|
|
@@ -1095,7 +1494,31 @@ interface SonareEngineSyncExternalMidiClockMessage {
|
|
|
1095
1494
|
type: 'syncExternalMidiClock';
|
|
1096
1495
|
enabled: boolean;
|
|
1097
1496
|
}
|
|
1098
|
-
|
|
1497
|
+
interface SonareEngineSyncMidiInputSourceMessage {
|
|
1498
|
+
type: 'syncMidiInputSource' | 'syncClearMidiInputSource';
|
|
1499
|
+
destinationId?: number;
|
|
1500
|
+
}
|
|
1501
|
+
interface SonareEngineSyncMidiCcBindingMessage {
|
|
1502
|
+
type: 'syncMidiCcBinding';
|
|
1503
|
+
channel: number;
|
|
1504
|
+
controller: number;
|
|
1505
|
+
paramId: number;
|
|
1506
|
+
minValue: number;
|
|
1507
|
+
maxValue: number;
|
|
1508
|
+
}
|
|
1509
|
+
interface SonareEngineSyncMidiInputEventMessage {
|
|
1510
|
+
type: 'syncMidiInputNoteOn' | 'syncMidiInputNoteOff' | 'syncMidiInputCc';
|
|
1511
|
+
group: number;
|
|
1512
|
+
channel: number;
|
|
1513
|
+
data0: number;
|
|
1514
|
+
data1: number;
|
|
1515
|
+
portTimeSamples: number;
|
|
1516
|
+
}
|
|
1517
|
+
/** Releases the realtime engine and all worklet-owned clip buffers. */
|
|
1518
|
+
interface SonareEngineDestroyMessage {
|
|
1519
|
+
type: 'destroy';
|
|
1520
|
+
}
|
|
1521
|
+
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;
|
|
1099
1522
|
interface SonareEngineCaptureRequestMessage {
|
|
1100
1523
|
type: 'captureRequest';
|
|
1101
1524
|
requestId: number;
|
|
@@ -1172,6 +1595,12 @@ declare class SonareEngine {
|
|
|
1172
1595
|
private nextMarkerId;
|
|
1173
1596
|
private transportPlaying;
|
|
1174
1597
|
private readonly pendingInstrumentSync;
|
|
1598
|
+
private readonly workletClipPageRequests;
|
|
1599
|
+
private readonly workletPageProviderClipIds;
|
|
1600
|
+
private workletClipStreamer;
|
|
1601
|
+
private workletClipPump;
|
|
1602
|
+
private workletClipPagePollTimer;
|
|
1603
|
+
private unsubscribeWorkletClipRequests;
|
|
1175
1604
|
private destroyed;
|
|
1176
1605
|
private constructor();
|
|
1177
1606
|
static create(context: BaseAudioContext, options?: SonareEngineOptions): Promise<SonareEngine>;
|
|
@@ -1253,6 +1682,10 @@ declare class SonareEngine {
|
|
|
1253
1682
|
*/
|
|
1254
1683
|
automationLaneCount(): number;
|
|
1255
1684
|
listParameters(): EngineParameterInfo[];
|
|
1685
|
+
/** Registers a custom parameter on the offline mirror and worklet engine. */
|
|
1686
|
+
addParameter(info: EngineParameterInfo): void;
|
|
1687
|
+
/** Clears custom parameters and their automation lanes on both engines. */
|
|
1688
|
+
clearParameters(): void;
|
|
1256
1689
|
setSoloMute(target: string | number, solo: boolean, mute: boolean): boolean;
|
|
1257
1690
|
setStripGain(target: string | number, db: number): boolean;
|
|
1258
1691
|
setStripPan(target: string | number, pan: number): boolean;
|
|
@@ -1302,7 +1735,18 @@ declare class SonareEngine {
|
|
|
1302
1735
|
setBusStripInsertParamByName(busId: number, insertIndex: number, paramName: string, value: number): void;
|
|
1303
1736
|
setStripInsertParamByName(target: string | number, insertIndex: number, paramName: string, value: number): void;
|
|
1304
1737
|
setMasterChain(sceneJson: string): void;
|
|
1305
|
-
|
|
1738
|
+
/**
|
|
1739
|
+
* Creates and primes an OPFS-backed page provider for this live worklet
|
|
1740
|
+
* engine. Pass the returned `provider` to {@link addClip} in place of a
|
|
1741
|
+
* `Float32Array[]`; the `clipId` in `options` must equal that clip's explicit
|
|
1742
|
+
* `opts.id`. Subsequent cache misses are fetched on the main thread and
|
|
1743
|
+
* supplied back to the worklet through its bounded pull protocol.
|
|
1744
|
+
*/
|
|
1745
|
+
attachOpfsClipStream(options: OpfsClipStreamOptions): Promise<{
|
|
1746
|
+
binding: OpfsClipPageProviderBinding;
|
|
1747
|
+
provider: ClipPageProvider;
|
|
1748
|
+
}>;
|
|
1749
|
+
addClip(trackId: string | number, buffer: Float32Array[] | ClipPageProvider, startPpq: number, opts?: Partial<Omit<EngineClip, 'channels' | 'pageProvider' | 'startPpq'>>): number;
|
|
1306
1750
|
removeClip(clipId: number): void;
|
|
1307
1751
|
setMidiClips(schedules: readonly EngineMidiClipSchedule[]): void;
|
|
1308
1752
|
setBuiltinInstrument(trackId: string | number, config?: {
|
|
@@ -1314,6 +1758,7 @@ declare class SonareEngine {
|
|
|
1314
1758
|
destinationId?: number;
|
|
1315
1759
|
gain?: number;
|
|
1316
1760
|
polyphony?: number;
|
|
1761
|
+
preferModelForModeledFamilies?: boolean;
|
|
1317
1762
|
}): void;
|
|
1318
1763
|
/**
|
|
1319
1764
|
* Route a track's MIDI to the external output (drained via {@link onMidiOut})
|
|
@@ -1341,9 +1786,20 @@ declare class SonareEngine {
|
|
|
1341
1786
|
pushMidiNoteOn(trackId: string | number, group: number, channel: number, note: number, velocity: number, renderFrame?: number): void;
|
|
1342
1787
|
pushMidiNoteOff(trackId: string | number, group: number, channel: number, note: number, velocity?: number, renderFrame?: number): void;
|
|
1343
1788
|
pushMidiCc(trackId: string | number, group: number, channel: number, controller: number, value: number, renderFrame?: number): void;
|
|
1789
|
+
pushMidiUmp(trackId: string | number, word0: number, renderFrame?: number): void;
|
|
1344
1790
|
pushMidiSysex(trackId: string | number, data: Uint8Array, renderFrame?: number): void;
|
|
1791
|
+
bindMidiCc(channel: number, controller: number, paramId: number, options?: MidiCcBindOptions): void;
|
|
1792
|
+
setMidiInputSource(destinationId?: number): void;
|
|
1793
|
+
clearMidiInputSource(): void;
|
|
1794
|
+
pushMidiInputNoteOn(group: number, channel: number, note: number, velocity: number, portTimeSamples?: number): void;
|
|
1795
|
+
pushMidiInputNoteOff(group: number, channel: number, note: number, velocity?: number, portTimeSamples?: number): void;
|
|
1796
|
+
pushMidiInputCc(group: number, channel: number, controller: number, value: number, portTimeSamples?: number): void;
|
|
1345
1797
|
pushMidiPanic(renderFrame?: number): void;
|
|
1346
1798
|
configureCapture(options: CaptureOptions): void;
|
|
1799
|
+
/**
|
|
1800
|
+
* Arms the engine-global capture path. `trackId` is retained for source
|
|
1801
|
+
* compatibility and must be `0`; per-track capture is not implemented.
|
|
1802
|
+
*/
|
|
1347
1803
|
armRecord(trackId: string | number, enabled: boolean): boolean;
|
|
1348
1804
|
punch(inPpq: number, outPpq: number): boolean;
|
|
1349
1805
|
captureStatus(): Promise<EngineCaptureStatus>;
|
|
@@ -1380,11 +1836,24 @@ declare class SonareEngine {
|
|
|
1380
1836
|
pollMeters(): SonareWorkletMeterSnapshot[];
|
|
1381
1837
|
pollScope(): SonareWorkletScopeSnapshot[];
|
|
1382
1838
|
destroy(): void;
|
|
1839
|
+
private ensureWorkletClipStreamer;
|
|
1840
|
+
/**
|
|
1841
|
+
* SAB requests have no postMessage wake-up by design. Polling on the main
|
|
1842
|
+
* thread is therefore intentionally outside the audio callback; 8 ms keeps
|
|
1843
|
+
* the bounded OPFS prefetch frontier responsive without adding worklet GC.
|
|
1844
|
+
*/
|
|
1845
|
+
private startWorkletClipPagePolling;
|
|
1846
|
+
private pumpWorkletClipPages;
|
|
1847
|
+
private enqueueWorkletClipPageRequest;
|
|
1848
|
+
private popWorkletClipPageRequest;
|
|
1849
|
+
private commitWorkletClipPageProvider;
|
|
1383
1850
|
private mixerLanes;
|
|
1384
1851
|
private syncMixer;
|
|
1385
1852
|
private postInstrumentSync;
|
|
1386
1853
|
private flushPendingInstrumentSync;
|
|
1387
1854
|
private postSync;
|
|
1855
|
+
private flushOfflineMirror;
|
|
1856
|
+
private sendMirroredCommand;
|
|
1388
1857
|
private get mixerContext();
|
|
1389
1858
|
private get stripContext();
|
|
1390
1859
|
private get automationContext();
|
|
@@ -1396,6 +1865,7 @@ declare class SonareEngine {
|
|
|
1396
1865
|
private stripParamId;
|
|
1397
1866
|
private sendSmoothedParam;
|
|
1398
1867
|
private resolveParamId;
|
|
1868
|
+
private syncParameters;
|
|
1399
1869
|
private resolveTargetId;
|
|
1400
1870
|
private ensureTrackLane;
|
|
1401
1871
|
private ensureBus;
|
|
@@ -1408,14 +1878,20 @@ declare class SonareRealtimeEngineNode {
|
|
|
1408
1878
|
readonly telemetryRing?: SonareEngineTelemetryRingBuffer;
|
|
1409
1879
|
readonly meterRing?: SonareMeterRingBuffer;
|
|
1410
1880
|
readonly scopeRing?: SonareScopeRingBuffer;
|
|
1881
|
+
readonly clipPageRequestRing?: SonareClipPageRequestRingBuffer;
|
|
1882
|
+
readonly externalMidiRing?: SonareExternalMidiRingBuffer;
|
|
1411
1883
|
readonly ready: Promise<void>;
|
|
1412
1884
|
private telemetryReadIndex;
|
|
1413
1885
|
private meterReadIndex;
|
|
1414
1886
|
private scopeReadIndex;
|
|
1887
|
+
private clipPageRequestDroppedRead;
|
|
1888
|
+
private ringPollTimer;
|
|
1415
1889
|
private telemetryListeners;
|
|
1416
1890
|
private meterListeners;
|
|
1417
1891
|
private scopeListeners;
|
|
1418
1892
|
private midiOutListeners;
|
|
1893
|
+
private clipPageRequestListeners;
|
|
1894
|
+
private syncErrorListeners;
|
|
1419
1895
|
private captureRequestId;
|
|
1420
1896
|
private readonly captureRequests;
|
|
1421
1897
|
private transportRequestId;
|
|
@@ -1424,6 +1900,8 @@ declare class SonareRealtimeEngineNode {
|
|
|
1424
1900
|
private rejectReady;
|
|
1425
1901
|
private destroyed;
|
|
1426
1902
|
private constructor();
|
|
1903
|
+
/** Subscribes to control-plane sync rejections reported by the worklet. */
|
|
1904
|
+
onSyncError(listener: (message: SonareEngineSyncErrorMessage) => void): () => void;
|
|
1427
1905
|
static create(context: BaseAudioContext, options?: SonareRealtimeEngineNodeOptions): Promise<SonareRealtimeEngineNode>;
|
|
1428
1906
|
play(sampleTime?: number): boolean;
|
|
1429
1907
|
stop(sampleTime?: number): boolean;
|
|
@@ -1437,6 +1915,14 @@ declare class SonareRealtimeEngineNode {
|
|
|
1437
1915
|
pollTelemetry(): SonareEngineTelemetryRecord[];
|
|
1438
1916
|
pollMeters(): SonareWorkletMeterSnapshot[];
|
|
1439
1917
|
pollScope(): SonareWorkletScopeSnapshot[];
|
|
1918
|
+
/** Drain lowered MIDI-1 records from the SAB ring on the main thread. */
|
|
1919
|
+
pollMidiOut(): SonareWorkletExternalMidiEvent[];
|
|
1920
|
+
/**
|
|
1921
|
+
* Drains bounded paged-clip misses from the SAB ring and forwards one batch
|
|
1922
|
+
* to subscribers. In postMessage mode the legacy handler remains available,
|
|
1923
|
+
* but that degraded path is not realtime-safe for OPFS streaming.
|
|
1924
|
+
*/
|
|
1925
|
+
pollClipPageRequests(): SonareEngineClipPageRequestMessage | undefined;
|
|
1440
1926
|
onTelemetry(callback: (telemetry: SonareEngineTelemetryRecord) => void): () => void;
|
|
1441
1927
|
onMeter(callback: (meter: SonareWorkletMeterSnapshot) => void): () => void;
|
|
1442
1928
|
onScope(callback: (scope: SonareWorkletScopeSnapshot) => void): () => void;
|
|
@@ -1446,10 +1932,18 @@ declare class SonareRealtimeEngineNode {
|
|
|
1446
1932
|
* Web MIDI output port. Returns an unsubscribe function.
|
|
1447
1933
|
*/
|
|
1448
1934
|
onMidiOut(callback: (events: SonareWorkletExternalMidiEvent[]) => void): () => void;
|
|
1935
|
+
/**
|
|
1936
|
+
* Subscribe to bounded batches of paged-clip misses from the worklet. The
|
|
1937
|
+
* callback runs on the main thread and may initiate asynchronous OPFS I/O.
|
|
1938
|
+
*/
|
|
1939
|
+
onClipPageRequests(callback: (message: SonareEngineClipPageRequestMessage) => void): () => void;
|
|
1449
1940
|
destroy(): void;
|
|
1450
1941
|
private emitTelemetry;
|
|
1942
|
+
private startRingPolling;
|
|
1943
|
+
private stopRingPollingIfUnused;
|
|
1451
1944
|
private emitMeter;
|
|
1452
1945
|
private emitMidiOut;
|
|
1946
|
+
private emitClipPageRequests;
|
|
1453
1947
|
private emitScope;
|
|
1454
1948
|
private sendCaptureRequest;
|
|
1455
1949
|
private sendTransportRequest;
|
|
@@ -1474,6 +1968,8 @@ declare class SonareRealtimeEngineWorkletProcessor {
|
|
|
1474
1968
|
private telemetryRing?;
|
|
1475
1969
|
private meterRing?;
|
|
1476
1970
|
private scopeRing?;
|
|
1971
|
+
private clipPageRequestRing?;
|
|
1972
|
+
private externalMidiRing?;
|
|
1477
1973
|
private transport?;
|
|
1478
1974
|
private meterIntervalFrames;
|
|
1479
1975
|
private lastMeterFrame;
|
|
@@ -1481,24 +1977,40 @@ declare class SonareRealtimeEngineWorkletProcessor {
|
|
|
1481
1977
|
private channelBuffers;
|
|
1482
1978
|
private readonly liveClips;
|
|
1483
1979
|
private readonly pagedClipProviders;
|
|
1980
|
+
private readonly pagedClipPageFrames;
|
|
1484
1981
|
private readonly pendingPagedClips;
|
|
1982
|
+
private readonly clipPageRequestClipIds;
|
|
1983
|
+
private readonly clipPageRequestPageIndices;
|
|
1984
|
+
private clipPageRequestOverflowReported;
|
|
1485
1985
|
constructor(options?: SonareRealtimeEngineWorkletProcessorOptions, transport?: WorkletTransport);
|
|
1486
1986
|
process(inputs: WorkletInput, outputs: WorkletOutput): boolean;
|
|
1487
1987
|
private reacquireChannelBuffers;
|
|
1488
1988
|
receiveCommand(command: SonareEngineCommandRecord): void;
|
|
1489
1989
|
receiveSync(message: SonareEngineSyncMessage): void;
|
|
1990
|
+
private applySync;
|
|
1490
1991
|
receiveCaptureRequest(message: SonareEngineCaptureRequestMessage): void;
|
|
1491
1992
|
receiveTransportRequest(message: SonareEngineTransportRequestMessage): void;
|
|
1492
1993
|
destroy(): void;
|
|
1493
1994
|
private drainCommands;
|
|
1995
|
+
private safeApplyCommand;
|
|
1494
1996
|
private applyCommand;
|
|
1495
1997
|
private publishTelemetry;
|
|
1998
|
+
private writeTelemetryScratch;
|
|
1496
1999
|
private publishTelemetryRecord;
|
|
1497
2000
|
private publishMeters;
|
|
2001
|
+
private writeMeterScratch;
|
|
1498
2002
|
private writeMeterRing;
|
|
1499
2003
|
private publishScope;
|
|
2004
|
+
private writeScopeScratch;
|
|
1500
2005
|
private publishExternalMidi;
|
|
1501
|
-
|
|
2006
|
+
/**
|
|
2007
|
+
* Forward a bounded batch of native page misses to the main thread. This
|
|
2008
|
+
* deliberately runs after audio rendering: a cache miss is silence for this
|
|
2009
|
+
* block, and OPFS I/O must never delay `process()`.
|
|
2010
|
+
*/
|
|
2011
|
+
private publishClipPageRequests;
|
|
2012
|
+
private removePagedClipProvider;
|
|
2013
|
+
private clearPagedClipProviders;
|
|
1502
2014
|
private commandRingFromSharedBuffer;
|
|
1503
2015
|
private telemetryRingFromSharedBuffer;
|
|
1504
2016
|
}
|
|
@@ -1549,16 +2061,14 @@ declare class SonareRealtimeVoiceChangerWorkletProcessor {
|
|
|
1549
2061
|
private readonly channelCount;
|
|
1550
2062
|
private monoInput;
|
|
1551
2063
|
private monoOutput;
|
|
2064
|
+
private bufferGeneration;
|
|
1552
2065
|
private planarChannels;
|
|
1553
2066
|
private destroyed;
|
|
1554
2067
|
constructor(options?: SonareRealtimeVoiceChangerWorkletProcessorOptions);
|
|
1555
2068
|
/**
|
|
1556
|
-
* Handles a control-plane message from the main thread.
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
* DSP coefficient recomputation here. `setConfig` MUST NOT be deferred
|
|
1560
|
-
* into `process()` because that would block the audio thread for longer
|
|
1561
|
-
* than one render quantum (e.g. 128 samples / 44.1 kHz = ~2.9 ms).
|
|
2069
|
+
* Handles a control-plane message from the main thread. AudioWorklet port
|
|
2070
|
+
* handlers run on the same audio rendering thread as `process()`: this path
|
|
2071
|
+
* therefore accepts only a pre-normalized POD and never parses JSON.
|
|
1562
2072
|
*/
|
|
1563
2073
|
receiveMessage(message: SonareRealtimeVoiceChangerMessage): void;
|
|
1564
2074
|
process(inputs: WorkletInput, outputs: WorkletOutput): boolean;
|
|
@@ -1580,4 +2090,4 @@ declare class SonareRealtimeVoiceChangerWorkletProcessor {
|
|
|
1580
2090
|
}
|
|
1581
2091
|
declare function registerSonareRealtimeVoiceChangerWorkletProcessor(name?: string): void;
|
|
1582
2092
|
|
|
1583
|
-
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 };
|
|
2093
|
+
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 };
|