Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839/** * The audio thread's globals, declared. * * The DOM lib models the *main-thread* side of an audio worklet — `AudioWorklet`, `AudioWorkletNode`, * the port, the options bag — and stops there, which is right: `AudioWorkletGlobalScope` is not a * scope `window` has, so a declaration that put these on it would let a component call * `registerProcessor` and fail at runtime. It also means the file that legitimately does call it has * to say for itself what it is standing in. * * Three names, and no more than the processor file uses. The types are the ones the spec gives them, * so a mistake here is a mistake the browser will also make — which is the only kind of ambient * declaration worth writing. */
interface AudioParamDescriptor { name: string; defaultValue?: number; minValue?: number; maxValue?: number; automationRate?: "a-rate" | "k-rate";}
declare abstract class AudioWorkletProcessor { /** the other end of the `AudioWorkletNode`'s port, on this thread */ protected readonly port: MessagePort; /** the render quantum: 128 frames, in every browser that implements this */ static readonly sampleRate: number; abstract process( inputs: Float32Array[][], outputs: Float32Array[][], parameters: Record<string, Float32Array>, ): boolean;}
declare function registerProcessor( name: string, processorCtor: new (options?: AudioWorkletNodeOptions) => AudioWorkletProcessor,): void;