Title: [265981] trunk
Revision
265981
Author
cdu...@apple.com
Date
2020-08-20 16:15:19 -0700 (Thu, 20 Aug 2020)

Log Message

AudioBufferSourceNode should use "final" values for playbackRate and detune
https://bugs.webkit.org/show_bug.cgi?id=215669

Reviewed by Eric Carlson.

LayoutTests/imported/w3c:

Rebaseline WPT test now that more checks are passing.

* web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt:

Source/WebCore:

AudioBufferSourceNode should use "final" values for playbackRate and detune to take into
account changes to the AudioParamTimeline (for example, when
AudioBufferSourceNode.playbackRate.setValueAtTime() is called).

No new tests, rebaselined existing test.

* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::totalPitchRate):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (265980 => 265981)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-20 23:14:05 UTC (rev 265980)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-08-20 23:15:19 UTC (rev 265981)
@@ -1,5 +1,16 @@
 2020-08-20  Chris Dumez  <cdu...@apple.com>
 
+        AudioBufferSourceNode should use "final" values for playbackRate and detune
+        https://bugs.webkit.org/show_bug.cgi?id=215669
+
+        Reviewed by Eric Carlson.
+
+        Rebaseline WPT test now that more checks are passing.
+
+        * web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt:
+
+2020-08-20  Chris Dumez  <cdu...@apple.com>
+
         AudioParam.automationRate attribute is missing
         https://bugs.webkit.org/show_bug.cgi?id=215710
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt (265980 => 265981)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt	2020-08-20 23:14:05 UTC (rev 265980)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioparam-interface/k-rate-audiobuffersource-connections-expected.txt	2020-08-20 23:15:19 UTC (rev 265981)
@@ -12,20 +12,20 @@
 PASS   playbackRate: mod.offset.setValueAtTime(0, 0) did not throw an exception. 
 PASS   playbackRate: mod.offset.linearRampToValueAtTime(1, 0.25) did not throw an exception. 
 PASS   playbackRate: mod.connect(tstNode[playbackRate]) did not throw an exception. 
-PASS   Expected k-rate playbackRate AudioParam with input is not constantly 0 (contains 1955 different values). 
-PASS   Actual k-rate playbackRate AudioParam with input is not constantly 0 (contains 1999 different values). 
+PASS   Expected k-rate playbackRate AudioParam with input is not constantly 0 (contains 1491 different values). 
+PASS   Actual k-rate playbackRate AudioParam with input is not constantly 0 (contains 1491 different values). 
 FAIL X k-rate playbackRate AudioParam with input does not equal [0,0.0005000000237487257,0.0010000000474974513,0.001500000013038516,0.0020000000949949026,0.0024999999441206455,0.003000000026077032,0.0035000001080334187,0.004000000189989805,0.0044999998062849045,0.004999999888241291,0.005499999970197678,0.006000000052154064,0.006500000134110451,0.007000000216066837,0.007499999832361937...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
 	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[129]	6.4499996602535248e-2	6.4531996846199036e-2	3.2000243663787842e-5	4.9588181410308658e-4	0.0000000000000000e+0
-	[130]	6.4999997615814209e-2	6.5063998103141785e-2	6.4000487327575684e-5	9.8365438942316172e-4	0.0000000000000000e+0
-	[131]	6.5499998629093170e-2	6.5595999360084534e-2	9.6000730991363525e-5	1.4635150303050405e-3	0.0000000000000000e+0
-	[132]	6.5999999642372131e-2	6.6128000617027283e-2	1.2800097465515137e-4	1.9356546918219153e-3	0.0000000000000000e+0
-	[133]	6.6500000655651093e-2	6.6660001873970032e-2	1.6000121831893921e-4	2.4002582331372219e-3	0.0000000000000000e+0
-	...and 1402 more errors.
-	Max AbsError of 7.6749998331069946e-1 at index of 1535.
-	[1535]	7.6749998331069946e-1	0.0000000000000000e+0	7.6749998331069946e-1	Infinity	0.0000000000000000e+0
-	Max RelError of Infinity at index of 1492.
-	[1492]	7.4599999189376831e-1	0.0000000000000000e+0	7.4599999189376831e-1	Infinity	0.0000000000000000e+0
+	[396]	2.1144001185894012e-1	2.1143999695777893e-1	1.4901161193847656e-8	7.0474656679186259e-8	0.0000000000000000e+0
+	[401]	2.1442000567913055e-1	2.1441999077796936e-1	1.4901161193847656e-8	6.9495204900357086e-8	0.0000000000000000e+0
+	[412]	2.2097600996494293e-1	2.2097599506378174e-1	1.4901161193847656e-8	6.7433393340062290e-8	0.0000000000000000e+0
+	[420]	2.2574400901794434e-1	2.2574399411678314e-1	1.4901161193847656e-8	6.6009114670571945e-8	0.0000000000000000e+0
+	[421]	2.2634001076221466e-1	2.2633999586105347e-1	1.4901161193847656e-8	6.5835298516994066e-8	0.0000000000000000e+0
+	...and 203 more errors.
+	Max AbsError of 5.9604644775390625e-8 at index of 851.
+	[851]	5.0287604331970215e-1	5.0287598371505737e-1	5.9604644775390625e-8	1.1852752309834739e-7	0.0000000000000000e+0
+	Max RelError of 1.1852752309834739e-7 at index of 851.
+	[851]	5.0287604331970215e-1	5.0287598371505737e-1	5.9604644775390625e-8	1.1852752309834739e-7	0.0000000000000000e+0
  assert_true: expected true got false
 FAIL < [playbackRate] 1 out of 11 assertions were failed. assert_true: expected true got false
 PASS > [detune] AudioBufferSource detune 
@@ -38,20 +38,8 @@
 PASS   detune: mod.offset.linearRampToValueAtTime(1200, 0.25) did not throw an exception. 
 PASS   detune: mod.connect(tstNode[detune]) did not throw an exception. 
 PASS   Expected k-rate detune AudioParam with input is not constantly 0 (contains 1961 different values). 
-PASS   Actual k-rate detune AudioParam with input is not constantly 0 (contains 1999 different values). 
-FAIL X k-rate detune AudioParam with input does not equal [0,0.0002500000118743628,0.0005000000237487257,0.000750000006519258,0.0010000000474974513,0.0012499999720603228,0.001500000013038516,0.0017500000540167093,0.0020000000949949026,0.0022499999031424522,0.0024999999441206455,0.002749999985098839,0.003000000026077032,0.0032500000670552254,0.0035000001080334187,0.003750000149011612...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[1]	5.0000002374872565e-4	2.5000001187436283e-4	2.5000001187436283e-4	1.0000000000000000e+0	0.0000000000000000e+0
-	[2]	1.0000000474974513e-3	5.0000002374872565e-4	5.0000002374872565e-4	1.0000000000000000e+0	0.0000000000000000e+0
-	[3]	1.5000000130385160e-3	7.5000000651925802e-4	7.5000000651925802e-4	1.0000000000000000e+0	0.0000000000000000e+0
-	[4]	2.0000000949949026e-3	1.0000000474974513e-3	1.0000000474974513e-3	1.0000000000000000e+0	0.0000000000000000e+0
-	[5]	2.4999999441206455e-3	1.2499999720603228e-3	1.2499999720603228e-3	1.0000000000000000e+0	0.0000000000000000e+0
-	...and 1994 more errors.
-	Max AbsError of 9.9949997663497925e-1 at index of 1999.
-	[1999]	9.9949997663497925e-1	0.0000000000000000e+0	9.9949997663497925e-1	Infinity	0.0000000000000000e+0
-	Max RelError of Infinity at index of 1962.
-	[1962]	9.8100000619888306e-1	0.0000000000000000e+0	9.8100000619888306e-1	Infinity	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [detune] 1 out of 11 assertions were failed. assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 2 out of 2 tasks were failed. assert_true: expected true got false
+PASS   Actual k-rate detune AudioParam with input is not constantly 0 (contains 1961 different values). 
+PASS   k-rate detune AudioParam with input equals [0,0.0002500000118743628,0.0005000000237487257,0.000750000006519258,0.0010000000474974513,0.0012499999720603228,0.001500000013038516,0.0017500000540167093,0.0020000000949949026,0.0022499999031424522,0.0024999999441206455,0.002749999985098839,0.003000000026077032,0.0032500000670552254,0.0035000001080334187,0.003750000149011612...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [detune] All assertions passed. (total 11 assertions) 
+FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 2 tasks were failed. assert_true: expected true got false
 

Modified: trunk/Source/WebCore/ChangeLog (265980 => 265981)


--- trunk/Source/WebCore/ChangeLog	2020-08-20 23:14:05 UTC (rev 265980)
+++ trunk/Source/WebCore/ChangeLog	2020-08-20 23:15:19 UTC (rev 265981)
@@ -1,5 +1,21 @@
 2020-08-20  Chris Dumez  <cdu...@apple.com>
 
+        AudioBufferSourceNode should use "final" values for playbackRate and detune
+        https://bugs.webkit.org/show_bug.cgi?id=215669
+
+        Reviewed by Eric Carlson.
+
+        AudioBufferSourceNode should use "final" values for playbackRate and detune to take into
+        account changes to the AudioParamTimeline (for example, when
+        AudioBufferSourceNode.playbackRate.setValueAtTime() is called).
+
+        No new tests, rebaselined existing test.
+
+        * Modules/webaudio/AudioBufferSourceNode.cpp:
+        (WebCore::AudioBufferSourceNode::totalPitchRate):
+
+2020-08-20  Chris Dumez  <cdu...@apple.com>
+
         AudioParam.automationRate attribute is missing
         https://bugs.webkit.org/show_bug.cgi?id=215710
 

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (265980 => 265981)


--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp	2020-08-20 23:14:05 UTC (rev 265980)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp	2020-08-20 23:15:19 UTC (rev 265981)
@@ -510,7 +510,7 @@
         // at a sub-sample position since it will degrade the quality.
         // When aligned to the sample-frame the playback will be identical to the PCM data stored in the buffer.
         // Since playbackRate == 1 is very common, it's worth considering quality.
-        if (totalPitchRate() < 0)
+        if (playbackRate().value() < 0)
             m_virtualReadIndex = AudioUtilities::timeToSampleFrame(m_grainOffset + m_grainDuration, buffer()->sampleRate()) - 1;
         else
             m_virtualReadIndex = AudioUtilities::timeToSampleFrame(m_grainOffset, buffer()->sampleRate());
@@ -530,10 +530,10 @@
     // Normally it's not an issue because buffers are loaded at the AudioContext's sample-rate, but we can handle it in any case.
     double sampleRateFactor = 1.0;
     if (buffer())
-        sampleRateFactor = buffer()->sampleRate() / sampleRate();
+        sampleRateFactor = buffer()->sampleRate() / static_cast<double>(sampleRate());
     
-    double basePitchRate = playbackRate().value();
-    double detune = pow(2, m_detune->value() / 1200);
+    double basePitchRate = playbackRate().finalValue();
+    double detune = pow(2, m_detune->finalValue() / 1200);
 
     double totalRate = dopplerRate * sampleRateFactor * basePitchRate * detune;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to