Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/audioparam-negative-exponentialRamp.html

Issue 1561483004: Correctly propagate end value for exponential ramp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/audioparam-negative-exponentialRamp-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../resources/js-test.js"></script> 4 <script src="../resources/js-test.js"></script>
5 <script src="resources/compatibility.js"></script> 5 <script src="resources/compatibility.js"></script>
6 <script src="resources/audio-testing.js"></script> 6 <script src="resources/audio-testing.js"></script>
7 <title>Test Negative AudioParam.exponentialRampToValueAtTime</title> 7 <title>Test Negative AudioParam.exponentialRampToValueAtTime</title>
8 </head> 8 </head>
9 9
10 <body> 10 <body>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 source.start(); 104 source.start();
105 105
106 context.startRendering().then(function (resultBuffer) { 106 context.startRendering().then(function (resultBuffer) {
107 var actual = resultBuffer.getChannelData(0); 107 var actual = resultBuffer.getChannelData(0);
108 108
109 Should("Exponential ramp from -1 to 1", actual) 109 Should("Exponential ramp from -1 to 1", actual)
110 .beConstantValueOf(-1); 110 .beConstantValueOf(-1);
111 }).then(done); 111 }).then(done);
112 }); 112 });
113 113
114 audit.defineTask("propagate", function (done) {
115 // Test propagation of ramp if the exponential ramp start and end values have opposite sign.
116 var renderDuration = 0.125;
117 var linearRampEnd = renderDuration / 4;
118 var exponentialRampEnd = renderDuration / 2;
119
120 var context = new OfflineAudioContext(1, renderDuration * sampleRate, sa mpleRate);
121 var source = context.createBufferSource();
122 source.buffer = createConstantBuffer(context, 1, 1);
123 source.loop = true;
124
125 var g = context.createGain();
126
127 g.gain.setValueAtTime(2, 0);
128 g.gain.linearRampToValueAtTime(-1, linearRampEnd);
129 g.gain.exponentialRampToValueAtTime(1, exponentialRampEnd);
130
131 source.connect(g)
132 .connect(context.destination);
133 source.start();
134
135 context.startRendering().then(function (resultBuffer) {
136 var actual = resultBuffer.getChannelData(0);
137
138 // Since the start value of the exponential ramp is -1 and the end val ue is 1, the ramp
139 // should just propagate -1 from the end of the linear ramp "forever".
140 var endFrame = Math.ceil(linearRampEnd * sampleRate);
141 Should("Exponential ramp from -1 to 1 after the end of the linear ramp ",
142 actual.slice(endFrame))
143 .beConstantValueOf(-1);
144 }).then(done);
145
146 });
147
114 audit.defineTask("finish", function (done) { 148 audit.defineTask("finish", function (done) {
115 finishJSTest(); 149 finishJSTest();
116 done(); 150 done();
117 }); 151 });
118 152
119 audit.runTasks(); 153 audit.runTasks();
120 </script> 154 </script>
121 </body> 155 </body>
122 </html> 156 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webaudio/audioparam-negative-exponentialRamp-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698