AudioWorkletNodeOptions

AudioWorkletNodeOptions dictionary of the Web 音频 API is used to specify configuration options when constructing a new AudioWorkletNode object for custom audio processing. It is only used when calling the AudioWorkletNode() constructor. During internal instantiation of the underlying AudioWorkletProcessor the structured clone algorithm is applied to the options object and the result is passed into AudioWorkletProcessor 的构造函数。

特性

numberOfInputs 可选
The value to initialize the numberOfInputs property to. Defaults to 1.
numberOfOutputs 可选
The value to initialize the numberOfOutputs property to. Defaults to 1.
outputChannelCount 可选
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 可选
An object containing the initial values of custom AudioParam objects on this node (in its parameters property), with key being the name of a custom parameter and value being its initial value.
processorOptions 可选
Any additional data that can be used for custom initialization of the underlying AudioWorkletProcessor .

Usage notes

When creating an AudioWorkletNode , these options can have various effects. If the number of inputs and number of outputs are both set to 0, a NotSupportedError will be thrown and the node construction process aborted. If the length of the outputChannelCount array doesn't match numberOfOutputs , an IndexSizeError will be thrown.

outputChannelCount isn't specified, and numberOfInputs and numberOfOutputs are both 1, the AudioWorkletNode 's initial channel count is set to 1. This has the effect of changing the output channel count to dynamically change to the computed number of channels, based on the input's channel count and the current setting of the AudioNode property channelCountMode .

Otherwise, if outputChannelCount is provided and if the values of numberOfInputs and numberOfOutputs are both 1, the audio worklet node's channel count is set to the value of outputChannelCount . Otherwise, the channel count of each channel in the set of output channels is set to match the corresponding value in the outputChannelCount array.

范例

// FILL IN EXAMPLE SNIPPET

规范

规范 状态 Comment
Web 音频 API
The definition of 'AudioWorkletNodeOptions' in that specification.
工作草案 初始定义。

浏览器兼容性

No compatibility data found. Please contribute data for "api.AudioWorkletNodeOptions" (depth: 1) to the MDN 兼容性数据存储库 .