AudioWorkletNodeOptions - Web APIs 编辑
The AudioWorkletNodeOptions
dictionary of the Web Audio 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 the structured clone algorithm is applied to the options object and the result is passed into AudioWorkletProcessor
's constructor.
Properties
numberOfInputs
Optional- The value to initialize the
numberOfInputs
property to. Defaults to 1. numberOfOutputs
Optional- The value to initialize the
numberOfOutputs
property to. Defaults to 1. outputChannelCount
Optional- 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- An object containing the initial values of custom
AudioParam
objects on this node (in itsparameters
property), withkey
being the name of a custom parameter andvalue
being its initial value. processorOptions
Optional- 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.
If 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.
Examples
// FILL IN EXAMPLE SNIPPET
Specifications
Specification | Status | Comment |
---|---|---|
Web Audio API The definition of 'AudioWorkletNodeOptions' in that specification. | Working Draft | Initial definition. |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论