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 its parameters property), with key being the name of a custom parameter and value 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

SpecificationStatusComment
Web Audio API
The definition of 'AudioWorkletNodeOptions' in that specification.
Working DraftInitial definition.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:115 次

字数:4610

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文