| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "platform/FloatConversion.h" | 35 #include "platform/FloatConversion.h" |
| 36 #include "wtf/MathExtras.h" | 36 #include "wtf/MathExtras.h" |
| 37 #include <algorithm> | 37 #include <algorithm> |
| 38 | 38 |
| 39 using namespace std; | 39 using namespace std; |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 void AudioParamTimeline::setValueAtTime(float value, double time) | 43 void AudioParamTimeline::setValueAtTime(float value, double time) |
| 44 { | 44 { |
| 45 insertEvent(ParamEvent(ParamEvent::SetValue, value, time, 0, 0, 0)); | 45 insertEvent(ParamEvent(ParamEvent::SetValue, value, time, 0, 0, nullptr)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void AudioParamTimeline::linearRampToValueAtTime(float value, double time) | 48 void AudioParamTimeline::linearRampToValueAtTime(float value, double time) |
| 49 { | 49 { |
| 50 insertEvent(ParamEvent(ParamEvent::LinearRampToValue, value, time, 0, 0, 0))
; | 50 insertEvent(ParamEvent(ParamEvent::LinearRampToValue, value, time, 0, 0, nul
lptr)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void AudioParamTimeline::exponentialRampToValueAtTime(float value, double time,
ExceptionState& exceptionState) | 53 void AudioParamTimeline::exponentialRampToValueAtTime(float value, double time,
ExceptionState& exceptionState) |
| 54 { | 54 { |
| 55 ASSERT(isMainThread()); | 55 ASSERT(isMainThread()); |
| 56 if (value <= 0) { | 56 if (value <= 0) { |
| 57 exceptionState.throwDOMException( | 57 exceptionState.throwDOMException( |
| 58 InvalidStateError, | 58 InvalidStateError, |
| 59 "Target value for exponential ramp must be positive: " + String::num
ber(value)); | 59 "Target value for exponential ramp must be positive: " + String::num
ber(value)); |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 | 62 |
| 63 insertEvent(ParamEvent(ParamEvent::ExponentialRampToValue, value, time, 0, 0
, 0)); | 63 insertEvent(ParamEvent(ParamEvent::ExponentialRampToValue, value, time, 0, 0
, nullptr)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void AudioParamTimeline::setTargetAtTime(float target, double time, double timeC
onstant) | 66 void AudioParamTimeline::setTargetAtTime(float target, double time, double timeC
onstant) |
| 67 { | 67 { |
| 68 insertEvent(ParamEvent(ParamEvent::SetTarget, target, time, timeConstant, 0,
0)); | 68 insertEvent(ParamEvent(ParamEvent::SetTarget, target, time, timeConstant, 0,
nullptr)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void AudioParamTimeline::setValueCurveAtTime(Float32Array* curve, double time, d
ouble duration) | 71 void AudioParamTimeline::setValueCurveAtTime(Float32Array* curve, double time, d
ouble duration) |
| 72 { | 72 { |
| 73 insertEvent(ParamEvent(ParamEvent::SetValueCurve, 0, time, 0, duration, curv
e)); | 73 insertEvent(ParamEvent(ParamEvent::SetValueCurve, 0, time, 0, duration, curv
e)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 static bool isValidNumber(float x) | 76 static bool isValidNumber(float x) |
| 77 { | 77 { |
| 78 return !std::isnan(x) && !std::isinf(x); | 78 return !std::isnan(x) && !std::isinf(x); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // to the end of the values buffer. | 374 // to the end of the values buffer. |
| 375 for (; writeIndex < numberOfValues; ++writeIndex) | 375 for (; writeIndex < numberOfValues; ++writeIndex) |
| 376 values[writeIndex] = value; | 376 values[writeIndex] = value; |
| 377 | 377 |
| 378 return value; | 378 return value; |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace WebCore | 381 } // namespace WebCore |
| 382 | 382 |
| 383 #endif // ENABLE(WEB_AUDIO) | 383 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |