-
Notifications
You must be signed in to change notification settings - Fork 172
Description
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:
-
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.
-
The second bullet point in step 10.3.2 says:
value is out of the range specified in AudioParamDescriptor.
but
AudioParamDescriptoris just a dictionary type that can be used to specify ranges... to actually specify a range you need a specificAudioParamDescriptorinstance, and this step does not say which instance should be used. -
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 amaplike<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:- Look up the value for key paramNameInOption in audioParamMap. But see more on this below!
- If there is no value, continue to the next key-value pair.
- Assert that the value is an
AudioParaminstance. - 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.