WebAudio / web-audio-api

The Web Audio API v1.0, developed by the W3C Audio WG
https://webaudio.github.io/web-audio-api/
Other
1.04k stars 165 forks source link

Web IDL issues with AudioRenderCapacity #2488

Closed foolip closed 2 years ago

foolip commented 2 years ago

There are some issue with the Web IDL introduced in https://github.com/WebAudio/web-audio-api/pull/2462, which I noticed in https://github.com/web-platform-tests/wpt/pull/33888. What's currently in the spec:

[Exposed=Window]
interface AudioRenderCapacity {
    undefined start(AudioRenderCapacityOptions options);
    undefined stop();
    attribute EventHandler onupdate;
};

dictionary AudioRenderCapacityOptions {
    double updateInterval = 1;
};

[Exposed=Window]
interface AudioRenderCapacityEvent {
    constructor (DOMString type, double timestamp, double averageLoad,
              double peakLoad, double underrunRatio);
    readonly attribute double timestamp;
    readonly attribute double averageLoad;
    readonly attribute double peakLoad;
    readonly attribute double underrunRatio;
};

https://github.com/WebAudio/web-audio-api/pull/2485 was created automatically. Also, inheritance from EventTarget and Event are missing, and the event constructor is not in the style of other event constructors. It should be something like:

[Exposed=Window]
interface AudioRenderCapacity : EventTarget {
    undefined start(optional AudioRenderCapacityOptions options = {});
    undefined stop();
    attribute EventHandler onupdate;
};

dictionary AudioRenderCapacityOptions {
    double updateInterval = 1;
};

[Exposed=Window]
interface AudioRenderCapacityEvent : Event {
    constructor (DOMString type, optional AudioRenderCapacityEventInit eventInitDict = {});
    readonly attribute double timestamp;
    readonly attribute double averageLoad;
    readonly attribute double peakLoad;
    readonly attribute double underrunRatio;
};

dictionary AudioRenderCapacityEventInit : EventInit {
    double timestamp = 0;
    double averageLoad = 0;
    double peakLoad = 0;
    double underrunRatio = 0;
};

I tried to write a PR, but trying to get the indentation right in the web UI was too much of a hassle.

@hoch can you take a look?

hoch commented 2 years ago

Thanks for filing the issue, @foolip! I'll fix this soon.