Index: third_party/WebKit/Source/platform/audio/Biquad.cpp |
diff --git a/third_party/WebKit/Source/platform/audio/Biquad.cpp b/third_party/WebKit/Source/platform/audio/Biquad.cpp |
index 0931d56a6b645c14f287f2ddb24f50df365b7fd3..889299fb6a060458156dfaf028e027316e9d04d2 100644 |
--- a/third_party/WebKit/Source/platform/audio/Biquad.cpp |
+++ b/third_party/WebKit/Source/platform/audio/Biquad.cpp |
@@ -37,6 +37,7 @@ |
#include "wtf/MathExtras.h" |
#include <algorithm> |
+#include <complex> |
Raymond Toy
2015/12/17 19:45:55
Why is <complex> needed now?
Daniel Bratell
2015/12/17 22:58:19
It should always have been there but luckily someo
|
#include <stdio.h> |
#if OS(MACOSX) |
@@ -275,7 +276,7 @@ void Biquad::reset() |
void Biquad::setLowpassParams(int index, double cutoff, double resonance) |
{ |
// Limit cutoff to 0 to 1. |
- cutoff = std::max(0.0, std::min(cutoff, 1.0)); |
+ cutoff = clampTo(cutoff, 0.0, 1.0); |
if (cutoff == 1) { |
// When cutoff is 1, the z-transform is 1. |
@@ -313,7 +314,7 @@ void Biquad::setLowpassParams(int index, double cutoff, double resonance) |
void Biquad::setHighpassParams(int index, double cutoff, double resonance) |
{ |
// Limit cutoff to 0 to 1. |
- cutoff = std::max(0.0, std::min(cutoff, 1.0)); |
+ cutoff = clampTo(cutoff, 0.0, 1.0); |
if (cutoff == 1) { |
// The z-transform is 0. |
@@ -377,7 +378,7 @@ void Biquad::setNormalizedCoefficients(int index, double b0, double b1, double b |
void Biquad::setLowShelfParams(int index, double frequency, double dbGain) |
{ |
// Clip frequencies to between 0 and 1, inclusive. |
- frequency = std::max(0.0, std::min(frequency, 1.0)); |
+ frequency = clampTo(frequency, 0.0, 1.0); |
double A = pow(10.0, dbGain / 40); |
@@ -414,7 +415,7 @@ void Biquad::setLowShelfParams(int index, double frequency, double dbGain) |
void Biquad::setHighShelfParams(int index, double frequency, double dbGain) |
{ |
// Clip frequencies to between 0 and 1, inclusive. |
- frequency = std::max(0.0, std::min(frequency, 1.0)); |
+ frequency = clampTo(frequency, 0.0, 1.0); |
double A = pow(10.0, dbGain / 40); |
@@ -453,7 +454,7 @@ void Biquad::setHighShelfParams(int index, double frequency, double dbGain) |
void Biquad::setPeakingParams(int index, double frequency, double Q, double dbGain) |
{ |
// Clip frequencies to between 0 and 1, inclusive. |
- frequency = std::max(0.0, std::min(frequency, 1.0)); |
+ frequency = clampTo(frequency, 0.0, 1.0); |
// Don't let Q go negative, which causes an unstable filter. |
Q = std::max(0.0, Q); |
@@ -495,7 +496,7 @@ void Biquad::setPeakingParams(int index, double frequency, double Q, double dbGa |
void Biquad::setAllpassParams(int index, double frequency, double Q) |
{ |
// Clip frequencies to between 0 and 1, inclusive. |
- frequency = std::max(0.0, std::min(frequency, 1.0)); |
+ frequency = clampTo(frequency, 0.0, 1.0); |
// Don't let Q go negative, which causes an unstable filter. |
Q = std::max(0.0, Q); |
@@ -535,7 +536,7 @@ void Biquad::setAllpassParams(int index, double frequency, double Q) |
void Biquad::setNotchParams(int index, double frequency, double Q) |
{ |
// Clip frequencies to between 0 and 1, inclusive. |
- frequency = std::max(0.0, std::min(frequency, 1.0)); |
+ frequency = clampTo(frequency, 0.0, 1.0); |
// Don't let Q go negative, which causes an unstable filter. |
Q = std::max(0.0, Q); |