You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix#1933: Use FrozenArray for AudioWorkletProcessor process() (#2250)
* Fix#1933: Use FrozeArray for AudioWorkletProcessor process()
Instead of `sequence<sequence<Float32Array>>`, use
`FrozenArray<FrozenArray<Float32Array>>`.
Define a callback function as well.
* Address review comments from karlt.
Rename AudioWorkletProcessorCallback to AudioWorletProcessCallback
The third parameter is an object, not frozen array.
* Replace process() method with callback sections
Several changes here in no particular order:
- Tell bikeshed that `object` is the webidl concept
- Fix parameter names for the process callback (plurals, as used in the descriptions)
- Rename the dfn for "Processing an input buffer" from "process" to "processing-input-buffer".
- Fix up links to `process()` to point to the right place.
- The old section on the process method is broken up into two sections. The main one is renaming it to "callback AudioWorkletProcessCallback". This contains most fo the main text. A subsection then describes the parameters to the callback.
* Update expected errors
The callback idea fixes the errors from defining the process method.
* Address some review comments
* Describe what happens to inputs/outputs if things change
Add text to say inputs/outputs are recycled unless the topology
changes (number of channels, array is transferred). Then new arrays
are allocated.
* Address some review comments
Still need description of how parameters are frozen.
* Update README.md
* Fix typo in "messsage" (#2255)
* chore: Fix markdown for bold (#2258)
* Update implementation-report.html
Update for Safari and for Edge
* Update implementation-report.html
Update IDL results for newer browsers
* Update implementation-report.html
Update summaries for new browsers. Fails = 6573 - passes
* Update implementation-report.html
Date
* Fix typo "atleast" (#2259)
This isn't really a typo but an issue with bikeshed not leaving a
space at line breaks. See speced/bikeshed#1470.
* Address #2185: Fix duplicated IDs for decode callbacks (#2253)
* Address #2185: Duplicate IDs for Decode callbacks
The decode callbacks were multiply defining their arguments. Instead,
just have the descriptions of the arguments just link back to the IDL
that defines the args.
* Update expected errors
* Fix#2262: Clone bikeshed and install it (#2263)
As a workaround, clone the bikeshed repo and install bikeshed from the
repo.
Ideally, want just want to use the version with pip3 instead of
cloning the current version of bikeshed, but that's producing
unexpected errors. We'll do this for now and recheck at some later
date when bikeshed is updated and revert to the old version.
* Fix#2257: Make channel ordering table visible in dark mode (#2264)
When using dark mode, use a different background color for the even
rows of the channel ordering table so that the entries are visible.
While we're at it, make the headings for the audio node properties
table, the audio param values table, and the enumeration description
table look a little better in dark mode. This is done by specifying a
brighter green to make it a bit more legible.
* Add ECMAScript algorithm to freeze parameters.
* Some cleanups.
Co-authored-by: Chris Lilley <[email protected]>
Co-authored-by: Tomohiro IKEDA <[email protected]>
The input audio buffer from the incoming connections provided by the user agent. It has type <code>sequence<sequence<Float32Array>></code>.<code class="nobreak">inputs[n][m]</code> is a {{Float32Array}} of audio samples for the \(m\)th channel of the \(n\)th input. While the number of inputs is fixed at construction, the number of channels can be changed dynamically based on [=computedNumberOfChannels=].
10537
-
10538
-
If there are no [=actively processing=]{{AudioNode}}s connected to the \(n\)th input of the {{AudioWorkletNode}} for the current render quantum, then the content of <code>inputs[n]</code> is an empty array, indicating that zero channels of input are available. This is the only circumstance under which the number of elements of <code>inputs[n]</code> can be zero.
10539
-
10540
-
outputs:
10541
-
The output audio buffer that is to be consumed by the user agent. It has type <code>sequence<sequence<Float32Array>></code>.<code class="nobreak">outputs[n][m]</code> is a {{Float32Array}} object containing the audio samples for \(m\)th channel of \(n\)th output. Each of the {{Float32Array}}s are zero-filled. The number of channels in the output will match [=computedNumberOfChannels=] only when the node has a single output.
10542
-
10543
-
parameters:
10544
-
An [=ordered map=] of <var>name</var> → <var>parameterValues</var>. <code>parameters["<var>name</var>"]</code> returns <var>parameterValues</var>, which is a {{Float32Array}} with the automation values of the <var>name</var>{{AudioParam}}.
10545
-
10546
-
For each array, the array contains the [=computedValue=] of the parameter for all frames in the [=render quantum=]. However, if no automation is scheduled during this render quantum, the array MAY have length 1 with the array element being the constant value of the {{AudioParam}} for the [=render quantum=].
10547
-
</pre>
10548
-
10549
-
<div>
10550
-
<em>Return type:</em>{{boolean}}
10551
-
</div>
10552
-
</dl>
10508
+
* Nodes that transform their inputs, but which remain active
10509
+
for a <a>tail-time</a> after their inputs are disconnected. In
10510
+
this case, [=process()=] SHOULD return
10511
+
`true` for some period of time after
10512
+
<code>inputs</code> is found to contain zero channels. The
10513
+
current time may be obtained from the global scope's
10514
+
{{AudioWorkletGlobalScope/currentTime}} to
10515
+
measure the start and end of this tail-time interval, or the
10516
+
interval could be calculated dynamically depending on the
10517
+
processor's internal state.
10518
+
10519
+
* Nodes that act as sources of output, typically with a
10520
+
lifetime. Such nodes SHOULD return `true` from
10521
+
[=process()=] until the point at which they are no
10522
+
longer producing an output.
10523
+
10524
+
Note that the preceding definition implies that when no
10525
+
return value is provided from an implementation of
10526
+
[=process()=], the effect is identical to returning
10527
+
<code>false</code> (since the effective return value is the falsy
10528
+
value {{undefined}}). This is a reasonable behavior for
10529
+
any {{AudioWorkletProcessor}} that is active only when it has
10530
+
active inputs.
10531
+
</div>
10553
10532
10554
10533
The example below shows how {{AudioParam}} can be defined and used in an
10555
10534
{{AudioWorkletProcessor}}.
@@ -10584,6 +10563,51 @@ class MyProcessor extends AudioWorkletProcessor {
: {{AudioWorkletProcessCallback/inputs!!argument}}, of type <code>{{FrozenArray}}<{{FrozenArray}}<{{Float32Array}}>></code>
10583
+
:: The input audio buffer from the incoming connections provided by the user agent. <code class="nobreak">inputs[n][m]</code> is a {{Float32Array}} of audio samples for the \(m\)th channel of the \(n\)th input. While the number of inputs is fixed at construction, the number of channels can be changed dynamically based on [=computedNumberOfChannels=].
10584
+
10585
+
If there are no [=actively processing=]{{AudioNode}}s connected to the \(n\)th input of the {{AudioWorkletNode}} for the current render quantum, then the content of <code>inputs[n]</code> is an empty array, indicating that zero channels of input are available. This is the only circumstance under which the number of elements of <code>inputs[n]</code> can be zero.
10586
+
10587
+
: {{AudioWorkletProcessCallback/outputs!!argument}}, of type <code>{{FrozenArray}}<{{FrozenArray}}<{{Float32Array}}>></code>
10588
+
:: The output audio buffer that is to be consumed by the user agent. <code class="nobreak">outputs[n][m]</code> is a {{Float32Array}} object containing the audio samples for \(m\)th channel of \(n\)th output. Each of the {{Float32Array}}s are zero-filled. The number of channels in the output will match [=computedNumberOfChannels=] only when the node has a single output.
10589
+
10590
+
: {{AudioWorkletProcessCallback/parameters!!argument}}, of type {{object}}
10591
+
:: An [=ordered map=] of <var>name</var> → <var>parameterValues</var>. <code>parameters["<var>name</var>"]</code> returns <var>parameterValues</var>, which is a {{FrozenArray}}<{{Float32Array}}> with the automation values of the <var>name</var>{{AudioParam}}.
10592
+
10593
+
For each array, the array contains the [=computedValue=] of the parameter for all frames in the [=render quantum=]. However, if no automation is scheduled during this render quantum, the array MAY have length 1 with the array element being the constant value of the {{AudioParam}} for the [=render quantum=].
10594
+
10595
+
This object is frozen according the the following steps
10596
+
<div algorithm="freeze parameter object">
10597
+
1. Let |parameter| be the [=ordered map=] of the name and parameter values.
0 commit comments