这是indexloc提供的服务,不要输入任何密码
Skip to content

There are still issues with the setup of an AudioWorkletNode's parameters #2018

@bzbarsky

Description

@bzbarsky

I am looking at https://webaudio.github.io/web-audio-api/#ref-for-node-name-to-parameter-descriptor-map%E2%91%A2 (AudioWorkletNode constructor step 10).

There are three issues I see here:

  1. The first bullet point in step 10.3.2 seems to be informative, not normative, since it just restates the conditional from step 10.3.1. Why is it there at all? If it needs to be there, it should be clearly marked as an informative note.

  2. The second bullet point in step 10.3.2 says:

    value is out of the range specified in AudioParamDescriptor.

    but AudioParamDescriptor is just a dictionary type that can be used to specify ranges... to actually specify a range you need a specific AudioParamDescriptor instance, and this step does not say which instance should be used.

  3. In step 10.3.1 it's talking about "an entry with name member equal to paramNameInOption inside audioParamMap" but audioParamMap is an instance of AudioParamMap, which is a maplike<DOMString, AudioParam>. The entries of such a thing do not have a "name member"; what they have are keys and values. so presumably this should be talking about "an entry with a key equal to paramNameInOption". But even better would be to explicitly write out what needs to happen here:

    1. Look up the value for key paramNameInOption in audioParamMap. But see more on this below!
    2. If there is no value, continue to the next key-value pair.
    3. Assert that the value is an AudioParam instance.
    4. Set the value's value to value. (This step could use some better naming for the result of the lookup in the first step, clearly!)

There's one major complication here, which is that in IDL a maplike has a [[BackingMap]] that is the source of truth as far as I can tell, in the sense that .get goes through that [[BackingMap]], etc. Unfortunately, the way IDL defines things right now there is no way to access that backing map in a reliable or side-effect-free way. See whatwg/webidl#254. It's possible that implementing option 3 from that issue would be enough to make things OK here; I haven't thought through the implications carefully but I suggest doing so.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions