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 #ifndef IIRDSPKernel_h | 5 #ifndef IIRDSPKernel_h |
6 #define IIRDSPKernel_h | 6 #define IIRDSPKernel_h |
7 | 7 |
8 #include "modules/webaudio/IIRProcessor.h" | 8 #include "modules/webaudio/IIRProcessor.h" |
9 #include "platform/audio/AudioDSPKernel.h" | 9 #include "platform/audio/AudioDSPKernel.h" |
10 #include "platform/audio/IIRFilter.h" | 10 #include "platform/audio/IIRFilter.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class IIRProcessor; | 14 class IIRProcessor; |
15 | 15 |
16 class IIRDSPKernel final : public AudioDSPKernel { | 16 class IIRDSPKernel final : public AudioDSPKernel { |
17 public: | 17 public: |
18 explicit IIRDSPKernel(IIRProcessor* processor) | 18 explicit IIRDSPKernel(IIRProcessor*); |
19 : AudioDSPKernel(processor), | |
20 iir_(processor->Feedforward(), processor->Feedback()) {} | |
21 | 19 |
22 // AudioDSPKernel | 20 // AudioDSPKernel |
23 void Process(const float* source, | 21 void Process(const float* source, |
24 float* dest, | 22 float* dest, |
25 size_t frames_to_process) override; | 23 size_t frames_to_process) override; |
26 void Reset() override { iir_.Reset(); } | 24 void Reset() override { iir_.Reset(); } |
27 | 25 |
28 // Get the magnitude and phase response of the filter at the given | 26 // Get the magnitude and phase response of the filter at the given |
29 // set of frequencies (in Hz). The phase response is in radians. | 27 // set of frequencies (in Hz). The phase response is in radians. |
30 void GetFrequencyResponse(int n_frequencies, | 28 void GetFrequencyResponse(int n_frequencies, |
31 const float* frequency_hz, | 29 const float* frequency_hz, |
32 float* mag_response, | 30 float* mag_response, |
33 float* phase_response); | 31 float* phase_response); |
34 | 32 |
35 double TailTime() const override; | 33 double TailTime() const override; |
36 double LatencyTime() const override; | 34 double LatencyTime() const override; |
37 | 35 |
38 protected: | 36 protected: |
39 IIRFilter iir_; | 37 IIRFilter iir_; |
| 38 |
| 39 private: |
| 40 double tail_time_; |
40 }; | 41 }; |
41 | 42 |
42 } // namespace blink | 43 } // namespace blink |
43 | 44 |
44 #endif // IIRDSPKernel_h | 45 #endif // IIRDSPKernel_h |
OLD | NEW |