[Webkit-unassigned] [Bug 250485] New: AudioWorkletProcessor fails to load when some parameter descriptors with minValue/maxValue are specified
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jan 11 15:41:01 PST 2023
https://bugs.webkit.org/show_bug.cgi?id=250485
Bug ID: 250485
Summary: AudioWorkletProcessor fails to load when some
parameter descriptors with minValue/maxValue are
specified
Product: WebKit
Version: Safari 16
Hardware: Mac (Apple Silicon)
OS: macOS 13
Status: NEW
Severity: Minor
Priority: P2
Component: Web Audio
Assignee: webkit-unassigned at lists.webkit.org
Reporter: casey at cprimozic.net
CC: cdumez at apple.com
When defining `AudioWorkletProcessor`s that have parameter descriptors which define `minValue` or `maxValue` can cause the AWP to fail to register in some cases.
It happens when the `defaultValue` for the param descriptor is out of the range implied by `minValue` and `maxValue`. For example, defining an AWP with this param descriptor fails:
```
static get parameterDescriptors() {
return [{ name: "x", minValue: 0.01 }];
}
```
I believe this happens because the default `defaultValue` is 0, which is below the set `minValue`. Changing it to this makes it register successfully:
```
static get parameterDescriptors() {
return [{ name: "x", minValue: 0.01, defaultValue: 0.4 }];
}
```
The same thing happens for `maxValue` if `defaultValue` is set higher than `maxValue`.
I'm not sure what the spec says about situations like this, but it works in other browsers I've tested.
Here is a working minimal repro of the bug:
index.html:
```
<html>
<head>
<script type="text/javascript">
const ctx = new AudioContext();
ctx.audioWorklet
.addModule("/awp.js")
.then(() => {
const node = new AudioWorkletNode(ctx, "bug-repro-awp");
document.write("SUCCESS");
})
.catch((e) => {
document.write("ERROR: " + e);
});
</script>
</head>
</html>
```
awp.js:
```
class BugReproAWP extends AudioWorkletProcessor {
static get parameterDescriptors() {
return [{ name: "bottom_ratio", minValue: 0.01 }];
}
constructor(_options) {}
process(inputs, outputs, params) {
return true;
}
}
registerProcessor("bug-repro-awp", BugReproAWP);
```
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230111/a976a890/attachment.htm>
More information about the webkit-unassigned
mailing list