Index: third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp b/third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp |
index e3e38525c1180bde57f2924d1d8a47e2a44ee4cd..1a86b092464bdc402539a792804fda5a1390af41 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp |
@@ -8,6 +8,12 @@ |
namespace blink { |
+IIRDSPKernel::IIRDSPKernel(IIRProcessor* processor) |
+ : AudioDSPKernel(processor), |
+ iir_(processor->Feedforward(), processor->Feedback()) { |
+ tail_time_ = iir_.TailTime(processor->SampleRate()); |
+} |
+ |
void IIRDSPKernel::Process(const float* source, |
float* destination, |
size_t frames_to_process) { |
@@ -41,14 +47,7 @@ void IIRDSPKernel::GetFrequencyResponse(int n_frequencies, |
} |
double IIRDSPKernel::TailTime() const { |
- // TODO(rtoy): This is true mathematically (infinite impulse response), but |
- // perhaps it should be limited to a smaller value, possibly based on the |
- // actual filter coefficients. To do that, we would probably need to find the |
- // pole, r, with largest magnitude and select some threshold, eps, such that |
- // |r|^n < eps for all n >= N. N is then the tailTime for the filter. If the |
- // the magnitude of r is greater than or equal to 1, the infinity is the right |
- // answer. (There is no constraint on the IIR filter that it be stable.) |
- return std::numeric_limits<double>::infinity(); |
+ return tail_time_; |
} |
double IIRDSPKernel::LatencyTime() const { |