Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webaudio/AudioParam.h |
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParam.h b/third_party/WebKit/Source/modules/webaudio/AudioParam.h |
| index dd000e52002d243411e779fa44af09c838e23993..18137f8c975c3b90509180a303efd85ff5527807 100644 |
| --- a/third_party/WebKit/Source/modules/webaudio/AudioParam.h |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioParam.h |
| @@ -81,9 +81,14 @@ public: |
| static const double DefaultSmoothingConstant; |
| static const double SnapThreshold; |
| - static PassRefPtr<AudioParamHandler> create(AbstractAudioContext& context, AudioParamType paramType, double defaultValue) |
| + static PassRefPtr<AudioParamHandler> create( |
| + AbstractAudioContext& context, |
| + AudioParamType paramType, |
| + double defaultValue, |
| + float min, |
| + float max) |
|
hongchan
2016/05/13 01:30:15
Even for internal variables - I suggest we should
Raymond Toy
2016/05/13 18:40:32
Done.
|
| { |
| - return adoptRef(new AudioParamHandler(context, paramType, defaultValue)); |
| + return adoptRef(new AudioParamHandler(context, paramType, defaultValue, min, max)); |
|
hongchan
2016/05/13 01:30:15
Ditto.
Raymond Toy
2016/05/13 18:40:32
Done.
|
| } |
| // This should be used only in audio rendering thread. |
| @@ -103,6 +108,8 @@ public: |
| float finalValue(); |
| float defaultValue() const { return static_cast<float>(m_defaultValue); } |
| + float minValue() const { return m_minValue; } |
| + float maxValue() const { return m_maxValue; } |
| // Value smoothing: |
| @@ -128,7 +135,9 @@ public: |
| float intrinsicValue() const { return noBarrierLoad(&m_intrinsicValue); } |
| private: |
| - AudioParamHandler(AbstractAudioContext&, AudioParamType, double defaultValue); |
| + AudioParamHandler(AbstractAudioContext&, AudioParamType, double defaultValue, float min, float max); |
| + |
| + void warnIfOutsideRange(float value, float minValue, float maxValue); |
| // sampleAccurate corresponds to a-rate (audio rate) vs. k-rate in the Web Audio specification. |
| void calculateFinalValues(float* values, unsigned numberOfValues, bool sampleAccurate); |
| @@ -140,10 +149,14 @@ private: |
| // Intrinsic value |
| float m_intrinsicValue; |
| - void setIntrinsicValue(float newValue) { noBarrierStore(&m_intrinsicValue, newValue); } |
| + void setIntrinsicValue(float newValue); |
| float m_defaultValue; |
| + // Nominal range for the value |
| + float m_minValue; |
| + float m_maxValue; |
| + |
| // Smoothing (de-zippering) |
| float m_smoothedValue; |
| @@ -158,6 +171,8 @@ class AudioParam final : public GarbageCollectedFinalized<AudioParam>, public Sc |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| static AudioParam* create(AbstractAudioContext&, AudioParamType, double defaultValue); |
| + static AudioParam* create(AbstractAudioContext&, AudioParamType, double defaultValue, float min, float max); |
|
hongchan
2016/05/13 01:30:15
Here as well.
Raymond Toy
2016/05/13 18:40:32
Done.
|
| + |
| DECLARE_TRACE(); |
| // |handler| always returns a valid object. |
| AudioParamHandler& handler() const { return *m_handler; } |
| @@ -170,6 +185,10 @@ public: |
| float value() const; |
| void setValue(float); |
| float defaultValue() const; |
| + |
| + float minValue() const; |
| + float maxValue() const; |
| + |
| AudioParam* setValueAtTime(float value, double time, ExceptionState&); |
| AudioParam* linearRampToValueAtTime(float value, double time, ExceptionState&); |
| AudioParam* exponentialRampToValueAtTime(float value, double time, ExceptionState&); |
| @@ -178,7 +197,9 @@ public: |
| AudioParam* cancelScheduledValues(double startTime, ExceptionState&); |
| private: |
| - AudioParam(AbstractAudioContext&, AudioParamType, double defaultValue); |
| + AudioParam(AbstractAudioContext&, AudioParamType, double defaultValue, float min, float max); |
|
hongchan
2016/05/13 01:30:15
Ditto.
Raymond Toy
2016/05/13 18:40:32
Done.
|
| + |
| + void warnIfOutsideRange(float value, float minValue, float maxValue); |
| RefPtr<AudioParamHandler> m_handler; |
| Member<AbstractAudioContext> m_context; |