Bug 1141282 - DynamicCompressorNode's readonly 'reduction' should be a float. r=ehsan

This commit is contained in:
Paul Adenot 2015-03-12 14:36:39 +01:00
parent 3f66ad9fc2
commit 3c026c91ba
4 changed files with 16 additions and 13 deletions

View File

@ -21,7 +21,6 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(DynamicsCompressorNode, AudioNode,
mThreshold,
mKnee,
mRatio,
mReduction,
mAttack,
mRelease)
@ -173,9 +172,7 @@ private:
node = static_cast<DynamicsCompressorNode*>(mStream->Engine()->Node());
}
if (node) {
AudioParam* reduction = node->Reduction();
reduction->CancelAllEvents();
reduction->SetValue(mReduction);
node->SetReduction(mReduction);
}
return NS_OK;
}
@ -207,7 +204,7 @@ DynamicsCompressorNode::DynamicsCompressorNode(AudioContext* aContext)
, 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, Callback, 0.f))
, mReduction(0)
, mAttack(new AudioParam(this, SendAttackToStream, 0.003f))
, mRelease(new AudioParam(this, SendReleaseToStream, 0.25f))
{

View File

@ -40,11 +40,6 @@ public:
return mRatio;
}
AudioParam* Reduction() const
{
return mReduction;
}
AudioParam* Attack() const
{
return mAttack;
@ -56,6 +51,11 @@ public:
return mRelease;
}
float Reduction() const
{
return mReduction;
}
virtual const char* NodeType() const MOZ_OVERRIDE
{
return "DynamicsCompressorNode";
@ -64,6 +64,12 @@ public:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
void SetReduction(float aReduction)
{
MOZ_ASSERT(NS_IsMainThread());
mReduction = aReduction;
}
protected:
virtual ~DynamicsCompressorNode();
@ -78,7 +84,7 @@ private:
nsRefPtr<AudioParam> mThreshold;
nsRefPtr<AudioParam> mKnee;
nsRefPtr<AudioParam> mRatio;
nsRefPtr<AudioParam> mReduction;
float mReduction;
nsRefPtr<AudioParam> mAttack;
nsRefPtr<AudioParam> mRelease;
};

View File

@ -41,7 +41,7 @@ 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(reduction, 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");
}

View File

@ -15,7 +15,7 @@ interface DynamicsCompressorNode : AudioNode {
readonly attribute AudioParam threshold; // in Decibels
readonly attribute AudioParam knee; // in Decibels
readonly attribute AudioParam ratio; // unit-less
readonly attribute AudioParam reduction; // in Decibels
readonly attribute float reduction; // in Decibels
readonly attribute AudioParam attack; // in Seconds
readonly attribute AudioParam release; // in Seconds