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 ca19b338b1091abac85586456c6d1638ab53e32a..54665b17615ee4adda2d9d24f17a734bd66a6bde 100644 |
| --- a/third_party/WebKit/Source/modules/webaudio/AudioParam.h |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioParam.h |
| @@ -52,12 +52,38 @@ class AudioNodeOutput; |
| // dies. |
| class AudioParamHandler final : public ThreadSafeRefCounted<AudioParamHandler>, public AudioSummingJunction { |
| public: |
| + // Each AudioParam gets an identifier here. This is mostly for instrospection if warnings or |
|
hongchan
2016/04/29 22:22:26
I believe you're following the conversion of Audio
Raymond Toy
2016/04/29 22:39:55
That's fine with me.
Raymond Toy
2016/04/29 23:00:11
Oh, this isn't user-facing. Or at least as much u
|
| + // other messages need to be printed. It's useful to know what the AudioParam represents. The |
| + // name should include the node type and the name of the AudioParam. |
| + enum ParamType { |
| + AudioBufferSourcePlaybackRate, |
| + AudioBufferSourceDetune, |
| + BiquadFilterFrequency, |
| + BiquadFilterQ, |
| + BiquadFilterGain, |
| + BiquadFilterDetune, |
| + DelayDelayTime, |
| + DynamicsCompressorThreshold, |
| + DynamicsCompressorKnee, |
| + DynamicsCompressorRatio, |
| + DynamicsCompressorAttack, |
| + DynamicsCompressorRelease, |
| + GainGain, |
| + OscillatorFrequency, |
| + OscillatorDetune, |
| + StereoPannerPan |
|
hongchan
2016/04/29 22:22:27
Perhaps we need:
PannerPosition{X, Y, Z}
PannerOri
Raymond Toy
2016/04/29 22:39:55
Except we don't have those yet. :-)
|
| + }; |
| + |
| + ParamType getParamType() const { return m_paramType; } |
| + // Return a nice name for the AudioParam. |
| + String getParamName() const; |
| + |
| static const double DefaultSmoothingConstant; |
| static const double SnapThreshold; |
| - static PassRefPtr<AudioParamHandler> create(AbstractAudioContext& context, double defaultValue) |
| + static PassRefPtr<AudioParamHandler> create(AbstractAudioContext& context, ParamType paramType, double defaultValue) |
| { |
| - return adoptRef(new AudioParamHandler(context, defaultValue)); |
| + return adoptRef(new AudioParamHandler(context, paramType, defaultValue)); |
| } |
| // This should be used only in audio rendering thread. |
| @@ -102,8 +128,9 @@ public: |
| float intrinsicValue() const { return noBarrierLoad(&m_intrinsicValue); } |
| private: |
| - AudioParamHandler(AbstractAudioContext& context, double defaultValue) |
| + AudioParamHandler(AbstractAudioContext& context, ParamType paramType, double defaultValue) |
| : AudioSummingJunction(context.deferredTaskHandler()) |
| + , m_paramType(paramType) |
| , m_intrinsicValue(defaultValue) |
| , m_defaultValue(defaultValue) |
| , m_smoothedValue(defaultValue) |
| @@ -114,6 +141,10 @@ private: |
| void calculateFinalValues(float* values, unsigned numberOfValues, bool sampleAccurate); |
| void calculateTimelineValues(float* values, unsigned numberOfValues); |
| + // The type of AudioParam, indicating what this AudioParam represents and what node it belongs |
| + // to. Mostly for informational purposes and doesn't affect implementation. |
| + ParamType m_paramType; |
| + |
| // Intrinsic value |
| float m_intrinsicValue; |
| void setIntrinsicValue(float newValue) { noBarrierStore(&m_intrinsicValue, newValue); } |
| @@ -133,13 +164,16 @@ private: |
| class AudioParam final : public GarbageCollectedFinalized<AudioParam>, public ScriptWrappable { |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| - static AudioParam* create(AbstractAudioContext&, double defaultValue); |
| + static AudioParam* create(AbstractAudioContext&, AudioParamHandler::ParamType, double defaultValue); |
| DECLARE_TRACE(); |
| // |handler| always returns a valid object. |
| AudioParamHandler& handler() const { return *m_handler; } |
| // |context| always returns a valid object. |
| AbstractAudioContext* context() const { return m_context; } |
| + AudioParamHandler::ParamType getParamType() const { return handler().getParamType(); } |
| + String getParamName() const; |
| + |
| float value() const; |
| void setValue(float); |
| float defaultValue() const; |
| @@ -151,7 +185,7 @@ public: |
| AudioParam* cancelScheduledValues(double startTime, ExceptionState&); |
| private: |
| - AudioParam(AbstractAudioContext&, double defaultValue); |
| + AudioParam(AbstractAudioContext&, AudioParamHandler::ParamType, double defaultValue); |
| RefPtr<AudioParamHandler> m_handler; |
| Member<AbstractAudioContext> m_context; |