-
Notifications
You must be signed in to change notification settings - Fork 168
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
AudioWorkletProcessCallback should not be a callback type #2581
Comments
I may not be understanding the issue, but I believe the callback is called in the rendering a graph algorithm (step 4.4.4). I also see in the linked issue that you are skeptical of performance requirements. AudioWorklet process functions could potentially be called up to once every render quantum (2.6 ms at 48 kHz sampling rate) so it is important that we give implementers as many options as we can to help make their implementations performant. This includes avoiding memory allocations when possible. Is there a way to avoid extra allocations when using sequences? EDIT: It seems like this issue isn't about changing WebAudio's use of |
I think @domenic's point is that while the spec has prose like:
This isn't something Web IDL enforces or participates in. The prose in rendering a graph algorithm (step 4.4.4) does all the necessary lifting and integration with JS, so the Web IDL definition is (mostly) not adding value, and its presence is blocking other cleanup. I said "mostly" because there's a caveat. The substeps have:
In this, the args (inputs, outputs, parameters) link to the AudioWorkletProcessCallback definition, so it is currently serving as the definition for how to convert from IDL values to ECMAScript values, which needs to go somewhere but could be in prose inline. I think the current text is equivalent to something like:
Which... doesn't make sense to me - it's mixing values with types? Where do the values come from? |
I think this was my attempt to make the connection from a Web IDL arguments list into an ECMAScript arguments list. The concept of AudioWorkletProcessor's To answer @inexorabletash's questions:
I also followed up on the original issue with a question about |
As @domenic pointed out, the callback is not used at all in the algorithms. In fact the result of
I also find it confusing, and it's unclear to me too how these relate to the arguments that are converted to ECMAScript values. Note that one talks about The spec links to https://webidl.spec.whatwg.org/#web-idl-arguments-list-converting, so it depends on what type of WebIDL values these are originally (regardless of the argument types in the callback). There is nothing in the spec that actually creates a FrozenArray or creates a FrozenArray from an iterable, so if Given that the WebIDL spec has a way to create a |
@chrisguttandin Any thoughts on this issue? Is your library (TypeScript) going to be impacted by this spec change? |
standardized-audio-context doesn't provide any interface AudioWorkletProcessorImpl extends AudioWorkletProcessor {
process(inputs: Float32Array[][], outputs: Float32Array[][], parameters: Record<string, Float32Array>): boolean;
} https://www.npmjs.com/package/@types/audioworklet?activeTab=code (index.d.ts line 273 to 275) |
Ping! This is one of the last things we need to fix to help with whatwg/webidl#1399. We'll probably go ahead and disallow this in the Web IDL spec soon, but it'd be best if there were zero client specs using the disallowed construct first. |
Noted. We (WG) will triage this and try to assign this to one of contributors. |
AudioWorkletProcessCallback is defined, but it is never called. Instead it seems to be misusing Web IDL to define the sort of method that web developers should put on their audio worklet classes.
Web IDL is not an appropriate language for such a description, since it has consequences for bindings generators, and the callback type has a very specific meaning in terms of what happens when you invoke them.
Instead, prose would be better.
Removing this misuse of Web IDL would help with whatwg/webidl#1399.
The text was updated successfully, but these errors were encountered: