Skip to content

Commit 2acb81c

Browse files
authored
Merge pull request #1386 from hoch/1325-output-channel-count
AudioWorkletNodeOptions.outputChannelCount
2 parents 11db217 + 9215fc9 commit 2acb81c

File tree

1 file changed

+72
-5
lines changed

1 file changed

+72
-5
lines changed

index.html

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9747,6 +9747,7 @@ <h2 id="AudioWorkletNodeOptions">
97479747
dictionary AudioWorkletNodeOptions : AudioNodeOptions {
97489748
unsigned long numberOfInputs = 1;
97499749
unsigned long numberOfOutputs = 1;
9750+
sequence&lt;unsigned long&gt; outputChannelCount;
97509751
record&lt;DOMString, double&gt; parameterData;
97519752
};
97529753
</pre>
@@ -9774,6 +9775,24 @@ <h3>
97749775
This is used to initialize the value of <a>AudioNode</a>
97759776
<a data-link-for="AudioNode">numberOfOutputs</a> attribute.
97769777
</dd>
9778+
<dt>
9779+
<code><dfn>outputChannelCount</dfn></code> of type
9780+
<span class="idlAttrType"><code>sequence&lt;unsigned
9781+
long&gt;</code></span>
9782+
</dt>
9783+
<dd>
9784+
This array is used to configure the number of channels in
9785+
each output. For example, <code>outputChannelCount: [n,
9786+
m]</code> specifies the number of channels in the first
9787+
output to <code>n</code> and the second output to
9788+
<code>m</code> respectively. <code>IndexSizeError</code> MUST
9789+
be thrown if the length of sequence does not match
9790+
<a data-link-for=
9791+
"AudioWorkletNodeOptions">numberOfOutputs</a>. A
9792+
<code>NotSupportedError</code> exception MUST be thrown if a
9793+
channel count is not in the valid range of AudioNode's
9794+
<a data-link-for="AudioNode">channelCount</a>.
9795+
</dd>
97779796
<dt>
97789797
<code><dfn>parameterData</dfn></code> of type <span class=
97799798
"idlAttrType"><code>record&lt;DOMString,
@@ -9788,6 +9807,52 @@ <h3>
97889807
</dd>
97899808
</dl>
97909809
</section>
9810+
<section>
9811+
<h3>
9812+
Configuring Channels with <a>AudioWorkletNodeOptions</a>
9813+
</h3>
9814+
<p>
9815+
With a combination of <a data-link-for=
9816+
"AudioWorkletNodeOptions">numberOfInputs</a>, <a data-link-for=
9817+
"AudioWorkletNodeOptions">numberOfOutputs</a> and
9818+
<a data-link-for=
9819+
"AudioWorkletNodeOptions">outputChannelCount</a>, various
9820+
channel configurations can be achieved.
9821+
</p>
9822+
<ol>
9823+
<li>
9824+
<a data-link-for="AudioWorkletNodeOptions">numberOfInputs</a>
9825+
= 0, <a data-link-for=
9826+
"AudioWorkletNodeOptions">numberOfOutputs</a> = 0
9827+
<ul>
9828+
<li>
9829+
<code>NotSupportedError</code> MUST be thrown by the
9830+
constructor.
9831+
</li>
9832+
</ul>
9833+
</li>
9834+
<li>
9835+
<a data-link-for="AudioWorkletNodeOptions">numberOfInputs</a>
9836+
= 1, <a data-link-for=
9837+
"AudioWorkletNodeOptions">numberOfOutputs</a> = 1
9838+
<ul>
9839+
<li>If <a data-link-for=
9840+
"AudioWorkletNodeOptions">outputChannelCount</a> is
9841+
unspecified, the output channel count will match
9842+
<a>computedNumberOfChannels</a> from the input.
9843+
</li>
9844+
</ul>
9845+
</li>
9846+
<li>All other cases
9847+
<ul>
9848+
<li>If <a data-link-for=
9849+
"AudioWorkletNodeOptions">outputChannelCount</a> is
9850+
unspecified, it will be mono for all outputs.
9851+
</li>
9852+
</ul>
9853+
</li>
9854+
</ol>
9855+
</section>
97919856
</section>
97929857
</section>
97939858
<section>
@@ -9904,8 +9969,9 @@ <h2 id="defining-a-valid-audioworkletprocessor">
99049969
by the user agent. <code>inputs[n][m]</code> is a
99059970
<code>Float32Array</code> of audio samples for the
99069971
<code>m</code>th channel of <code>n</code>th input. While the
9907-
number of inputs is fixed at the construction, the number of
9908-
channels can be changed dynamically.
9972+
number of inputs is fixed at construction, the number of
9973+
channels can be changed dynamically based on
9974+
<a>computedNumberOfChannels</a>.
99099975
</p>
99109976
<p>
99119977
If no connections exist to the <code>n</code>th input of the
@@ -9922,9 +9988,10 @@ <h2 id="defining-a-valid-audioworkletprocessor">
99229988
The output audio buffer that is to be consumed by the user
99239989
agent. <code>outputs[n][m]</code> is a
99249990
<code>Float32Array</code> object containing the audio samples
9925-
for <code>m</code>th channel of <code>n</code>th output. While
9926-
the number of outputs is fixed at the construction, the number
9927-
of channels can be changed dynamically.
9991+
for <code>m</code>th channel of <code>n</code>th output. The
9992+
number of channels in the output will match
9993+
<a>computedNumberOfChannels</a> only when the node has single
9994+
output.
99289995
</li>
99299996
<li>
99309997
<code>parameters</code> of type <code>Object</code><br>

0 commit comments

Comments
 (0)