Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-07-27 20:25:05 UTC (rev 264941)
@@ -1,3 +1,21 @@
+2020-07-27 Clark Wang <clark_w...@apple.com>
+
+ Added Constructor method to OscillatorNode
+ https://bugs.webkit.org/show_bug.cgi?id=214746
+
+ Reviewed by Chris Dumez.
+
+ Re-baselined existing tests that now pass, or fail further along.
+
+ * web-platform-tests/webaudio/idlharness.https.window-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/processing-model/cycle-without-delay-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-channelmergernode-interface/active-processing.https-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt:
+ * web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping-expected.txt:
+
2020-07-24 Chris Dumez <cdu...@apple.com>
Unreviewed, land baseline for web-platform-tests/encoding/eof-shift_jis.html.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/idlharness.https.window-expected.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -858,7 +858,7 @@
FAIL MediaStreamTrackAudioSourceNode interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "MediaStreamTrackAudioSourceNode" expected property "MediaStreamTrackAudioSourceNode" missing
FAIL MediaStreamTrackAudioSourceNode interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "MediaStreamTrackAudioSourceNode" expected property "MediaStreamTrackAudioSourceNode" missing
PASS OscillatorNode interface: existence and properties of interface object
-FAIL OscillatorNode interface object length assert_equals: wrong value for OscillatorNode.length expected 1 but got 0
+PASS OscillatorNode interface object length
PASS OscillatorNode interface object name
PASS OscillatorNode interface: existence and properties of interface prototype object
PASS OscillatorNode interface: existence and properties of interface prototype object's "constructor" property
@@ -867,41 +867,41 @@
PASS OscillatorNode interface: attribute frequency
PASS OscillatorNode interface: attribute detune
PASS OscillatorNode interface: operation setPeriodicWave(PeriodicWave)
-FAIL OscillatorNode must be primary interface of new OscillatorNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL Stringification of new OscillatorNode(context) assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL OscillatorNode interface: new OscillatorNode(context) must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL OscillatorNode interface: new OscillatorNode(context) must inherit property "frequency" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL OscillatorNode interface: new OscillatorNode(context) must inherit property "detune" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL OscillatorNode interface: new OscillatorNode(context) must inherit property "setPeriodicWave(PeriodicWave)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL OscillatorNode interface: calling setPeriodicWave(PeriodicWave) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioScheduledSourceNode interface: new OscillatorNode(context) must inherit property "onended" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioScheduledSourceNode interface: new OscillatorNode(context) must inherit property "start(optional double)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioScheduledSourceNode interface: calling start(optional double) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioScheduledSourceNode interface: new OscillatorNode(context) must inherit property "stop(optional double)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioScheduledSourceNode interface: calling stop(optional double) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: calling connect(AudioParam, optional unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "disconnect()" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: calling disconnect(unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioNode)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioParam)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: calling disconnect(AudioParam, unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "context" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "numberOfInputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "numberOfOutputs" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "channelCount" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "channelCountMode" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
-FAIL AudioNode interface: new OscillatorNode(context) must inherit property "channelInterpretation" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
+PASS OscillatorNode must be primary interface of new OscillatorNode(context)
+PASS Stringification of new OscillatorNode(context)
+PASS OscillatorNode interface: new OscillatorNode(context) must inherit property "type" with the proper type
+PASS OscillatorNode interface: new OscillatorNode(context) must inherit property "frequency" with the proper type
+PASS OscillatorNode interface: new OscillatorNode(context) must inherit property "detune" with the proper type
+PASS OscillatorNode interface: new OscillatorNode(context) must inherit property "setPeriodicWave(PeriodicWave)" with the proper type
+PASS OscillatorNode interface: calling setPeriodicWave(PeriodicWave) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioScheduledSourceNode interface: new OscillatorNode(context) must inherit property "onended" with the proper type
+PASS AudioScheduledSourceNode interface: new OscillatorNode(context) must inherit property "start(optional double)" with the proper type
+PASS AudioScheduledSourceNode interface: calling start(optional double) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioScheduledSourceNode interface: new OscillatorNode(context) must inherit property "stop(optional double)" with the proper type
+PASS AudioScheduledSourceNode interface: calling stop(optional double) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "connect(AudioNode, optional unsigned long, optional unsigned long)" with the proper type
+PASS AudioNode interface: calling connect(AudioNode, optional unsigned long, optional unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "connect(AudioParam, optional unsigned long)" with the proper type
+PASS AudioNode interface: calling connect(AudioParam, optional unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "disconnect()" with the proper type
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioNode)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioNode, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioNode, unsigned long, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioNode, unsigned long, unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioParam)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioParam) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "disconnect(AudioParam, unsigned long)" with the proper type
+PASS AudioNode interface: calling disconnect(AudioParam, unsigned long) on new OscillatorNode(context) with too few arguments must throw TypeError
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "context" with the proper type
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "numberOfInputs" with the proper type
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "numberOfOutputs" with the proper type
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "channelCount" with the proper type
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "channelCountMode" with the proper type
+PASS AudioNode interface: new OscillatorNode(context) must inherit property "channelInterpretation" with the proper type
PASS PannerNode interface: existence and properties of interface object
PASS PannerNode interface object length
PASS PannerNode interface object name
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/processing-model/cycle-without-delay-expected.txt (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/processing-model/cycle-without-delay-expected.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/processing-model/cycle-without-delay-expected.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -1,3 +1,3 @@
-FAIL Test that cycles that don't contain a DelayNode are muted function is not a constructor (evaluating 'new OscillatorNode(off)')
+FAIL Test that cycles that don't contain a DelayNode are muted function is not a constructor (evaluating 'new GainNode(off)')
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-channelmergernode-interface/active-processing.https-expected.txt (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-channelmergernode-interface/active-processing.https-expected.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-channelmergernode-interface/active-processing.https-expected.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -1,7 +1,7 @@
PASS # AUDIT TASK RUNNER STARTED.
FAIL Executing "initialize" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'context.audioWorklet.addModule')"
-FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
+FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new ChannelMergerNode(context, {numberOfInputs: numberOfInputs})')"
PASS Audit report
PASS > [initialize]
PASS > [test]
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https-expected.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -1,7 +1,8 @@
PASS # AUDIT TASK RUNNER STARTED.
FAIL Executing "initialize" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'context.audioWorklet.addModule')"
-FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context)')"
+FAIL Executing "test" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new AudioBuffer({numberOfChannels: 2, length: 150,
+ sampleRate: context.sampleRate})')"
PASS Audit report
PASS > [initialize]
PASS > [test]
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator-expected.txt (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator-expected.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/ctor-oscillator-expected.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -2,24 +2,62 @@
PASS # AUDIT TASK RUNNER STARTED.
PASS Executing "initialize"
PASS Executing "invalid constructor"
-FAIL Executing "default constructor" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.numberOfInputs')"
-FAIL Executing "test AudioNodeOptions" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.channelCount')"
-FAIL Executing "constructor options" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'node.type')"
+PASS Executing "default constructor"
+PASS Executing "test AudioNodeOptions"
+PASS Executing "constructor options"
PASS Audit report
PASS > [initialize]
PASS context = new OfflineAudioContext(...) did not throw an exception.
PASS < [initialize] All assertions passed. (total 1 assertions)
PASS > [invalid constructor]
-PASS new OscillatorNode() threw TypeError: "function is not a constructor (evaluating 'new window[name]()')".
-PASS new OscillatorNode(1) threw TypeError: "function is not a constructor (evaluating 'new window[name](1)')".
-PASS new OscillatorNode(context, 42) threw TypeError: "function is not a constructor (evaluating 'new window[name](context, 42)')".
+PASS new OscillatorNode() threw TypeError: "Not enough arguments".
+PASS new OscillatorNode(1) threw TypeError: "Argument 1 ('context') to the OscillatorNode constructor must be an instance of BaseAudioContext".
+PASS new OscillatorNode(context, 42) threw TypeError: "Type error".
PASS < [invalid constructor] All assertions passed. (total 3 assertions)
PASS > [default constructor]
-FAIL X node0 = new OscillatorNode(context) incorrectly threw TypeError: "function is not a constructor (evaluating 'new window[name](context, options.constructorOptions)')". assert_true: expected true got false
-FAIL X node0 instanceof OscillatorNode is not equal to true. Got false. assert_true: expected true got false
+PASS node0 = new OscillatorNode(context) did not throw an exception.
+PASS node0 instanceof OscillatorNode is equal to true.
+PASS node0.numberOfInputs is equal to 0.
+PASS node0.numberOfOutputs is equal to 1.
+PASS node0.channelCount is equal to 2.
+PASS node0.channelCountMode is equal to max.
+PASS node0.channelInterpretation is equal to speakers.
+PASS node0.type is equal to sine.
+PASS node0.frequency.value is equal to 440.
+PASS < [default constructor] All assertions passed. (total 9 assertions)
PASS > [test AudioNodeOptions]
-FAIL X new OscillatorNode(c, {channelCount: 17}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new window[nodeName]')". assert_true: expected true got false
+PASS new OscillatorNode(c, {channelCount: 17}) did not throw an exception.
+PASS node.channelCount is equal to 17.
+PASS new OscillatorNode(c, {channelCount: 0}) threw InvalidStateError: "The object is in an invalid state.".
+PASS new OscillatorNode(c, {channelCount: 99}) threw InvalidStateError: "The object is in an invalid state.".
+PASS new OscillatorNode(c, {channelCountMode: "max"} did not throw an exception.
+PASS node.channelCountMode is equal to max.
+PASS new OscillatorNode(c, {channelCountMode: "max"}) did not throw an exception.
+PASS node.channelCountMode after valid setter is equal to max.
+PASS new OscillatorNode(c, {channelCountMode: "clamped-max"}) did not throw an exception.
+PASS node.channelCountMode after valid setter is equal to clamped-max.
+PASS new OscillatorNode(c, {channelCountMode: "explicit"}) did not throw an exception.
+PASS node.channelCountMode after valid setter is equal to explicit.
+PASS new OscillatorNode(c, {channelCountMode: "foobar"} threw TypeError: "Type error".
+PASS node.channelCountMode after invalid setter is equal to explicit.
+PASS new OscillatorNode(c, {channelInterpretation: "speakers"}) did not throw an exception.
+PASS node.channelInterpretation is equal to speakers.
+PASS new OscillatorNode(c, {channelInterpretation: "discrete"}) did not throw an exception.
+PASS node.channelInterpretation is equal to discrete.
+PASS new OscillatorNode(c, {channelInterpretation: "foobar"}) threw TypeError: "Type error".
+PASS node.channelInterpretation after invalid setter is equal to discrete.
+PASS < [test AudioNodeOptions] All assertions passed. (total 20 assertions)
PASS > [constructor options]
-FAIL X node1 = new OscillatorNode(c, {"type":"sawtooth","detune":7,"frequency":918}) incorrectly threw TypeError: "function is not a constructor (evaluating 'new OscillatorNode(context, options)')". assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 3 out of 5 tasks were failed. assert_true: expected true got false
+PASS node1 = new OscillatorNode(c, {"type":"sawtooth","detune":7,"frequency":918}) did not throw an exception.
+PASS node1.type is equal to sawtooth.
+PASS node1.detune.value is equal to 7.
+PASS node1.frequency.value is equal to 918.
+PASS node1.channelCount is equal to 2.
+PASS node1.channelCountMode is equal to max.
+PASS node1.channelInterpretation is equal to speakers.
+PASS new OscillatorNode(c, {"type":"sine","periodicWave":{}}) did not throw an exception.
+PASS new OscillatorNode(c, {"type":"custom"}) threw InvalidStateError: "Must provide periodicWave when using custom type.".
+PASS new OscillatorNode(, {"type":"custom","periodicWave":{}}) did not throw an exception.
+PASS < [constructor options] All assertions passed. (total 10 assertions)
+PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/detune-limiting-expected.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -2,7 +2,8 @@
PASS # AUDIT TASK RUNNER STARTED.
FAIL Executing "detune limits" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new ChannelMergerNode(
context, {numberOfInputs: context.destination.channelCount})')"
-FAIL Executing "detune automation" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context, {frequency: baseFrequency})')"
+FAIL Executing "detune automation" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'context.startRendering()
+ .then')"
PASS Audit report
PASS > [detune limits] Oscillator with detune and frequency at Nyquist or above
PASS > [detune automation] Oscillator output with detune automation should be zero above Nyquist
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-oscillatornode-interface/osc-basic-waveform-expected.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -1,15 +1,11 @@
PASS # AUDIT TASK RUNNER STARTED.
-FAIL Executing "Test 0" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context, {type: 'sine', frequency: freqHz})')"
-FAIL Executing "Test 1" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context, {type: 'sine', frequency: freqHz})')"
-FAIL Executing "Test 2" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context, {type: 'sine', frequency: freqHz})')"
-FAIL Executing "Test 3" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context, {type: 'sine', frequency: freqHz})')"
-FAIL Executing "Test 4" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(
- context,
- {type: 'custom', frequency: freqHz, periodicWave: wave})')"
-FAIL Executing "Test 5" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(
- context,
- {type: 'custom', frequency: freqHz, periodicWave: wave})')"
+FAIL Executing "Test 0" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'renderedBuffer.getChannelData')"
+FAIL Executing "Test 1" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'renderedBuffer.getChannelData')"
+FAIL Executing "Test 2" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'renderedBuffer.getChannelData')"
+FAIL Executing "Test 3" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'renderedBuffer.getChannelData')"
+FAIL Executing "Test 4" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'renderedBuffer.getChannelData')"
+FAIL Executing "Test 5" promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating 'renderedBuffer.getChannelData')"
PASS Audit report
PASS > [Test 0] Sine wave: 100 Hz
PASS > [Test 1] Sine wave: -100 Hz
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping-expected.txt (264940 => 264941)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping-expected.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-distance-clamping-expected.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -2,14 +2,8 @@
PASS # AUDIT TASK RUNNER STARTED.
PASS Executing "ref-distance-error"
PASS Executing "max-distance-error"
-FAIL Executing "min-distance" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context, {
- type: 'sawtooth',
- frequency: 20 * 440,
- })')"
-FAIL Executing "max-distance" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new OscillatorNode(context, {
- type: 'sawtooth',
- frequency: 20 * 440,
- })')"
+FAIL Executing "min-distance" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new ChannelSplitterNode(context, {numberOfOutputs: 2})')"
+FAIL Executing "max-distance" promise_test: Unhandled rejection with value: object "TypeError: function is not a constructor (evaluating 'new ChannelSplitterNode(context, {numberOfOutputs: 2})')"
PASS Audit report
PASS > [ref-distance-error]
PASS new PannerNode(c, {refDistance: -1}) threw RangeError: "refDistance cannot be set to a negative value".
Modified: trunk/Source/WebCore/CMakeLists.txt (264940 => 264941)
--- trunk/Source/WebCore/CMakeLists.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -478,6 +478,8 @@
Modules/webaudio/OfflineAudioContext.idl
Modules/webaudio/OfflineAudioContextOptions.idl
Modules/webaudio/OscillatorNode.idl
+ Modules/webaudio/OscillatorOptions.idl
+ Modules/webaudio/OscillatorType.idl
Modules/webaudio/PannerNode.idl
Modules/webaudio/PannerOptions.idl
Modules/webaudio/PanningModelType.idl
Modified: trunk/Source/WebCore/ChangeLog (264940 => 264941)
--- trunk/Source/WebCore/ChangeLog 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/ChangeLog 2020-07-27 20:25:05 UTC (rev 264941)
@@ -1,3 +1,43 @@
+2020-07-27 Clark Wang <clark_w...@apple.com>
+
+ Added Constructor method to OscillatorNode
+ https://bugs.webkit.org/show_bug.cgi?id=214746
+
+ Reviewed by Chris Dumez.
+
+ Re-baselined existing tests that now pass, or fail further along.
+
+ Added ctor to OscillatorNode, added OscillatorOptions, OscillatorType files all according to spec:
+ https://www.w3.org/TR/webaudio/#OscillatorNode-constructors. Updated createOscillator() method in
+ BaseAudioContext.
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Modules/webaudio/AudioContextOptions.h:
+ * Modules/webaudio/BaseAudioContext.cpp:
+ (WebCore::BaseAudioContext::createOscillator):
+ * Modules/webaudio/OscillatorNode.cpp:
+ (WebCore::OscillatorNode::create):
+ (WebCore::OscillatorNode::OscillatorNode):
+ (WebCore::OscillatorNode::setType):
+ (WebCore::OscillatorNode::setPeriodicWave):
+ * Modules/webaudio/OscillatorNode.h:
+ (WTF::LogArgument<WebCore::OscillatorType>::toString):
+ (WTF::LogArgument<WebCore::OscillatorNode::Type>::toString): Deleted.
+ * Modules/webaudio/OscillatorNode.idl:
+ * Modules/webaudio/OscillatorOptions.h: Copied from Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h.
+ * Modules/webaudio/OscillatorOptions.idl: Copied from Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h.
+ * Modules/webaudio/OscillatorType.h: Copied from Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h.
+ * Modules/webaudio/OscillatorType.idl: Copied from Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h.
+ * Modules/webaudio/PannerOptions.h:
+ * Modules/webaudio/PeriodicWave.cpp:
+ * Modules/webaudio/PeriodicWaveConstraints.h:
+ * Modules/webaudio/PeriodicWaveOptions.h:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+
2020-07-27 Mark Lam <mark....@apple.com>
DisallowVMEntry needs a copy assignment operator, detected by gcc's -Wdeprecated-copy warning
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (264940 => 264941)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-07-27 20:25:05 UTC (rev 264941)
@@ -327,6 +327,8 @@
$(PROJECT_DIR)/Modules/webaudio/OfflineAudioContext.idl
$(PROJECT_DIR)/Modules/webaudio/OfflineAudioContextOptions.idl
$(PROJECT_DIR)/Modules/webaudio/OscillatorNode.idl
+$(PROJECT_DIR)/Modules/webaudio/OscillatorOptions.idl
+$(PROJECT_DIR)/Modules/webaudio/OscillatorType.idl
$(PROJECT_DIR)/Modules/webaudio/PannerNode.idl
$(PROJECT_DIR)/Modules/webaudio/PannerOptions.idl
$(PROJECT_DIR)/Modules/webaudio/PanningModelType.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (264940 => 264941)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-07-27 20:25:05 UTC (rev 264941)
@@ -1230,6 +1230,10 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOptionalEffectTiming.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOscillatorNode.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOscillatorNode.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOscillatorOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOscillatorOptions.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOscillatorType.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOscillatorType.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOverconstrainedError.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOverconstrainedError.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSOverconstrainedErrorEvent.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (264940 => 264941)
--- trunk/Source/WebCore/DerivedSources.make 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/DerivedSources.make 2020-07-27 20:25:05 UTC (rev 264941)
@@ -410,6 +410,8 @@
$(WebCore)/Modules/webaudio/OfflineAudioContext.idl \
$(WebCore)/Modules/webaudio/OfflineAudioContextOptions.idl \
$(WebCore)/Modules/webaudio/OscillatorNode.idl \
+ $(WebCore)/Modules/webaudio/OscillatorOptions.idl \
+ $(WebCore)/Modules/webaudio/OscillatorType.idl \
$(WebCore)/Modules/webaudio/PannerNode.idl \
$(WebCore)/Modules/webaudio/PannerOptions.idl \
$(WebCore)/Modules/webaudio/PanningModelType.idl \
Modified: trunk/Source/WebCore/Modules/webaudio/AudioContextOptions.h (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/AudioContextOptions.h 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContextOptions.h 2020-07-27 20:25:05 UTC (rev 264941)
@@ -34,7 +34,7 @@
namespace WebCore {
struct AudioContextOptions {
- Variant<AudioContextLatencyCategory, double> latencyHint = AudioContextLatencyCategory::Interactive;
+ Variant<AudioContextLatencyCategory, double> latencyHint { AudioContextLatencyCategory::Interactive };
Optional<float> sampleRate;
};
Modified: trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/BaseAudioContext.cpp 2020-07-27 20:25:05 UTC (rev 264941)
@@ -625,13 +625,15 @@
lazyInitialize();
- Ref<OscillatorNode> node = OscillatorNode::create(*this, sampleRate());
+ auto node = OscillatorNode::create(*this);
+ if (node.hasException())
+ return node.releaseException();
// Because this is an AudioScheduledSourceNode, the context keeps a reference until it has finished playing.
// When this happens, AudioScheduledSourceNode::finish() calls BaseAudioContext::notifyNodeFinishedProcessing().
- refNode(node);
-
- return node;
+ auto nodeValue = node.releaseReturnValue();
+ refNode(nodeValue);
+ return nodeValue;
}
ExceptionOr<Ref<PeriodicWave>> BaseAudioContext::createPeriodicWave(Vector<float>&& real, Vector<float>&& imaginary, const PeriodicWaveConstraints& constraints)
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.cpp 2020-07-27 20:25:05 UTC (rev 264941)
@@ -45,31 +45,45 @@
PeriodicWave* OscillatorNode::s_periodicWaveSawtooth = nullptr;
PeriodicWave* OscillatorNode::s_periodicWaveTriangle = nullptr;
-Ref<OscillatorNode> OscillatorNode::create(BaseAudioContext& context, float sampleRate)
+ExceptionOr<Ref<OscillatorNode>> OscillatorNode::create(BaseAudioContext& context, const OscillatorOptions& options)
{
- return adoptRef(*new OscillatorNode(context, sampleRate));
+ if (options.type == OscillatorType::Custom && !options.periodicWave)
+ return Exception { InvalidStateError, "Must provide periodicWave when using custom type."_s };
+
+ auto oscillator = adoptRef(*new OscillatorNode(context, options));
+
+ auto result = oscillator->setChannelCount(options.channelCount.valueOr(2));
+ if (result.hasException())
+ return result.releaseException();
+
+ result = oscillator->setChannelCountMode(options.channelCountMode.valueOr(ChannelCountMode::Max));
+ if (result.hasException())
+ return result.releaseException();
+
+ result = oscillator->setChannelInterpretation(options.channelInterpretation.valueOr(ChannelInterpretation::Speakers));
+ if (result.hasException())
+ return result.releaseException();
+
+ if (options.periodicWave.get())
+ oscillator->setPeriodicWave(options.periodicWave.get());
+ else {
+ result = oscillator->setType(options.type);
+ if (result.hasException())
+ return result.releaseException();
+ }
+
+ return oscillator;
}
-OscillatorNode::OscillatorNode(BaseAudioContext& context, float sampleRate)
- : AudioScheduledSourceNode(context, sampleRate)
- , m_firstRender(true)
- , m_virtualReadIndex(0)
- , m_phaseIncrements(AudioNode::ProcessingSizeInFrames)
- , m_detuneValues(AudioNode::ProcessingSizeInFrames)
+OscillatorNode::OscillatorNode(BaseAudioContext& context, const OscillatorOptions& options)
+ : AudioScheduledSourceNode(context, context.sampleRate())
+ , m_frequency(AudioParam::create(context, "frequency"_s, options.frequency, -context.sampleRate() / 2, context.sampleRate() / 2))
+ , m_detune(AudioParam::create(context, "detune"_s, options.detune, -153600, 153600))
{
setNodeType(NodeTypeOscillator);
-
- // Use musical pitch standard A440 as a default.
- m_frequency = AudioParam::create(context, "frequency", 440, 0, 100000);
- // Default to no detuning.
- m_detune = AudioParam::create(context, "detune", 0, -4800, 4800);
-
- // Sets up default wave.
- setType(m_type);
-
+
// An oscillator is always mono.
addOutput(makeUnique<AudioNodeOutput>(this, 1));
-
initialize();
}
@@ -78,7 +92,7 @@
uninitialize();
}
-ExceptionOr<void> OscillatorNode::setType(Type type)
+ExceptionOr<void> OscillatorNode::setType(OscillatorType type)
{
PeriodicWave* periodicWave = nullptr;
@@ -85,28 +99,28 @@
ALWAYS_LOG(LOGIDENTIFIER, type);
switch (type) {
- case Type::Sine:
+ case OscillatorType::Sine:
if (!s_periodicWaveSine)
s_periodicWaveSine = &PeriodicWave::createSine(sampleRate()).leakRef();
periodicWave = s_periodicWaveSine;
break;
- case Type::Square:
+ case OscillatorType::Square:
if (!s_periodicWaveSquare)
s_periodicWaveSquare = &PeriodicWave::createSquare(sampleRate()).leakRef();
periodicWave = s_periodicWaveSquare;
break;
- case Type::Sawtooth:
+ case OscillatorType::Sawtooth:
if (!s_periodicWaveSawtooth)
s_periodicWaveSawtooth = &PeriodicWave::createSawtooth(sampleRate()).leakRef();
periodicWave = s_periodicWaveSawtooth;
break;
- case Type::Triangle:
+ case OscillatorType::Triangle:
if (!s_periodicWaveTriangle)
s_periodicWaveTriangle = &PeriodicWave::createTriangle(sampleRate()).leakRef();
periodicWave = s_periodicWaveTriangle;
break;
- case Type::Custom:
- if (m_type != Type::Custom)
+ case OscillatorType::Custom:
+ if (m_type != OscillatorType::Custom)
return Exception { InvalidStateError };
return { };
}
@@ -308,7 +322,7 @@
// This synchronizes with process().
auto locker = holdLock(m_processMutex);
m_periodicWave = periodicWave;
- m_type = Type::Custom;
+ m_type = OscillatorType::Custom;
}
bool OscillatorNode::propagatesSilence() const
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.h 2020-07-27 20:25:05 UTC (rev 264941)
@@ -25,6 +25,8 @@
#pragma once
#include "AudioScheduledSourceNode.h"
+#include "OscillatorOptions.h"
+#include "OscillatorType.h"
#include <wtf/Lock.h>
namespace WebCore {
@@ -36,23 +38,14 @@
class OscillatorNode final : public AudioScheduledSourceNode {
WTF_MAKE_ISO_ALLOCATED(OscillatorNode);
public:
- // The waveform type.
- enum class Type {
- Sine,
- Square,
- Sawtooth,
- Triangle,
- Custom
- };
+ static ExceptionOr<Ref<OscillatorNode>> create(BaseAudioContext&, const OscillatorOptions& = { });
- static Ref<OscillatorNode> create(BaseAudioContext&, float sampleRate);
-
virtual ~OscillatorNode();
const char* activeDOMObjectName() const override { return "OscillatorNode"; }
- Type type() const { return m_type; }
- ExceptionOr<void> setType(Type);
+ OscillatorType type() const { return m_type; }
+ ExceptionOr<void> setType(OscillatorType);
AudioParam* frequency() { return m_frequency.get(); }
AudioParam* detune() { return m_detune.get(); }
@@ -60,7 +53,7 @@
void setPeriodicWave(PeriodicWave*);
private:
- OscillatorNode(BaseAudioContext&, float sampleRate);
+ explicit OscillatorNode(BaseAudioContext&, const OscillatorOptions& = { });
void process(size_t framesToProcess) final;
void reset() final;
@@ -74,7 +67,7 @@
bool propagatesSilence() const final;
// One of the waveform types defined in the enum.
- Type m_type { Type::Sine };
+ OscillatorType m_type;
// Frequency value in Hertz.
RefPtr<AudioParam> m_frequency;
@@ -82,18 +75,18 @@
// Detune value (deviating from the frequency) in Cents.
RefPtr<AudioParam> m_detune;
- bool m_firstRender;
+ bool m_firstRender { true };
// m_virtualReadIndex is a sample-frame index into our buffer representing the current playback position.
// Since it's floating-point, it has sub-sample accuracy.
- double m_virtualReadIndex;
+ double m_virtualReadIndex { 0 };
// This synchronizes process().
mutable Lock m_processMutex;
// Stores sample-accurate values calculated according to frequency and detune.
- AudioFloatArray m_phaseIncrements;
- AudioFloatArray m_detuneValues;
+ AudioFloatArray m_phaseIncrements { AudioNode::ProcessingSizeInFrames };
+ AudioFloatArray m_detuneValues { AudioNode::ProcessingSizeInFrames };
RefPtr<PeriodicWave> m_periodicWave;
@@ -104,14 +97,14 @@
static PeriodicWave* s_periodicWaveTriangle;
};
-String convertEnumerationToString(OscillatorNode::Type); // In JSOscillatorNode.cpp
+String convertEnumerationToString(OscillatorType); // In JSOscillatorNode.cpp
} // namespace WebCore
namespace WTF {
-template<> struct LogArgument<WebCore::OscillatorNode::Type> {
- static String toString(WebCore::OscillatorNode::Type type) { return convertEnumerationToString(type); }
+template<> struct LogArgument<WebCore::OscillatorType> {
+ static String toString(WebCore::OscillatorType type) { return convertEnumerationToString(type); }
};
} // namespace WTF
Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl 2020-07-27 20:25:05 UTC (rev 264941)
@@ -22,20 +22,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-enum OscillatorType {
- "sine",
- "square",
- "sawtooth",
- "triangle",
- "custom"
-};
-
+
[
Conditional=WEB_AUDIO,
JSGenerateToJSObject,
ActiveDOMObject,
] interface OscillatorNode : AudioScheduledSourceNode {
+ [MayThrowException, EnabledBySetting=ModernUnprefixedWebAudio] constructor (BaseAudioContext context, optional OscillatorOptions options);
+
attribute OscillatorType type;
// Playback state constants.
Copied: trunk/Source/WebCore/Modules/webaudio/OscillatorOptions.h (from rev 264940, trunk/Source/WebCore/Modules/webaudio/AudioContextOptions.h) (0 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorOptions.h (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorOptions.h 2020-07-27 20:25:05 UTC (rev 264941)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEB_AUDIO)
+
+#include "AudioNodeOptions.h"
+#include "OscillatorType.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class PeriodicWave;
+
+struct OscillatorOptions : AudioNodeOptions {
+ OscillatorType type { OscillatorType::Sine };
+ float frequency { 440 };
+ float detune { 0 };
+ RefPtr<PeriodicWave> periodicWave;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEB_AUDIO)
Copied: trunk/Source/WebCore/Modules/webaudio/OscillatorOptions.idl (from rev 264940, trunk/Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h) (0 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorOptions.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorOptions.idl 2020-07-27 20:25:05 UTC (rev 264941)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=WEB_AUDIO,
+] dictionary OscillatorOptions : AudioNodeOptions {
+ OscillatorType type = "sine";
+ float frequency = 440;
+ float detune = 0;
+ PeriodicWave periodicWave;
+};
Copied: trunk/Source/WebCore/Modules/webaudio/OscillatorType.h (from rev 264940, trunk/Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h) (0 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorType.h (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorType.h 2020-07-27 20:25:05 UTC (rev 264941)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+enum class OscillatorType : uint8_t {
+ Sine,
+ Square,
+ Sawtooth,
+ Triangle,
+ Custom,
+};
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/Modules/webaudio/OscillatorType.idl (from rev 264940, trunk/Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h) (0 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/OscillatorType.idl (rev 0)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorType.idl 2020-07-27 20:25:05 UTC (rev 264941)
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Conditional=WEB_AUDIO,
+] enum OscillatorType {
+ "sine",
+ "square",
+ "sawtooth",
+ "triangle",
+ "custom"
+};
Modified: trunk/Source/WebCore/Modules/webaudio/PannerOptions.h (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/PannerOptions.h 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/PannerOptions.h 2020-07-27 20:25:05 UTC (rev 264941)
@@ -34,20 +34,20 @@
namespace WebCore {
struct PannerOptions : AudioNodeOptions {
- PanningModelType panningModel = PanningModelType::Equalpower;
- DistanceModelType distanceModel = DistanceModelType::Inverse;
- float positionX = 0;
- float positionY = 0;
- float positionZ = 0;
- float orientationX = 1;
- float orientationY = 0;
- float orientationZ = 0;
- double refDistance = 1;
- double maxDistance = 10000;
- double rolloffFactor = 1;
- double coneInnerAngle = 360;
- double coneOuterAngle = 360;
- double coneOuterGain = 0;
+ PanningModelType panningModel { PanningModelType::Equalpower };
+ DistanceModelType distanceModel { DistanceModelType::Inverse };
+ float positionX { 0 };
+ float positionY { 0 };
+ float positionZ { 0 };
+ float orientationX { 1 };
+ float orientationY { 0 };
+ float orientationZ { 0 };
+ double refDistance { 1 };
+ double maxDistance { 10000 };
+ double rolloffFactor { 1 };
+ double coneInnerAngle { 360 };
+ double coneOuterAngle { 360 };
+ double coneOuterGain { 0 };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp 2020-07-27 20:25:05 UTC (rev 264941)
@@ -45,7 +45,6 @@
using namespace VectorMath;
-// FIXME: Remove once old constructor is phased out
Ref<PeriodicWave> PeriodicWave::create(float sampleRate, Float32Array& real, Float32Array& imaginary)
{
ASSERT(real.length() == imaginary.length());
Modified: trunk/Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/PeriodicWaveConstraints.h 2020-07-27 20:25:05 UTC (rev 264941)
@@ -30,7 +30,7 @@
namespace WebCore {
struct PeriodicWaveConstraints {
- bool disableNormalization = false;
+ bool disableNormalization { false };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/Modules/webaudio/PeriodicWaveOptions.h (264940 => 264941)
--- trunk/Source/WebCore/Modules/webaudio/PeriodicWaveOptions.h 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Modules/webaudio/PeriodicWaveOptions.h 2020-07-27 20:25:05 UTC (rev 264941)
@@ -33,7 +33,7 @@
namespace WebCore {
-struct PeriodicWaveOptions : public PeriodicWaveConstraints {
+struct PeriodicWaveOptions : PeriodicWaveConstraints {
Optional<Vector<float>> real;
Optional<Vector<float>> imag;
};
Modified: trunk/Source/WebCore/Sources.txt (264940 => 264941)
--- trunk/Source/WebCore/Sources.txt 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/Sources.txt 2020-07-27 20:25:05 UTC (rev 264941)
@@ -3128,6 +3128,8 @@
JSOffscreenCanvasRenderingContext2D.cpp
JSOptionalEffectTiming.cpp
JSOscillatorNode.cpp
+JSOscillatorOptions.cpp
+JSOscillatorType.cpp
JSOverconstrainedError.cpp
JSOverconstrainedErrorEvent.cpp
JSOverflowEvent.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (264940 => 264941)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-07-27 20:11:25 UTC (rev 264940)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-07-27 20:25:05 UTC (rev 264941)
@@ -5058,6 +5058,7 @@
E71467B624ABAF1D00FB2F50 /* PannerOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E71467B524ABAF1D00FB2F50 /* PannerOptions.h */; };
E755E89224C7434B009F7C23 /* PeriodicWaveConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = E755E88F24C7434B009F7C23 /* PeriodicWaveConstraints.h */; };
E755E89924C7461D009F7C23 /* PeriodicWaveOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E755E89624C7461D009F7C23 /* PeriodicWaveOptions.h */; };
+ E755E8B324CA271E009F7C23 /* OscillatorOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E755E8AF24CA270A009F7C23 /* OscillatorOptions.h */; };
E785D91524B4D1CA0014DB21 /* ChannelCountMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E785D91124B4D1B10014DB21 /* ChannelCountMode.h */; };
E785D93424B636FF0014DB21 /* ChannelInterpretation.h in Headers */ = {isa = PBXBuildFile; fileRef = E785D93124B636FF0014DB21 /* ChannelInterpretation.h */; };
E785D96124B7F7350014DB21 /* AudioContextOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E785D95F24B7F7340014DB21 /* AudioContextOptions.h */; };
@@ -15837,6 +15838,10 @@
E755E89124C7434B009F7C23 /* PeriodicWaveConstraints.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PeriodicWaveConstraints.idl; sourceTree = "<group>"; };
E755E89624C7461D009F7C23 /* PeriodicWaveOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PeriodicWaveOptions.h; sourceTree = "<group>"; };
E755E89824C7461D009F7C23 /* PeriodicWaveOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = PeriodicWaveOptions.idl; sourceTree = "<group>"; };
+ E755E8AF24CA270A009F7C23 /* OscillatorOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OscillatorOptions.h; sourceTree = "<group>"; };
+ E755E8B124CA270A009F7C23 /* OscillatorOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = OscillatorOptions.idl; sourceTree = "<group>"; };
+ E755E8B424CA2796009F7C23 /* OscillatorType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OscillatorType.h; sourceTree = "<group>"; };
+ E755E8B624CA2796009F7C23 /* OscillatorType.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = OscillatorType.idl; sourceTree = "<group>"; };
E785D91124B4D1B10014DB21 /* ChannelCountMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChannelCountMode.h; sourceTree = "<group>"; };
E785D91324B4D1B10014DB21 /* ChannelCountMode.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = ChannelCountMode.idl; sourceTree = "<group>"; };
E785D93124B636FF0014DB21 /* ChannelInterpretation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChannelInterpretation.h; sourceTree = "<group>"; };
@@ -29521,6 +29526,10 @@
FD581FAB1520F91F003A7A75 /* OscillatorNode.cpp */,
FD581FAC1520F91F003A7A75 /* OscillatorNode.h */,
FD581FAD1520F91F003A7A75 /* OscillatorNode.idl */,
+ E755E8AF24CA270A009F7C23 /* OscillatorOptions.h */,
+ E755E8B124CA270A009F7C23 /* OscillatorOptions.idl */,
+ E755E8B424CA2796009F7C23 /* OscillatorType.h */,
+ E755E8B624CA2796009F7C23 /* OscillatorType.idl */,
FD315FCF12B0267500C1A359 /* PannerNode.cpp */,
FD315FD012B0267500C1A359 /* PannerNode.h */,
FD315FD112B0267500C1A359 /* PannerNode.idl */,
@@ -32604,6 +32613,7 @@
0014628B103CD1DE000B20DB /* OriginAccessEntry.h in Headers */,
FE9E89FC16E2DC0500A908F8 /* OriginLock.h in Headers */,
FD581FAF1520F91F003A7A75 /* OscillatorNode.h in Headers */,
+ E755E8B324CA271E009F7C23 /* OscillatorOptions.h in Headers */,
BC5EB5DD0E81B8DD00B25965 /* OutlineValue.h in Headers */,
7A29F57218C69514004D0F81 /* OutOfBandTextTrackPrivateAVF.h in Headers */,
0704A4081D6DE9F10086DCDB /* OverconstrainedError.h in Headers */,