Closed rtoy closed 4 years ago
On second thought, I think an empty sequence is probably the right thing. There is no connection, so a sequence of a single Float32Array with no elements kind of indicates an input with a single channel with no elements. Might as well not create the empty Float32Array.
I guess the question is if sequence
with no elements is a subtype of sequence<Float32Array>
. It would seem not to be, but maybe that doesn't matter?
I assume a sequence can have zero elements, but once https://github.com/WebAudio/web-audio-api/issues/1933 is resolved, these won't be sequences anyway.
I'm using abstract terms here because we don't know yet what #1933's outcome will be.
There are three layers at play:
The first layer tells you how many input there are, the second how many channels there are (length is variable depending on mixing rules), for each input (length is variable depending on the number of channels of the input), and the third one is, for now, always 128 and has the actua data.
The spec in its current form, to me, is clear, useful, and implementable, probably regardless of what we do in #1933.
A zero-length inner-most Float32Array
could indicate that the input is known silent, but we haven't spec-ced this. The value for this is also clear, a stateless AudioWorkletNode
that receives silence can simply return (this is a trick that is used quite a lot in Gecko's implementation of native nodes). It would be wrong if the node has nothing connected to it however.
Yes, I think we've talked about providing a silent hint by using a 0-length Float32Array. (Or maybe a length-1 array with a value of 0?) Chrome, like Firefox, uses this a lot. I think we decided not to do this.
Teleconf: Silent hint is for v2. Let's resolve #1933 first and revisit this then.
Closing, nothing to do now that #1933 has been agreed on. Silent hint for v2, probably as part of the BYOB-API.
Describe the issue The spec currently says when the
m'th
input to an AudioWorklet has no connections theninputs[m]
is an empty array. Chrome implements this a bit differently andinputs[m]
is aFloat32Array
of length 0.My very vague memory was that this was the intent, but I'm not sure any more.
Since the input is a
sequence<sequence<Float32Array>
, theinputs[m]
should be asequence<Float32Array>
. As spec'ed, I think we getsequence
of length 0. I think it makes more sense to be asequence<Float32Array>
.Where Is It https://webaudio.github.io/web-audio-api/#dom-audioworkletprocessor-process-inputs-outputs-parameters-inputs