OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IIRProcessor_h |
| 6 #define IIRProcessor_h |
| 7 |
| 8 #include "modules/webaudio/AudioNode.h" |
| 9 #include "platform/audio/AudioDSPKernel.h" |
| 10 #include "platform/audio/AudioDSPKernelProcessor.h" |
| 11 #include "platform/audio/IIRFilter.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class IIRDSPKernel; |
| 16 |
| 17 class IIRProcessor final : public AudioDSPKernelProcessor { |
| 18 public: |
| 19 IIRProcessor(float sampleRate, size_t numberOfChannels, |
| 20 const Vector<double>& feedforwardCoef, const Vector<double>& feedbackCoe
f); |
| 21 ~IIRProcessor() override; |
| 22 |
| 23 PassOwnPtr<AudioDSPKernel> createKernel() override; |
| 24 |
| 25 void process(const AudioBus* source, AudioBus* destination, size_t framesToP
rocess) override; |
| 26 |
| 27 // Get the magnitude and phase response of the filter at the given |
| 28 // set of frequencies (in Hz). The phase response is in radians. |
| 29 void getFrequencyResponse(int nFrequencies, const float* frequencyHz, float*
magResponse, float* phaseResponse); |
| 30 |
| 31 AudioDoubleArray* feedback() { return &m_feedback; } |
| 32 AudioDoubleArray* feedforward() { return &m_feedforward; } |
| 33 |
| 34 private: |
| 35 // The feedback and feedforward filter coefficients for the IIR filter. |
| 36 AudioDoubleArray m_feedback; |
| 37 AudioDoubleArray m_feedforward; |
| 38 // This holds the IIR kernel for computing the frequency response. |
| 39 OwnPtr<IIRDSPKernel> m_responseKernel; |
| 40 }; |
| 41 |
| 42 } // namespace blink |
| 43 |
| 44 #endif // IIRProcessor_h |
OLD | NEW |