| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webaudio/IIRDSPKernel.h" | 5 #include "modules/webaudio/IIRDSPKernel.h" |
| 6 | 6 |
| 7 #include "platform/FloatConversion.h" | 7 #include "platform/FloatConversion.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 void IIRDSPKernel::process(const float* source, float* destination, size_t frame
sToProcess) | 11 void IIRDSPKernel::process(const float* source, float* destination, size_t frame
sToProcess) |
| 12 { | 12 { |
| 13 ASSERT(source); | 13 DCHECK(source); |
| 14 ASSERT(destination); | 14 DCHECK(destination); |
| 15 | 15 |
| 16 m_iir.process(source, destination, framesToProcess); | 16 m_iir.process(source, destination, framesToProcess); |
| 17 } | 17 } |
| 18 | 18 |
| 19 void IIRDSPKernel::getFrequencyResponse(int nFrequencies, const float* frequency
Hz, float* magResponse, float* phaseResponse) | 19 void IIRDSPKernel::getFrequencyResponse(int nFrequencies, const float* frequency
Hz, float* magResponse, float* phaseResponse) |
| 20 { | 20 { |
| 21 bool isGood = nFrequencies > 0 && frequencyHz && magResponse && phaseRespons
e; | 21 bool isGood = nFrequencies > 0 && frequencyHz && magResponse && phaseRespons
e; |
| 22 ASSERT(isGood); | 22 DCHECK(isGood); |
| 23 if (!isGood) | 23 if (!isGood) |
| 24 return; | 24 return; |
| 25 | 25 |
| 26 Vector<float> frequency(nFrequencies); | 26 Vector<float> frequency(nFrequencies); |
| 27 | 27 |
| 28 double nyquist = this->nyquist(); | 28 double nyquist = this->nyquist(); |
| 29 | 29 |
| 30 // Convert from frequency in Hz to normalized frequency (0 -> 1), | 30 // Convert from frequency in Hz to normalized frequency (0 -> 1), |
| 31 // with 1 equal to the Nyquist frequency. | 31 // with 1 equal to the Nyquist frequency. |
| 32 for (int k = 0; k < nFrequencies; ++k) | 32 for (int k = 0; k < nFrequencies; ++k) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 45 // no constraint on the IIR filter that it be stable.) | 45 // no constraint on the IIR filter that it be stable.) |
| 46 return std::numeric_limits<double>::infinity(); | 46 return std::numeric_limits<double>::infinity(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 double IIRDSPKernel::latencyTime() const | 49 double IIRDSPKernel::latencyTime() const |
| 50 { | 50 { |
| 51 return 0; | 51 return 0; |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace blink | 54 } // namespace blink |
| OLD | NEW |