@libraz/libsonare 1.5.5 → 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 +759 -35
- package/dist/index.js +904 -209
- 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 +574 -86
- package/dist/worklet.js +1634 -235
- 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 +6 -0
- package/src/clip_page_streamer.ts +62 -8
- package/src/codes.ts +51 -64
- package/src/effects_mastering.ts +1 -0
- package/src/errors.ts +1 -0
- package/src/feature_core.ts +140 -2
- package/src/feature_music.ts +17 -2
- package/src/feature_pitch.ts +70 -1
- package/src/feature_spectral.ts +231 -5
- package/src/feature_spectrogram.ts +159 -0
- package/src/features.ts +16 -1
- package/src/index.ts +101 -7
- 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/opfs_clip_pages.ts +26 -1
- package/src/project.ts +7 -0
- package/src/project_class.ts +62 -8
- 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 +22 -0
- package/src/public_types_mixing.ts +11 -2
- package/src/public_types_music.ts +9 -0
- package/src/public_types_spectral.ts +33 -0
- package/src/quick_analysis.ts +25 -7
- package/src/realtime_engine.ts +153 -3
- package/src/realtime_voice_changer.ts +51 -77
- package/src/sonare-analysis.js.d.ts +8 -0
- package/src/sonare.js.d.ts +276 -6
- package/src/streaming_processors.ts +15 -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 +125 -7
- package/src/worklet/protocol.ts +301 -17
- package/src/worklet/voice-changer-processor.ts +12 -15
- package/src/worklet.ts +20 -1
package/src/public_types.ts
CHANGED
|
@@ -4,3 +4,71 @@ export * from './public_types_mixing';
|
|
|
4
4
|
export * from './public_types_music';
|
|
5
5
|
export * from './public_types_realtime';
|
|
6
6
|
export * from './public_types_spectral';
|
|
7
|
+
|
|
8
|
+
/** Runtime capabilities reported by the loaded libsonare build. */
|
|
9
|
+
export interface SonareCapabilities {
|
|
10
|
+
version: string;
|
|
11
|
+
abi: {
|
|
12
|
+
project: number;
|
|
13
|
+
engine: number;
|
|
14
|
+
};
|
|
15
|
+
platform: string;
|
|
16
|
+
features: {
|
|
17
|
+
mastering: boolean;
|
|
18
|
+
mixing: boolean;
|
|
19
|
+
fx: boolean;
|
|
20
|
+
ffmpeg: boolean;
|
|
21
|
+
};
|
|
22
|
+
decode: {
|
|
23
|
+
builtin: string[];
|
|
24
|
+
ffmpeg: string[];
|
|
25
|
+
};
|
|
26
|
+
simd: string;
|
|
27
|
+
hardwareConcurrency: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** One parameter descriptor in the cross-surface capability catalog. */
|
|
31
|
+
export interface CapabilityCatalogParameter {
|
|
32
|
+
name: string;
|
|
33
|
+
id: number;
|
|
34
|
+
rtSafe: boolean;
|
|
35
|
+
type: 'boolean' | 'number';
|
|
36
|
+
min: number | null;
|
|
37
|
+
max: number | null;
|
|
38
|
+
default: boolean | number | null;
|
|
39
|
+
unit: string | null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** One named mastering processor and its host-facing capabilities. */
|
|
43
|
+
export interface CapabilityCatalogProcessor {
|
|
44
|
+
id: string;
|
|
45
|
+
kind: 'realtime' | 'offline' | 'pair';
|
|
46
|
+
realtimeInsertable: boolean;
|
|
47
|
+
stereoOnly: boolean;
|
|
48
|
+
latencySamples: number;
|
|
49
|
+
tailSamples: number;
|
|
50
|
+
/** Coarse realtime work estimate, or null when the processor is not an insert. */
|
|
51
|
+
realtimeCost: 'low' | 'moderate' | 'high' | null;
|
|
52
|
+
channelPolicy: 'multichannel' | 'stereoPairOnly' | 'perChannel' | 'passthrough';
|
|
53
|
+
category: string;
|
|
54
|
+
params: CapabilityCatalogParameter[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Built-in preset names grouped by feature family. */
|
|
58
|
+
export interface CapabilityCatalogPresets {
|
|
59
|
+
mastering: string[];
|
|
60
|
+
synth: string[];
|
|
61
|
+
mixingScene: string[];
|
|
62
|
+
voiceChanger: string[];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Complete runtime catalog exposed by {@link capabilityCatalog}. */
|
|
66
|
+
export interface CapabilityCatalog {
|
|
67
|
+
version: string;
|
|
68
|
+
abi: SonareCapabilities['abi'];
|
|
69
|
+
processors: CapabilityCatalogProcessor[];
|
|
70
|
+
presets: CapabilityCatalogPresets;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Synchronous progress callback for offline operations. Its return value is ignored. */
|
|
74
|
+
export type ProgressCallback = (progress: number, stage: string) => void;
|
|
@@ -394,6 +394,26 @@ export interface StageGainReduction {
|
|
|
394
394
|
gainReductionDb: number;
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
+
/** Existing EBU R128 measurements captured before or after mastering. */
|
|
398
|
+
export interface MasteringLoudnessSummary {
|
|
399
|
+
integratedLufs: number;
|
|
400
|
+
maxMomentaryLufs: number;
|
|
401
|
+
maxShortTermLufs: number;
|
|
402
|
+
truePeakDbtp: number;
|
|
403
|
+
loudnessRange: number;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/** Compact explanation of how an offline mastering chain changed a program. */
|
|
407
|
+
export interface MasteringReport {
|
|
408
|
+
before: MasteringLoudnessSummary;
|
|
409
|
+
after: MasteringLoudnessSummary;
|
|
410
|
+
appliedGainDb: number;
|
|
411
|
+
maxGainReductionDb: number;
|
|
412
|
+
loudnessTargetLimited: boolean;
|
|
413
|
+
/** 32 logarithmically-spaced after-minus-before spectral energy deltas (dB). */
|
|
414
|
+
bandEnergyDeltaDb: Float32Array;
|
|
415
|
+
}
|
|
416
|
+
|
|
397
417
|
export interface MasteringChainResult {
|
|
398
418
|
/** Latency-compensated offline output; no separate latency field is reported. */
|
|
399
419
|
samples: Float32Array;
|
|
@@ -414,6 +434,7 @@ export interface MasteringChainResult {
|
|
|
414
434
|
loudnessTargetLimited: boolean;
|
|
415
435
|
/** Per-stage gain reductions for the dynamics/maximizer stages (a subset of `stages`). */
|
|
416
436
|
stageGainReductions: StageGainReduction[];
|
|
437
|
+
report: MasteringReport;
|
|
417
438
|
}
|
|
418
439
|
|
|
419
440
|
export interface MasteringChainStereoResult {
|
|
@@ -429,6 +450,7 @@ export interface MasteringChainStereoResult {
|
|
|
429
450
|
outputLra: number;
|
|
430
451
|
loudnessTargetLimited: boolean;
|
|
431
452
|
stageGainReductions: StageGainReduction[];
|
|
453
|
+
report: MasteringReport;
|
|
432
454
|
}
|
|
433
455
|
|
|
434
456
|
/**
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
export type PanMode =
|
|
1
|
+
export type PanMode =
|
|
2
|
+
| 'balance'
|
|
3
|
+
| 'pan'
|
|
4
|
+
| 'stereoPan'
|
|
5
|
+
| 'stereo-pan'
|
|
6
|
+
| 'dualPan'
|
|
7
|
+
| 'dual-pan'
|
|
8
|
+
| number;
|
|
2
9
|
|
|
3
10
|
/**
|
|
4
11
|
* Surround pan position for a strip feeding a >2-channel bus. Phase 1 honors
|
|
@@ -77,7 +84,9 @@ export type AutomationCurve = 'linear' | 'exponential' | 'hold' | 's-curve';
|
|
|
77
84
|
|
|
78
85
|
/**
|
|
79
86
|
* Pan law applied when computing left/right gains from a pan position
|
|
80
|
-
* (see {@link Mixer.setPanLaw}).
|
|
87
|
+
* (see {@link Mixer.setPanLaw}). On mono strips it changes the centre gain;
|
|
88
|
+
* on stereo Balance strips it changes only the far-channel taper, while centre
|
|
89
|
+
* remains unity. Maps to the underlying integer code.
|
|
81
90
|
*/
|
|
82
91
|
export type PanLaw = 'const3dB' | 'const4.5dB' | 'const6dB' | 'linear0dB';
|
|
83
92
|
|
|
@@ -315,6 +315,13 @@ export interface TimeSignature {
|
|
|
315
315
|
confidence: number;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
/** Existing tempo-estimator hypothesis retained by unified analysis. */
|
|
319
|
+
export interface BpmHypothesis {
|
|
320
|
+
value: number;
|
|
321
|
+
confidence: number;
|
|
322
|
+
relation: 'primary' | 'half' | 'double' | 'other';
|
|
323
|
+
}
|
|
324
|
+
|
|
318
325
|
/**
|
|
319
326
|
* Rhythm features
|
|
320
327
|
*/
|
|
@@ -343,8 +350,10 @@ export interface MelodyContour {
|
|
|
343
350
|
export interface AnalysisResult {
|
|
344
351
|
bpm: number;
|
|
345
352
|
bpmConfidence: number;
|
|
353
|
+
bpmCandidates: BpmHypothesis[];
|
|
346
354
|
key: Key;
|
|
347
355
|
timeSignature: TimeSignature;
|
|
356
|
+
timeSignatureCandidates: TimeSignature[];
|
|
348
357
|
beatTimes: Float32Array;
|
|
349
358
|
beats: Beat[];
|
|
350
359
|
chords: Chord[];
|
|
@@ -182,6 +182,39 @@ export interface PitchResult {
|
|
|
182
182
|
meanF0: number;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
/** Per-bin pitch candidates and peak magnitudes from spectral piptrack. */
|
|
186
|
+
export interface PiptrackResult {
|
|
187
|
+
nBins: number;
|
|
188
|
+
nFrames: number;
|
|
189
|
+
pitches: Float32Array;
|
|
190
|
+
magnitudes: Float32Array;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Magnitude and reassigned time/frequency coordinates for every STFT bin. */
|
|
194
|
+
export interface ReassignedSpectrogramResult {
|
|
195
|
+
nBins: number;
|
|
196
|
+
nFrames: number;
|
|
197
|
+
magnitude: Float32Array;
|
|
198
|
+
times: Float32Array;
|
|
199
|
+
frequencies: Float32Array;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** Row-major matrix returned by librosa.segment-compatible APIs. */
|
|
203
|
+
export interface SegmentMatrix {
|
|
204
|
+
rows: number;
|
|
205
|
+
cols: number;
|
|
206
|
+
values: Float32Array;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** One stable monophonic note region segmented from an F0 track. */
|
|
210
|
+
export interface NoteSegment {
|
|
211
|
+
frameStart: number;
|
|
212
|
+
frameEnd: number;
|
|
213
|
+
startSeconds: number;
|
|
214
|
+
endSeconds: number;
|
|
215
|
+
medianCents: number;
|
|
216
|
+
}
|
|
217
|
+
|
|
185
218
|
/**
|
|
186
219
|
* Loudness measurement result (EBU R128 / ITU-R BS.1770)
|
|
187
220
|
*/
|
package/src/quick_analysis.ts
CHANGED
|
@@ -43,12 +43,29 @@ export interface SamplesRequest extends GuardedOptions {
|
|
|
43
43
|
sampleRate?: number;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/** Peak-picking configuration for {@link detectOnsets}. */
|
|
47
|
+
export interface OnsetDetectOptions {
|
|
48
|
+
nFft?: number;
|
|
49
|
+
hopLength?: number;
|
|
50
|
+
threshold?: number;
|
|
51
|
+
preMax?: number;
|
|
52
|
+
postMax?: number;
|
|
53
|
+
preAvg?: number;
|
|
54
|
+
postAvg?: number;
|
|
55
|
+
delta?: number;
|
|
56
|
+
wait?: number;
|
|
57
|
+
backtrack?: boolean;
|
|
58
|
+
backtrackRange?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface DetectOnsetsRequest extends SamplesRequest, OnsetDetectOptions {}
|
|
61
|
+
|
|
46
62
|
/** Canonical request form for key detection functions. */
|
|
47
63
|
export interface DetectKeyRequest extends KeyDetectionOptions, SamplesRequest {}
|
|
48
64
|
|
|
49
65
|
/** Canonical request form for analysis with synchronous progress reporting. */
|
|
50
66
|
export interface AnalyzeWithProgressRequest extends SamplesRequest {
|
|
51
|
-
onProgress
|
|
67
|
+
onProgress?: ProgressCallback;
|
|
68
|
+
cancel?: () => boolean;
|
|
52
69
|
}
|
|
53
70
|
|
|
54
71
|
/** Canonical request form for chord detection. */
|
|
@@ -207,20 +224,20 @@ export function detectKeyCandidates(
|
|
|
207
224
|
* @param sampleRate - Sample rate in Hz (default: 22050)
|
|
208
225
|
* @returns Array of onset times in seconds
|
|
209
226
|
*/
|
|
210
|
-
export function detectOnsets(request:
|
|
227
|
+
export function detectOnsets(request: DetectOnsetsRequest): Float32Array;
|
|
211
228
|
export function detectOnsets(
|
|
212
229
|
samples: Float32Array,
|
|
213
230
|
sampleRate?: number,
|
|
214
|
-
options?: GuardedOptions,
|
|
231
|
+
options?: OnsetDetectOptions & GuardedOptions,
|
|
215
232
|
): Float32Array;
|
|
216
233
|
export function detectOnsets(
|
|
217
|
-
samples: Float32Array |
|
|
234
|
+
samples: Float32Array | DetectOnsetsRequest,
|
|
218
235
|
sampleRate = 22050,
|
|
219
|
-
options: GuardedOptions = {},
|
|
236
|
+
options: OnsetDetectOptions & GuardedOptions = {},
|
|
220
237
|
): Float32Array {
|
|
221
238
|
const request = samples instanceof Float32Array ? { samples, sampleRate, ...options } : samples;
|
|
222
239
|
validateAnalysisInput('detectOnsets', request.samples, request.sampleRate ?? 22050, request);
|
|
223
|
-
return requireModule().detectOnsets(request.samples, request.sampleRate ?? 22050);
|
|
240
|
+
return requireModule().detectOnsets(request.samples, request.sampleRate ?? 22050, request);
|
|
224
241
|
}
|
|
225
242
|
|
|
226
243
|
/**
|
|
@@ -559,7 +576,8 @@ export function analyzeWithProgress(
|
|
|
559
576
|
const result = requireModule().analyzeWithProgress(
|
|
560
577
|
request.samples,
|
|
561
578
|
request.sampleRate ?? 22050,
|
|
562
|
-
request.onProgress,
|
|
579
|
+
request.onProgress ?? (() => {}),
|
|
580
|
+
request.cancel ?? (() => false),
|
|
563
581
|
);
|
|
564
582
|
return convertAnalysisResult(result);
|
|
565
583
|
}
|
package/src/realtime_engine.ts
CHANGED
|
@@ -38,6 +38,7 @@ export type EngineMarker = WasmEngineMarker;
|
|
|
38
38
|
export type EngineMetronomeConfig = WasmEngineMetronomeConfig;
|
|
39
39
|
export type EngineGraphSpec = WasmEngineGraphSpec;
|
|
40
40
|
export type EngineCaptureStatus = WasmEngineCaptureStatus;
|
|
41
|
+
export type EngineCaptureSource = EngineCaptureStatus['source'] | number;
|
|
41
42
|
export type EngineBounceOptions = WasmEngineBounceOptions;
|
|
42
43
|
export type EngineBounceResult = WasmEngineBounceResult;
|
|
43
44
|
export type EngineFreezeOptions = WasmEngineFreezeOptions;
|
|
@@ -161,6 +162,7 @@ export class RealtimeEngine {
|
|
|
161
162
|
maxBlockSize = 128,
|
|
162
163
|
commandCapacity = 1024,
|
|
163
164
|
telemetryCapacity = 1024,
|
|
165
|
+
maxChannels = 64,
|
|
164
166
|
) {
|
|
165
167
|
const module = getSonareModule();
|
|
166
168
|
const capabilities = engineCapabilities();
|
|
@@ -174,6 +176,7 @@ export class RealtimeEngine {
|
|
|
174
176
|
maxBlockSize,
|
|
175
177
|
commandCapacity,
|
|
176
178
|
telemetryCapacity,
|
|
179
|
+
maxChannels,
|
|
177
180
|
);
|
|
178
181
|
}
|
|
179
182
|
|
|
@@ -182,8 +185,15 @@ export class RealtimeEngine {
|
|
|
182
185
|
maxBlockSize: number,
|
|
183
186
|
commandCapacity = 1024,
|
|
184
187
|
telemetryCapacity = 1024,
|
|
188
|
+
maxChannels = 64,
|
|
185
189
|
): void {
|
|
186
|
-
this.native.
|
|
190
|
+
this.native.prepareWithChannels(
|
|
191
|
+
sampleRate,
|
|
192
|
+
maxBlockSize,
|
|
193
|
+
commandCapacity,
|
|
194
|
+
telemetryCapacity,
|
|
195
|
+
maxChannels,
|
|
196
|
+
);
|
|
187
197
|
}
|
|
188
198
|
|
|
189
199
|
/** Queue a sample-accurate parameter change (engine kSetParam). */
|
|
@@ -256,7 +266,12 @@ export class RealtimeEngine {
|
|
|
256
266
|
* synthesizer GM fallback bank (the data-free floor).
|
|
257
267
|
*/
|
|
258
268
|
setSf2Instrument(
|
|
259
|
-
config: {
|
|
269
|
+
config: {
|
|
270
|
+
destinationId?: number;
|
|
271
|
+
gain?: number;
|
|
272
|
+
polyphony?: number;
|
|
273
|
+
preferModelForModeledFamilies?: boolean;
|
|
274
|
+
} = {},
|
|
260
275
|
destinationId = config.destinationId ?? 0,
|
|
261
276
|
): void {
|
|
262
277
|
this.native.setSf2Instrument(destinationId, config);
|
|
@@ -347,6 +362,10 @@ export class RealtimeEngine {
|
|
|
347
362
|
return this.native.externalMidiDroppedCount();
|
|
348
363
|
}
|
|
349
364
|
|
|
365
|
+
externalMidiPendingCount(): number {
|
|
366
|
+
return this.native.externalMidiPendingCount();
|
|
367
|
+
}
|
|
368
|
+
|
|
350
369
|
/**
|
|
351
370
|
* Drain queued external-MIDI events, already lowered to MIDI 1.0 byte
|
|
352
371
|
* messages ready to write to a Web MIDI output port. Call once per audio
|
|
@@ -358,6 +377,31 @@ export class RealtimeEngine {
|
|
|
358
377
|
return this.native.drainExternalMidi(maxRecords);
|
|
359
378
|
}
|
|
360
379
|
|
|
380
|
+
/** Scalar, allocation-free external-MIDI drain for AudioWorklet SAB output. */
|
|
381
|
+
popExternalMidiToScratch(): boolean {
|
|
382
|
+
return this.native.popExternalMidiToScratch();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
externalMidiScratchDestinationId(): number {
|
|
386
|
+
return this.native.externalMidiScratchDestinationId();
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
externalMidiScratchRenderFrame(): number {
|
|
390
|
+
return this.native.externalMidiScratchRenderFrame();
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
externalMidiScratchByteWord(): number {
|
|
394
|
+
return this.native.externalMidiScratchByteWord();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
externalMidiScratchByteCount(): number {
|
|
398
|
+
return this.native.externalMidiScratchByteCount();
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
consumeExternalMidiScratch(): void {
|
|
402
|
+
this.native.consumeExternalMidiScratch();
|
|
403
|
+
}
|
|
404
|
+
|
|
361
405
|
pushMidiInputNoteOn(
|
|
362
406
|
group: number,
|
|
363
407
|
channel: number,
|
|
@@ -427,6 +471,11 @@ export class RealtimeEngine {
|
|
|
427
471
|
this.native.pushMidiCc(destinationId, group, channel, controller, value, renderFrame);
|
|
428
472
|
}
|
|
429
473
|
|
|
474
|
+
/** Queue one immediate MIDI 1.0 channel-voice UMP word for a destination. */
|
|
475
|
+
pushMidiUmp(destinationId: number, word0: number, renderFrame = -1): void {
|
|
476
|
+
this.native.pushMidiUmp(destinationId, word0, renderFrame);
|
|
477
|
+
}
|
|
478
|
+
|
|
430
479
|
/**
|
|
431
480
|
* Queue an immediate (live) MIDI SysEx frame to a MIDI destination. `data` is
|
|
432
481
|
* the full message including the leading 0xF0 and trailing 0xF7 (1..512
|
|
@@ -480,6 +529,11 @@ export class RealtimeEngine {
|
|
|
480
529
|
this.native.settleParameters();
|
|
481
530
|
}
|
|
482
531
|
|
|
532
|
+
/** Drains queued commands on an offline/control-only engine immediately. */
|
|
533
|
+
flushControlCommands(): void {
|
|
534
|
+
this.native.flushControlCommands();
|
|
535
|
+
}
|
|
536
|
+
|
|
483
537
|
seekPpq(ppq: number, renderFrame = -1): void {
|
|
484
538
|
this.native.seekPpq(ppq, renderFrame);
|
|
485
539
|
}
|
|
@@ -824,6 +878,27 @@ export class RealtimeEngine {
|
|
|
824
878
|
return this.native.popClipPageRequest();
|
|
825
879
|
}
|
|
826
880
|
|
|
881
|
+
/**
|
|
882
|
+
* Moves one native request into the binding's persistent scalar scratch.
|
|
883
|
+
* This avoids creating an embind JS object in AudioWorklet process().
|
|
884
|
+
*/
|
|
885
|
+
popClipPageRequestToScratch(): boolean {
|
|
886
|
+
return this.native.popClipPageRequestToScratch();
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
clipPageRequestScratchClipId(): number {
|
|
890
|
+
return this.native.clipPageRequestScratchClipId();
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
clipPageRequestScratchSample(): number {
|
|
894
|
+
return this.native.clipPageRequestScratchSample();
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/** Cumulative page misses dropped because the native bounded request queue was full. */
|
|
898
|
+
clipPageRequestOverflowCount(): number {
|
|
899
|
+
return this.native.clipPageRequestOverflowCount();
|
|
900
|
+
}
|
|
901
|
+
|
|
827
902
|
setCaptureBuffer(numChannels: number, capacityFrames: number): void {
|
|
828
903
|
this.native.setCaptureBuffer(numChannels, capacityFrames);
|
|
829
904
|
}
|
|
@@ -836,7 +911,7 @@ export class RealtimeEngine {
|
|
|
836
911
|
this.native.setCapturePunch(startSample, endSample, enabled);
|
|
837
912
|
}
|
|
838
913
|
|
|
839
|
-
setCaptureSource(source:
|
|
914
|
+
setCaptureSource(source: EngineCaptureSource): void {
|
|
840
915
|
this.native.setCaptureSource(source);
|
|
841
916
|
}
|
|
842
917
|
|
|
@@ -861,6 +936,10 @@ export class RealtimeEngine {
|
|
|
861
936
|
return this.native.capturedAudio();
|
|
862
937
|
}
|
|
863
938
|
|
|
939
|
+
/**
|
|
940
|
+
* Renders in place, adding engine output to `channels`. Zero each plane first
|
|
941
|
+
* when it contains no upstream input.
|
|
942
|
+
*/
|
|
864
943
|
process(channels: Float32Array[]): Float32Array[] {
|
|
865
944
|
return this.native.process(channels);
|
|
866
945
|
}
|
|
@@ -886,6 +965,7 @@ export class RealtimeEngine {
|
|
|
886
965
|
|
|
887
966
|
/**
|
|
888
967
|
* Runs the engine in place over the prepared per-channel scratch buffers.
|
|
968
|
+
* Zero each active span first when it contains no upstream input.
|
|
889
969
|
* Allocation-free: safe to call on the AudioWorklet render thread after
|
|
890
970
|
* `prepareChannels`.
|
|
891
971
|
*/
|
|
@@ -913,6 +993,51 @@ export class RealtimeEngine {
|
|
|
913
993
|
return this.native.drainTelemetry(maxRecords);
|
|
914
994
|
}
|
|
915
995
|
|
|
996
|
+
popTelemetryToScratch(): boolean {
|
|
997
|
+
return this.native.popTelemetryToScratch();
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
telemetryScratchType(): number {
|
|
1001
|
+
return this.native.telemetryScratchType();
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
telemetryScratchError(): number {
|
|
1005
|
+
return this.native.telemetryScratchError();
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
telemetryScratchRenderFrame(): number {
|
|
1009
|
+
return Number(this.native.telemetryScratchRenderFrame());
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
telemetryScratchTimelineSample(): number {
|
|
1013
|
+
return Number(this.native.telemetryScratchTimelineSample());
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
telemetryScratchAudibleTimelineSample(): number {
|
|
1017
|
+
return Number(this.native.telemetryScratchAudibleTimelineSample());
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
telemetryScratchGraphLatencySamplesQ8(): number {
|
|
1021
|
+
return this.native.telemetryScratchGraphLatencySamplesQ8();
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
telemetryScratchValue(): number {
|
|
1025
|
+
return this.native.telemetryScratchValue();
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
popMeterTelemetryToScratch(): boolean {
|
|
1029
|
+
return this.native.popMeterTelemetryToScratch();
|
|
1030
|
+
}
|
|
1031
|
+
meterScratchTargetId(): number {
|
|
1032
|
+
return this.native.meterScratchTargetId();
|
|
1033
|
+
}
|
|
1034
|
+
meterScratchRenderFrame(): number {
|
|
1035
|
+
return Number(this.native.meterScratchRenderFrame());
|
|
1036
|
+
}
|
|
1037
|
+
meterScratchValue(field: number): number {
|
|
1038
|
+
return this.native.meterScratchValue(field);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
916
1041
|
drainMeterTelemetry(maxRecords = 1024): EngineMeterTelemetry[] {
|
|
917
1042
|
return this.native.drainMeterTelemetry(maxRecords);
|
|
918
1043
|
}
|
|
@@ -944,6 +1069,31 @@ export class RealtimeEngine {
|
|
|
944
1069
|
return this.native.drainScopeTelemetry(maxRecords);
|
|
945
1070
|
}
|
|
946
1071
|
|
|
1072
|
+
popScopeTelemetryToScratch(): boolean {
|
|
1073
|
+
return this.native.popScopeTelemetryToScratch();
|
|
1074
|
+
}
|
|
1075
|
+
scopeScratchTargetId(): number {
|
|
1076
|
+
return this.native.scopeScratchTargetId();
|
|
1077
|
+
}
|
|
1078
|
+
scopeScratchRenderFrame(): number {
|
|
1079
|
+
return Number(this.native.scopeScratchRenderFrame());
|
|
1080
|
+
}
|
|
1081
|
+
scopeScratchBandCount(): number {
|
|
1082
|
+
return this.native.scopeScratchBandCount();
|
|
1083
|
+
}
|
|
1084
|
+
scopeScratchBand(index: number): number {
|
|
1085
|
+
return this.native.scopeScratchBand(index);
|
|
1086
|
+
}
|
|
1087
|
+
scopeScratchPointCount(): number {
|
|
1088
|
+
return this.native.scopeScratchPointCount();
|
|
1089
|
+
}
|
|
1090
|
+
scopeScratchPointLeft(index: number): number {
|
|
1091
|
+
return this.native.scopeScratchPointLeft(index);
|
|
1092
|
+
}
|
|
1093
|
+
scopeScratchPointRight(index: number): number {
|
|
1094
|
+
return this.native.scopeScratchPointRight(index);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
947
1097
|
destroy(): void {
|
|
948
1098
|
this.native.delete();
|
|
949
1099
|
}
|