Bug 859602 - Remove AudioParam.minValue/maxValue; r=bzbarsky
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 08 Apr 2013 21:57:54 -0400
changeset 139890 54015df3731c8530688ddf572974ea20d1d61fd1
parent 139889 913781187387e225c36fa4799721af9e3969356d
child 139891 f55d9235d5a0b67783e2d4a9abb0fa4b96e637c5
push id350
push userbbajaj@mozilla.com
push dateMon, 29 Jul 2013 23:00:49 +0000
treeherdermozilla-release@064965b37dbd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs859602
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 859602 - Remove AudioParam.minValue/maxValue; r=bzbarsky
content/media/webaudio/AudioParam.cpp
content/media/webaudio/AudioParam.h
content/media/webaudio/BiquadFilterNode.cpp
content/media/webaudio/DelayNode.cpp
content/media/webaudio/DynamicsCompressorNode.cpp
content/media/webaudio/GainNode.cpp
content/media/webaudio/test/test_biquadFilterNode.html
content/media/webaudio/test/test_delayNode.html
content/media/webaudio/test/test_dynamicsCompressorNode.html
content/media/webaudio/test/test_gainNode.html
dom/webidl/AudioParam.webidl
--- a/content/media/webaudio/AudioParam.cpp
+++ b/content/media/webaudio/AudioParam.cpp
@@ -15,29 +15,22 @@ namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(AudioParam, mNode)
 
 NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AudioParam, AddRef)
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AudioParam, Release)
 
 AudioParam::AudioParam(AudioNode* aNode,
                        AudioParam::CallbackType aCallback,
-                       float aDefaultValue,
-                       float aMinValue,
-                       float aMaxValue)
+                       float aDefaultValue)
   : AudioParamTimeline(aDefaultValue)
   , mNode(aNode)
   , mCallback(aCallback)
   , mDefaultValue(aDefaultValue)
-  , mMinValue(aMinValue)
-  , mMaxValue(aMaxValue)
 {
-  MOZ_ASSERT(aDefaultValue >= aMinValue);
-  MOZ_ASSERT(aDefaultValue <= aMaxValue);
-  MOZ_ASSERT(aMinValue < aMaxValue);
   SetIsDOMBinding();
 }
 
 AudioParam::~AudioParam()
 {
 }
 
 JSObject*
--- a/content/media/webaudio/AudioParam.h
+++ b/content/media/webaudio/AudioParam.h
@@ -29,19 +29,17 @@ class AudioParam MOZ_FINAL : public nsWr
                              public EnableWebAudioCheck,
                              public AudioParamTimeline
 {
 public:
   typedef void (*CallbackType)(AudioNode*);
 
   AudioParam(AudioNode* aNode,
              CallbackType aCallback,
-             float aDefaultValue,
-             float aMinValue,
-             float aMaxValue);
+             float aDefaultValue);
   virtual ~AudioParam();
 
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AudioParam)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AudioParam)
 
   AudioContext* GetParentObject() const
   {
     return mNode->Context();
@@ -91,36 +89,24 @@ public:
     mCallback(mNode);
   }
   void CancelScheduledValues(double aStartTime)
   {
     AudioParamTimeline::CancelScheduledValues(aStartTime);
     mCallback(mNode);
   }
 
-  float MinValue() const
-  {
-    return mMinValue;
-  }
-
-  float MaxValue() const
-  {
-    return mMaxValue;
-  }
-
   float DefaultValue() const
   {
     return mDefaultValue;
   }
 
 private:
   nsRefPtr<AudioNode> mNode;
   CallbackType mCallback;
   const float mDefaultValue;
-  const float mMinValue;
-  const float mMaxValue;
 };
 
 }
 }
 
 #endif
 
--- a/content/media/webaudio/BiquadFilterNode.cpp
+++ b/content/media/webaudio/BiquadFilterNode.cpp
@@ -91,28 +91,22 @@ private:
   AudioNodeStream* mSource;
   AudioNodeStream* mDestination;
   BiquadTypeEnum mType;
   AudioParamTimeline mFrequency;
   AudioParamTimeline mQ;
   AudioParamTimeline mGain;
 };
 
-static float
-Nyquist(AudioContext* aContext)
-{
-  return 0.5f * aContext->SampleRate();
-}
-
 BiquadFilterNode::BiquadFilterNode(AudioContext* aContext)
   : AudioNode(aContext)
   , mType(BiquadTypeEnum::LOWPASS)
-  , mFrequency(new AudioParam(this, SendFrequencyToStream, 350.f, 10.f, Nyquist(aContext)))
-  , mQ(new AudioParam(this, SendQToStream, 1.f, 0.0001f, 1000.f))
-  , mGain(new AudioParam(this, SendGainToStream, 0.f, -40.f, 40.f))
+  , mFrequency(new AudioParam(this, SendFrequencyToStream, 350.f))
+  , mQ(new AudioParam(this, SendQToStream, 1.f))
+  , mGain(new AudioParam(this, SendGainToStream, 0.f))
 {
   BiquadFilterNodeEngine* engine = new BiquadFilterNodeEngine(aContext->Destination());
   mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
   engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
 }
 
 BiquadFilterNode::~BiquadFilterNode()
 {
--- a/content/media/webaudio/DelayNode.cpp
+++ b/content/media/webaudio/DelayNode.cpp
@@ -196,17 +196,17 @@ public:
   // given the current delay.
   uint32_t mWriteIndex;
   // Current delay time, in seconds
   double mCurrentDelayTime;
 };
 
 DelayNode::DelayNode(AudioContext* aContext, double aMaxDelay)
   : AudioNode(aContext)
-  , mDelay(new AudioParam(this, SendDelayToStream, 0.0f, 0.0f, float(aMaxDelay)))
+  , mDelay(new AudioParam(this, SendDelayToStream, 0.0f))
 {
   DelayNodeEngine* engine = new DelayNodeEngine(aContext->Destination());
   mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
   engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
   AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
   ns->SetDoubleParameter(DelayNodeEngine::MAX_DELAY, aMaxDelay);
 }
 
--- a/content/media/webaudio/DynamicsCompressorNode.cpp
+++ b/content/media/webaudio/DynamicsCompressorNode.cpp
@@ -108,22 +108,22 @@ private:
   AudioParamTimeline mRatio;
   AudioParamTimeline mReduction;
   AudioParamTimeline mAttack;
   AudioParamTimeline mRelease;
 };
 
 DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext)
   : AudioNode(aContext)
-  , mThreshold(new AudioParam(this, SendThresholdToStream, -24.f, -100.f, 0.f))
-  , mKnee(new AudioParam(this, SendKneeToStream, 30.f, 0.f, 40.f))
-  , mRatio(new AudioParam(this, SendRatioToStream, 12.f, 1.f, 20.f))
-  , mReduction(new AudioParam(this, SendReductionToStream, 0.f, -20.f, 0.f))
-  , mAttack(new AudioParam(this, SendAttackToStream, 0.003f, 0.f, 1.f))
-  , mRelease(new AudioParam(this, SendReleaseToStream, 0.25f, 0.f, 1.f))
+  , mThreshold(new AudioParam(this, SendThresholdToStream, -24.f))
+  , mKnee(new AudioParam(this, SendKneeToStream, 30.f))
+  , mRatio(new AudioParam(this, SendRatioToStream, 12.f))
+  , mReduction(new AudioParam(this, SendReductionToStream, 0.f))
+  , mAttack(new AudioParam(this, SendAttackToStream, 0.003f))
+  , mRelease(new AudioParam(this, SendReleaseToStream, 0.25f))
 {
   DynamicsCompressorNodeEngine* engine = new DynamicsCompressorNodeEngine(aContext->Destination());
   mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
   engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
 }
 
 DynamicsCompressorNode::~DynamicsCompressorNode()
 {
--- a/content/media/webaudio/GainNode.cpp
+++ b/content/media/webaudio/GainNode.cpp
@@ -90,17 +90,17 @@ public:
 
   AudioNodeStream* mSource;
   AudioNodeStream* mDestination;
   AudioParamTimeline mGain;
 };
 
 GainNode::GainNode(AudioContext* aContext)
   : AudioNode(aContext)
-  , mGain(new AudioParam(this, SendGainToStream, 1.0f, 0.0f, 1.0f))
+  , mGain(new AudioParam(this, SendGainToStream, 1.0f))
 {
   GainNodeEngine* engine = new GainNodeEngine(aContext->Destination());
   mStream = aContext->Graph()->CreateAudioNodeStream(engine, MediaStreamGraph::INTERNAL_STREAM);
   engine->SetSourceStream(static_cast<AudioNodeStream*> (mStream.get()));
 }
 
 GainNode::~GainNode()
 {
--- a/content/media/webaudio/test/test_biquadFilterNode.html
+++ b/content/media/webaudio/test/test_biquadFilterNode.html
@@ -32,24 +32,18 @@ addLoadEvent(function() {
 
   source.buffer = buffer;
 
   source.connect(filter);
   filter.connect(destination);
 
   // Verify default values
   is(filter.type, 0, "Correct default value for type");
-  near(filter.frequency.minValue, 10, "Correct min value for filter frequency");
-  near(filter.frequency.maxValue, context.sampleRate/2, "Correct max value for filter frequency");
   near(filter.frequency.defaultValue, 350, "Correct default value for filter frequency");
-  near(filter.Q.minValue, 0.001, "Correct min value for filter Q");
-  near(filter.Q.maxValue, 1000, "Correct max value for filter Q");
   near(filter.Q.defaultValue, 1, "Correct default value for filter Q");
-  near(filter.gain.minValue, -40, "Correct min value for filter gain");
-  near(filter.gain.maxValue, 40, "Correct max value for filter gain");
   near(filter.gain.defaultValue, 0, "Correct default value for filter gain");
 
   // Make sure that we can set all of the valid type values
   for (var i = 0; i <= 7; ++i) {
     filter.type = i;
   }
 
   expectException(function() {
--- a/content/media/webaudio/test/test_delayNode.html
+++ b/content/media/webaudio/test/test_delayNode.html
@@ -29,34 +29,26 @@ addLoadEvent(function() {
   source.buffer = buffer;
 
   source.connect(delay);
   delay.connect(destination);
 
   ok(delay.delayTime, "The audioparam member must exist");
   is(delay.delayTime.value, 0, "Correct initial value");
   is(delay.delayTime.defaultValue, 0, "Correct default value");
-  is(delay.delayTime.minValue, 0, "Correct min value");
-  is(delay.delayTime.maxValue, 1.0, "Correct max value");
   delay.delayTime.value = 0.5;
   is(delay.delayTime.value, 0.5, "Correct initial value");
   is(delay.delayTime.defaultValue, 0, "Correct default value");
-  is(delay.delayTime.minValue, 0, "Correct min value");
-  is(delay.delayTime.maxValue, 1.0, "Correct max value");
 
   var delay2 = context.createDelay(2);
   is(delay2.delayTime.value, 0, "Correct initial value");
   is(delay2.delayTime.defaultValue, 0, "Correct default value");
-  is(delay2.delayTime.minValue, 0, "Correct min value");
-  is(delay2.delayTime.maxValue, 2.0, "Correct max value");
   delay2.delayTime.value = 0.5;
   is(delay2.delayTime.value, 0.5, "Correct initial value");
   is(delay2.delayTime.defaultValue, 0, "Correct default value");
-  is(delay2.delayTime.minValue, 0, "Correct min value");
-  is(delay2.delayTime.maxValue, 2.0, "Correct max value");
 
   expectException(function() {
     context.createDelay(0);
   }, DOMException.NOT_SUPPORTED_ERR);
   expectException(function() {
     context.createDelay(180);
   }, DOMException.NOT_SUPPORTED_ERR);
   expectTypeError(function() {
--- a/content/media/webaudio/test/test_dynamicsCompressorNode.html
+++ b/content/media/webaudio/test/test_dynamicsCompressorNode.html
@@ -39,32 +39,16 @@ addLoadEvent(function() {
     near(threshold.defaultValue, -24, "Correct default value for threshold");
     near(knee.defaultValue, 30, "Correct default value for knee");
     near(ratio.defaultValue, 12, "Correct default value for ratio");
     near(reduction.defaultValue, 0, "Correct default value for reduction");
     near(attack.defaultValue, 0.003, "Correct default value for attack");
     near(release.defaultValue, 0.25, "Correct default value for release");
   }
 
-  // Verify min/max values
-  with (compressor) {
-    near(threshold.minValue, -100, "Correct min value for threshold");
-    near(knee.minValue, 0, "Correct min value for knee");
-    near(ratio.minValue, 1, "Correct min value for ratio");
-    near(reduction.minValue, -20, "Correct min value for reduction");
-    near(attack.minValue, 0, "Correct min value for attack");
-    near(release.minValue, 0, "Correct min value for release");
-    near(threshold.maxValue, 0, "Correct max value for threshold");
-    near(knee.maxValue, 40, "Correct max value for knee");
-    near(ratio.maxValue, 20, "Correct max value for ratio");
-    near(reduction.maxValue, 0, "Correct max value for reduction");
-    near(attack.maxValue, 1, "Correct max value for attack");
-    near(release.maxValue, 1, "Correct max value for release");
-  }
-
   source.start(0);
   SimpleTest.executeSoon(function() {
     source.stop(0);
     source.disconnect();
     compressor.disconnect();
 
     SpecialPowers.clearUserPref("media.webaudio.enabled");
     SimpleTest.finish();
--- a/content/media/webaudio/test/test_gainNode.html
+++ b/content/media/webaudio/test/test_gainNode.html
@@ -28,23 +28,19 @@ addLoadEvent(function() {
   source.buffer = buffer;
 
   source.connect(gain);
   gain.connect(destination);
 
   ok(gain.gain, "The audioparam member must exist");
   is(gain.gain.value, 1.0, "Correct initial value");
   is(gain.gain.defaultValue, 1.0, "Correct default value");
-  is(gain.gain.minValue, 0, "Correct min value");
-  is(gain.gain.maxValue, 1.0, "Correct max value");
   gain.gain.value = 0.5;
   is(gain.gain.value, 0.5, "Correct initial value");
   is(gain.gain.defaultValue, 1.0, "Correct default value");
-  is(gain.gain.minValue, 0, "Correct min value");
-  is(gain.gain.maxValue, 1.0, "Correct max value");
 
   source.start(0);
   SimpleTest.executeSoon(function() {
     source.stop(0);
     source.disconnect();
     gain.disconnect();
 
     SpecialPowers.clearUserPref("media.webaudio.enabled");
--- a/dom/webidl/AudioParam.webidl
+++ b/dom/webidl/AudioParam.webidl
@@ -9,19 +9,16 @@
  * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
  * liability, trademark and document use rules apply.
  */
 
 [PrefControlled]
 interface AudioParam {
 
     attribute float value;
-    // readonly attribute float computedValue;
-    readonly attribute float minValue;
-    readonly attribute float maxValue;
     readonly attribute float defaultValue;
 
     // Parameter automation. 
     [Throws]
     void setValueAtTime(float value, double startTime);
     [Throws]
     void linearRampToValueAtTime(float value, double endTime);
     [Throws]