@@ -9747,6 +9747,7 @@ <h2 id="AudioWorkletNodeOptions">
9747
9747
dictionary AudioWorkletNodeOptions : AudioNodeOptions {
9748
9748
unsigned long numberOfInputs = 1;
9749
9749
unsigned long numberOfOutputs = 1;
9750
+ sequence<unsigned long> outputChannelCount;
9750
9751
record<DOMString, double> parameterData;
9751
9752
};
9752
9753
</pre>
@@ -9774,6 +9775,24 @@ <h3>
9774
9775
This is used to initialize the value of <a>AudioNode</a>
9775
9776
<a data-link-for="AudioNode">numberOfOutputs</a> attribute.
9776
9777
</dd>
9778
+ <dt>
9779
+ <code><dfn>outputChannelCount</dfn></code> of type
9780
+ <span class="idlAttrType"><code>sequence<unsigned
9781
+ long></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>
9777
9796
<dt>
9778
9797
<code><dfn>parameterData</dfn></code> of type <span class=
9779
9798
"idlAttrType"><code>record<DOMString,
@@ -9788,6 +9807,52 @@ <h3>
9788
9807
</dd>
9789
9808
</dl>
9790
9809
</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>
9791
9856
</section>
9792
9857
</section>
9793
9858
<section>
@@ -9904,8 +9969,9 @@ <h2 id="defining-a-valid-audioworkletprocessor">
9904
9969
by the user agent. <code>inputs[n][m]</code> is a
9905
9970
<code>Float32Array</code> of audio samples for the
9906
9971
<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>.
9909
9975
</p>
9910
9976
<p>
9911
9977
If no connections exist to the <code>n</code>th input of the
@@ -9922,9 +9988,10 @@ <h2 id="defining-a-valid-audioworkletprocessor">
9922
9988
The output audio buffer that is to be consumed by the user
9923
9989
agent. <code>outputs[n][m]</code> is a
9924
9990
<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.
9928
9995
</li>
9929
9996
<li>
9930
9997
<code>parameters</code> of type <code>Object</code><br>
0 commit comments