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 17 matching lines...) Expand all Loading... |
28 #include "platform/audio/AudioDSPKernel.h" | 28 #include "platform/audio/AudioDSPKernel.h" |
29 #include "platform/audio/Biquad.h" | 29 #include "platform/audio/Biquad.h" |
30 #include "modules/webaudio/BiquadProcessor.h" | 30 #include "modules/webaudio/BiquadProcessor.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 class BiquadProcessor; | 34 class BiquadProcessor; |
35 | 35 |
36 // BiquadDSPKernel is an AudioDSPKernel and is responsible for filtering one cha
nnel of a BiquadProcessor using a Biquad object. | 36 // BiquadDSPKernel is an AudioDSPKernel and is responsible for filtering one cha
nnel of a BiquadProcessor using a Biquad object. |
37 | 37 |
38 class BiquadDSPKernel : public AudioDSPKernel { | 38 class BiquadDSPKernel FINAL : public AudioDSPKernel { |
39 public: | 39 public: |
40 explicit BiquadDSPKernel(BiquadProcessor* processor) | 40 explicit BiquadDSPKernel(BiquadProcessor* processor) |
41 : AudioDSPKernel(processor) | 41 : AudioDSPKernel(processor) |
42 { | 42 { |
43 } | 43 } |
44 | 44 |
45 // AudioDSPKernel | 45 // AudioDSPKernel |
46 virtual void process(const float* source, float* dest, size_t framesToProces
s); | 46 virtual void process(const float* source, float* dest, size_t framesToProces
s) OVERRIDE; |
47 virtual void reset() { m_biquad.reset(); } | 47 virtual void reset() OVERRIDE { m_biquad.reset(); } |
48 | 48 |
49 // Get the magnitude and phase response of the filter at the given | 49 // Get the magnitude and phase response of the filter at the given |
50 // set of frequencies (in Hz). The phase response is in radians. | 50 // set of frequencies (in Hz). The phase response is in radians. |
51 void getFrequencyResponse(int nFrequencies, | 51 void getFrequencyResponse(int nFrequencies, |
52 const float* frequencyHz, | 52 const float* frequencyHz, |
53 float* magResponse, | 53 float* magResponse, |
54 float* phaseResponse); | 54 float* phaseResponse); |
55 | 55 |
56 virtual double tailTime() const OVERRIDE; | 56 virtual double tailTime() const OVERRIDE; |
57 virtual double latencyTime() const OVERRIDE; | 57 virtual double latencyTime() const OVERRIDE; |
58 | 58 |
59 protected: | 59 protected: |
60 Biquad m_biquad; | 60 Biquad m_biquad; |
61 BiquadProcessor* biquadProcessor() { return static_cast<BiquadProcessor*>(pr
ocessor()); } | 61 BiquadProcessor* biquadProcessor() { return static_cast<BiquadProcessor*>(pr
ocessor()); } |
62 | 62 |
63 // To prevent audio glitches when parameters are changed, | 63 // To prevent audio glitches when parameters are changed, |
64 // dezippering is used to slowly change the parameters. | 64 // dezippering is used to slowly change the parameters. |
65 // |useSmoothing| implies that we want to update using the | 65 // |useSmoothing| implies that we want to update using the |
66 // smoothed values. Otherwise the final target values are | 66 // smoothed values. Otherwise the final target values are |
67 // used. If |forceUpdate| is true, we update the coefficients even | 67 // used. If |forceUpdate| is true, we update the coefficients even |
68 // if they are not dirty. (Used when computing the frequency | 68 // if they are not dirty. (Used when computing the frequency |
69 // response.) | 69 // response.) |
70 void updateCoefficientsIfNecessary(bool useSmoothing, bool forceUpdate); | 70 void updateCoefficientsIfNecessary(bool useSmoothing, bool forceUpdate); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace WebCore | 73 } // namespace WebCore |
74 | 74 |
75 #endif // BiquadDSPKernel_h | 75 #endif // BiquadDSPKernel_h |
OLD | NEW |