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
Implement AudioParam.setValueCurveAtTime #22897 #23259
Changes from all commits
File filter...
Jump to…
Implemented JS API for setValueCurveAtTime and updated tests
- Loading branch information
| @@ -231,6 +231,40 @@ impl AudioParamMethods for AudioParam { | ||
| Ok(DomRoot::from_ref(self)) | ||
| } | ||
|
|
||
| // https://webaudio.github.io/web-audio-api/#dom-audioparam-setvaluecurveattime | ||
| fn SetValueCurveAtTime( | ||
| &self, | ||
| values: Vec<Finite<f32>>, | ||
| start_time: Finite<f64>, | ||
| end_time: Finite<f64>, | ||
| ) -> Fallible<DomRoot<AudioParam>> { | ||
| if *start_time < 0. { | ||
| return Err(Error::Range(format!( | ||
| "start time {} should not be negative", | ||
| *start_time | ||
| ))); | ||
| } | ||
| if values.len() < 2. as usize { | ||
| return Err(Error::InvalidState); | ||
| } | ||
|
|
||
| if *end_time < 0. { | ||
| return Err(Error::Range(format!( | ||
| "end time {} should not be negative", | ||
| *end_time | ||
| ))); | ||
| } | ||
| self.message_node(AudioNodeMessage::SetParam( | ||
Akhilesh1996
Author
Contributor
|
||
| self.param, | ||
| UserAutomationEvent::SetValueCurveAtTime( | ||
| values.into_iter().map(|v| *v).collect(), | ||
| *start_time, | ||
| *end_time, | ||
| ), | ||
| )); | ||
| Ok(DomRoot::from_ref(self)) | ||
| } | ||
|
|
||
| // https://webaudio.github.io/web-audio-api/#dom-audioparam-cancelscheduledvalues | ||
| fn CancelScheduledValues(&self, cancel_time: Finite<f64>) -> Fallible<DomRoot<AudioParam>> { | ||
| if *cancel_time < 0. { | ||
| @@ -1,2 +1,28 @@ | ||
| [audioparam-method-chaining.html] | ||
| expected: ERROR | ||
| [< [invalid-operation\] 4 out of 4 assertions were failed.] | ||
| expected: FAIL | ||
|
|
||
| [X The gain value of the second gain node is not equal to 0.5. Got 0.] | ||
| expected: FAIL | ||
|
|
||
| [# AUDIT TASK RUNNER FINISHED: 2 out of 3 tasks were failed.] | ||
| expected: FAIL | ||
|
|
||
| [< [verification\] 1 out of 1 assertions were failed.] | ||
| expected: FAIL | ||
|
|
||
| [X Calling setValueAtTime() with a negative end time did not throw an exception.] | ||
| expected: FAIL | ||
|
|
||
| [X Calling exponentialRampToValueAtTime() with a zero target value did not throw an exception.] | ||
| expected: FAIL | ||
|
|
||
| [X The gain value of the first gain node is not equal to 1. Got 2.] | ||
| expected: FAIL | ||
|
|
||
| [X The rendered envelope does not equal [0,0.000125,0.00025,0.000375,0.0005,0.000625,0.00075,0.000875,0.001,0.001125,0.00125,0.001375,0.0015,0.001625,0.00175,0.001875...\] with an element-wise tolerance of {"absoluteThreshold":0.0000040532,"relativeThreshold":0}.\n\tIndex\tActual\t\t\tExpected\t\tAbsError\t\tRelError\t\tTest threshold\n\t[1\]\t0.0000000000000000e+0\t1.2500000000000000e-4\t1.2500000000000000e-4\t1.0000000000000000e+0\t4.0531999999999996e-6\n\t[2\]\t0.0000000000000000e+0\t2.5000000000000001e-4\t2.5000000000000001e-4\t1.0000000000000000e+0\t4.0531999999999996e-6\n\t[3\]\t0.0000000000000000e+0\t3.7500000000000001e-4\t3.7500000000000001e-4\t1.0000000000000000e+0\t4.0531999999999996e-6\n\t[4\]\t0.0000000000000000e+0\t5.0000000000000001e-4\t5.0000000000000001e-4\t1.0000000000000000e+0\t4.0531999999999996e-6\n\t[5\]\t0.0000000000000000e+0\t6.2500000000000001e-4\t6.2500000000000001e-4\t1.0000000000000000e+0\t4.0531999999999996e-6\n\t...and 31994 more errors.\n\tMax AbsError of 1.0000000000000000e+0 at index of 8000.\n\t[8000\]\t0.0000000000000000e+0\t1.0000000000000000e+0\t1.0000000000000000e+0\t1.0000000000000000e+0\t4.0531999999999996e-6\n\tMax RelError of 1.0000000000000000e+0 at index of 1.\n] | ||
| expected: FAIL | ||
|
|
||
| [# AUDIT TASK RUNNER FINISHED: 1 out of 3 tasks were failed.] | ||
| expected: FAIL | ||
|
|
| @@ -1,2 +1,124 @@ | ||
| [audioparam-setValueCurveAtTime.html] | ||
| expected: ERROR | ||
| [X Max error for test 12 at offset 15876 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
Manishearth
Member
|
||
|
|
||
| [X Discontinuity at index is not equal to 1323. Got 1325.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 15 at offset 19845 is not less than or equal to 0.0000037194. Got 0.464914441108627.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 19 at offset 25137 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 17 at offset 22491 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 7938. Got 7940.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 6615. Got 6617.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 11907. Got 11909.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 9261. Got 9263.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 3969. Got 3971.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 23814. Got 23816.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 22491. Got 22493.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 14 at offset 18522 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 17199. Got 17201.] | ||
| expected: FAIL | ||
|
|
||
| [X Number of discontinuites at incorrect locations is not equal to 0. Got 19.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 11 at offset 14553 is not less than or equal to 0.0000037194. Got 0.464914441108627.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 4 at offset 5292 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 13 at offset 17199 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 2 at offset 2646 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 18 at offset 23814 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [< [test\] 39 out of 41 assertions were failed.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 6 at offset 7938 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 21168. Got 21170.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 10 at offset 13230 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 5292. Got 5294.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 3 at offset 3969 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 19845. Got 19847.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 7 at offset 9261 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 2646. Got 2648.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 1 at offset 1323 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 18522. Got 18524.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 10584. Got 10586.] | ||
| expected: FAIL | ||
|
|
||
| [# AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 25137. Got 25139.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 14553. Got 14555.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 15876. Got 15878.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 8 at offset 10584 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 16 at offset 21168 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 5 at offset 6615 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Max error for test 9 at offset 11907 is not less than or equal to 0.0000037194. Got 0.4649144411087036.] | ||
| expected: FAIL | ||
|
|
||
| [X Discontinuity at index is not equal to 13230. Got 13232.] | ||
| expected: FAIL | ||
|
|
||
This needs to do a bunch of input validation, see the "description" column of the arguments table on https://webaudio.github.io/web-audio-api/#dom-audioparam-setvaluecurveattime