TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

[audioworklet] AudioWorkletProcessor is missing options for constructor

Open aleclarson opened this issue 3 years ago • 2 comments

https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletProcessor/AudioWorkletProcessor

interface AudioWorkletNodeOptions {
  /** @default 1 */
  numberOfInputs?: number
  /** @default 1 */
  numberOfOutputs?: number
  outputChannelCount?: number[]
  parameterData?: any
  processorOptions?: any
}

Parameters

  • options

    • : An object that is passed as options parameter to the {{domxref("AudioWorkletNode.AudioWorkletNode", "AudioWorkletNode constructor")}} and passed through the structured clone algorithm. Available properties are as follows:

      • numberOfInputs {{optional_inline}}
        • : The value to initialize the {{domxref("AudioNode.numberOfInputs", "numberOfInputs")}} property to. Defaults to 1.
      • numberOfOutputs {{optional_inline}}
        • : The value to initialize the {{domxref("AudioNode.numberOfOutputs", "numberOfOutputs")}} property to. Defaults to 1.
      • outputChannelCount {{optional_inline}}
        • : An array defining the number of channels for each output. For example, outputChannelCount: [n, m] specifies the number of channels in the first output to be n and the second output to be m. The array length must match numberOfOutputs.
      • parameterData {{optional_inline}}
        • : An object containing the initial values of custom {{domxref("AudioParam")}} objects on this node (in its {{domxref("AudioWorkletNode.parameters", "parameters")}} property), with key being the name of a custom parameter and value being its initial value.
      • processorOptions {{optional_inline}}
        • : Any additional data that can be used for custom initialization of the underlying {{domxref("AudioWorkletProcessor")}}.

      Note that there are default values for the first two properties, so even if there are no options object passed to the {{domxref("AudioWorkletNode.AudioWorkletNode", "AudioWorkletNode constructor")}}, the options object passed by the node to the AudioWorkletProcessor constructor will exist and at minimum have numberOfInputs and numberOfOutputs.

aleclarson avatar Dec 23 '22 21:12 aleclarson

Oh I see now that the type is provided by the lib.dom.d.ts

aleclarson avatar Dec 23 '22 21:12 aleclarson

Well, the constructor for AudioWorkletProcessor still needs to be fixed :)

aleclarson avatar Dec 23 '22 21:12 aleclarson