Skip to content

Undefined conversion to float for AudioParam initial values passed via AudioNode constructor options dictionary #2671

@karlt

Description

@karlt

https://webaudio.github.io/web-audio-api/#AudioNode-creation has

For each member of dict passed in, execute these steps, with k the key of the member, and v its value. If any exceptions [sic] is thrown when executing these steps, abort the iteration and propagate the exception to the caller of the algorithm (constructor or factory method).

  1. If k is the name of an AudioParam on this interface, set the value attribute of this AudioParam to v.

k is a WebIDL double and the AudioParam value attribute is WebIDL float.

WebIDL defines conversion from JS value to WebIDL float, but I don't see conversion between WebIDL types defined.

Perhaps Web Audio could specify that the conversion is performed through JS, but clearer and simpler might be to specify the corresponding option dict types as float. That would be consistent with the resolution of #121

If an AudioParam value is set directly from a JS value of 2 * FLT_MAX, for example, then the conversion would throw.
Doing similarly through an AudioNode constructor options dictionary would be expected to behave similarly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs DiscussionThe issue needs more discussion before it can be fixed.category: enhancementSubstantive changes that do not add new features. https://www.w3.org/policies/process/#class-3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions