Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AudioParamDescriptor has member constraints that are redundant #2169

Closed
bzbarsky opened this issue Feb 28, 2020 · 6 comments
Closed

AudioParamDescriptor has member constraints that are redundant #2169

bzbarsky opened this issue Feb 28, 2020 · 6 comments
Assignees

Comments

@bzbarsky
Copy link

https://webaudio.github.io/web-audio-api/#dictionary-audioparamdescriptor-members describes various constraints on its members. For example, for defaultValue it says:

If this value is out of the range of float data type or the range defined by minValue and maxValue, a NotSupportedError exception MUST be thrown

That first constraint is redundant with the fact that it's declared as float in the IDL: the algorithm at https://heycam.github.io/webidl/#es-to-float will already throw on out-of-range values, before any of this spec's logic happens. So it can just be removed.

The second constraint is redundant with https://webaudio.github.io/web-audio-api/#dom-audioworkletglobalscope-registerprocessor step 9 (though I took a look at the Blink code and I don't see it being enforced either in their version of step 7 or in step 9; I might have missed it, of course).

Similar for the other constraints here, including the one on "name"; that's enforced by https://webaudio.github.io/web-audio-api/#dom-audioworkletglobalscope-registerprocessor step 9 too.

@padenot

@rtoy
Copy link
Member

rtoy commented Mar 12, 2020

Teleconf: Yes, these need to be fixed.

@rtoy rtoy self-assigned this Mar 25, 2020
@rtoy
Copy link
Member

rtoy commented Mar 27, 2020

So basically:

  • remove the stuff about being out of range for a float.
  • constraint on defaultValue being between min and max and throwing a NotSupportedError is inconsistent with step 9 of the register processor algorithm, and also redundant.
  • constraint on name throwing an error is also described in step 9.

For the latter two, just remove the error conditions from AudioParamDescriptor?

I kind of like that here, but two places saying the same thing is bad. If we remove these, we should link to the appropriate steps in the algorithm for the constraints. Otherwise, most devs will probably never find the constraints without lots of digging.

@padenot
Copy link
Member

padenot commented Apr 6, 2020

For the latter two, just remove the error conditions from AudioParamDescriptor?

I think so yes.

@rtoy
Copy link
Member

rtoy commented Jul 17, 2020

On the other hand, should we keep the constraints in AudioParamDescriptor dictionary (which is where the user sets the various attributes) and remove the checks from the registerProcessor algorithm?

@bzbarsky
Copy link
Author

The place where the checks actually end up needing to happen is in the registerProcessor algorithm: dictionaries do not have behavior associated with them in the IDL spec.

@rtoy
Copy link
Member

rtoy commented Jul 17, 2020

Ok. I'll update them then. Thanks.

rtoy added a commit to rtoy/web-audio-api that referenced this issue Jul 17, 2020
The constraings in the members of the `AudioParamDescriptor` are removed.  We replace that with a link to the steps in `registerProcessor` algorithm that describes how to handle the descriptor.

Updated the algorithm to include a step to throw an error if `minValue` is greater than `maxValue`.
@rtoy rtoy closed this as completed in 0a3ea91 Jul 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants