From a6f2cf552a3e01ee9b9199e4b522ef18d013411c Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Wed, 25 Nov 2026 13:32:41 +0100 Subject: [PATCH] Allow replacing WaveShaperNode curves Fixes #2655 --- index.bs | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/index.bs b/index.bs index 3b4cf650e..16cbcd3d7 100644 --- a/index.bs +++ b/index.bs @@ -10376,11 +10376,6 @@ Constructors path: audionode-init.include - Also, let [[curve set]] be an internal - slot of this {{WaveShaperNode}}. Initialize this slot to false. If - {{WaveShaperNode/constructor(context, options)/options}} is given and specifies a - {{WaveShaperOptions/curve}}, set {{[[curve set]]}} to true. -
             context: The {{BaseAudioContext}} this new {{WaveShaperNode}} will be associated with.
             options: Optional initial parameter value for this {{WaveShaperNode}}.
@@ -10449,30 +10444,23 @@ Attributes
                 
         
 
-        A {{InvalidStateError}} MUST be thrown if this
-        attribute is set with a {{Float32Array}} that has a
-        length less than 2.
-
-        When this attribute is set, an internal copy of the curve is
-        created by the {{WaveShaperNode}}. Subsequent
-        modifications of the contents of the array used to set the
-        attribute therefore have no effect.
+        This attribute can be set more than once. Subsequent modifications of
+        the contents of an array used to set the attribute have no effect.
 
         
- To set the {{WaveShaperNode/curve}} attribute, execute these steps: - - 1. Let new curve be a {{Float32Array}} to be assigned to {{WaveShaperNode/curve}} or null. - . - - 2. If new curve is not null and - {{WaveShaperNode/[[curve set]]}} is true, throw an - {{InvalidStateError}} and abort these steps. - - 3. If new curve is not null, set - {{WaveShaperNode/[[curve set]]}} to true. - - 4. Assign new curve to the {{WaveShaperNode/curve}} - attribute. + The {{WaveShaperNode/curve}} setter steps are: + + 1. If the given value is not null and its + length is less than 2, throw an {{InvalidStateError}} + and abort these steps. + 2. If the given value is null, assign null + to the {{WaveShaperNode/curve}} attribute and abort these steps. + 3. Otherwise: + 1. Let copy be a new {{Float32Array}} with the same + length as the given value. + 2. For each index in the given value, copy the element at + that index to the same index in copy. + 3. Assign copy to the {{WaveShaperNode/curve}} attribute.
Note: The use of a curve that produces a non-zero