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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/audioparam-negative-exponentialRamp-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
index 2fad553577e2bc4fe97550976828c048aadfa4ba..d44d28245d1706124626ae242b34213a80b5a24c 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
@@ -410,11 +410,6 @@ float AudioParamTimeline::valuesForFrameRangeImpl(
float value1 = event.value();
double time1 = event.time();
- // If the current event is SetValue, set the default value too so that it appears as if
- // SetValue were actually run for any corner caes where we want to use the default value.
- if (event.type() == ParamEvent::SetValue)
- value = value1;
-
float value2 = nextEvent ? nextEvent->value() : value1;
double time2 = nextEvent ? nextEvent->time() : endFrame / sampleRate + 1;
@@ -472,7 +467,9 @@ float AudioParamTimeline::valuesForFrameRangeImpl(
} else if (nextEventType == ParamEvent::ExponentialRampToValue) {
if (value1 * value2 <= 0) {
// It's an error if value1 and value2 have opposite signs or if one of them is zero.
- // Handle this by propagating the previous value.
+ // Handle this by propagating the previous value, and making it the default.
+ value = value1;
+
for (; writeIndex < fillToFrame; ++writeIndex)
values[writeIndex] = value;
} else {
@@ -516,7 +513,6 @@ float AudioParamTimeline::valuesForFrameRangeImpl(
switch (event.type()) {
case ParamEvent::SetValue:
case ParamEvent::LinearRampToValue:
- case ParamEvent::ExponentialRampToValue:
{
currentFrame = fillToEndFrame;
@@ -529,6 +525,19 @@ float AudioParamTimeline::valuesForFrameRangeImpl(
break;
}
+ case ParamEvent::ExponentialRampToValue:
+ {
+ currentFrame = fillToEndFrame;
+
+ // Simply stay at a constant value from the last time. We don't want to use the
+ // value of the event in case value1 * value2 < 0. In this case we should
+ // propagate the previous value, which is in |value|.
+ for (; writeIndex < fillToFrame; ++writeIndex)
+ values[writeIndex] = value;
+
+ break;
+ }
+
case ParamEvent::SetTarget:
{
// Exponential approach to target value with given time constant.
« no previous file with comments | « third_party/WebKit/LayoutTests/webaudio/audioparam-negative-exponentialRamp-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698