OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 22 matching lines...) Expand all Loading... |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 class BiquadProcessor; | 35 class BiquadProcessor; |
36 | 36 |
37 // BiquadDSPKernel is an AudioDSPKernel and is responsible for filtering one | 37 // BiquadDSPKernel is an AudioDSPKernel and is responsible for filtering one |
38 // channel of a BiquadProcessor using a Biquad object. | 38 // channel of a BiquadProcessor using a Biquad object. |
39 | 39 |
40 class BiquadDSPKernel final : public AudioDSPKernel { | 40 class BiquadDSPKernel final : public AudioDSPKernel { |
41 public: | 41 public: |
42 explicit BiquadDSPKernel(BiquadProcessor* processor) | 42 explicit BiquadDSPKernel(BiquadProcessor* processor) |
43 : AudioDSPKernel(processor) {} | 43 : AudioDSPKernel(processor), |
| 44 tail_time_(std::numeric_limits<double>::infinity()) {} |
44 | 45 |
45 // AudioDSPKernel | 46 // AudioDSPKernel |
46 void Process(const float* source, | 47 void Process(const float* source, |
47 float* dest, | 48 float* dest, |
48 size_t frames_to_process) override; | 49 size_t frames_to_process) override; |
49 void Reset() override { biquad_.Reset(); } | 50 void Reset() override { biquad_.Reset(); } |
50 | 51 |
51 // Get the magnitude and phase response of the filter at the given | 52 // Get the magnitude and phase response of the filter at the given |
52 // set of frequencies (in Hz). The phase response is in radians. | 53 // set of frequencies (in Hz). The phase response is in radians. |
53 void GetFrequencyResponse(int n_frequencies, | 54 void GetFrequencyResponse(int n_frequencies, |
(...skipping 14 matching lines...) Expand all Loading... |
68 // dezippering is used to slowly change the parameters. | 69 // dezippering is used to slowly change the parameters. |
69 void UpdateCoefficientsIfNecessary(int); | 70 void UpdateCoefficientsIfNecessary(int); |
70 // Update the biquad cofficients with the given parameters | 71 // Update the biquad cofficients with the given parameters |
71 void UpdateCoefficients(int, | 72 void UpdateCoefficients(int, |
72 const float* frequency, | 73 const float* frequency, |
73 const float* q, | 74 const float* q, |
74 const float* gain, | 75 const float* gain, |
75 const float* detune); | 76 const float* detune); |
76 | 77 |
77 private: | 78 private: |
| 79 // Compute the tail time using the BiquadFilter coefficients at |
| 80 // index |coef_index|. |
| 81 void UpdateTailTime(int coef_index); |
| 82 |
78 // Synchronize process() with getting and setting the filter coefficients. | 83 // Synchronize process() with getting and setting the filter coefficients. |
79 mutable Mutex process_lock_; | 84 mutable Mutex process_lock_; |
| 85 |
| 86 // The current tail time for biquad filter. |
| 87 double tail_time_; |
80 }; | 88 }; |
81 | 89 |
82 } // namespace blink | 90 } // namespace blink |
83 | 91 |
84 #endif // BiquadDSPKernel_h | 92 #endif // BiquadDSPKernel_h |
OLD | NEW |