Chromium Code Reviews| 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..3abcc72ffb0b1de2a4fa53e33eabff78734a8053 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; |
| - |
|
Raymond Toy
2016/01/06 22:05:02
I think this is actually incorrect and was just a
|
| float value2 = nextEvent ? nextEvent->value() : value1; |
| double time2 = nextEvent ? nextEvent->time() : endFrame / sampleRate + 1; |
| @@ -473,6 +468,9 @@ float AudioParamTimeline::valuesForFrameRangeImpl( |
| 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. |
| + if (writeIndex < fillToFrame) |
| + value = value1; |
| + |
| for (; writeIndex < fillToFrame; ++writeIndex) |
| values[writeIndex] = value; |
| } else { |
| @@ -516,7 +514,6 @@ float AudioParamTimeline::valuesForFrameRangeImpl( |
| switch (event.type()) { |
| case ParamEvent::SetValue: |
| case ParamEvent::LinearRampToValue: |
| - case ParamEvent::ExponentialRampToValue: |
| { |
| currentFrame = fillToEndFrame; |
| @@ -529,6 +526,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 that 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. |