| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 #ifndef BiquadFilterNode_h | 25 #ifndef BiquadFilterNode_h |
| 26 #define BiquadFilterNode_h | 26 #define BiquadFilterNode_h |
| 27 | 27 |
| 28 #include "core/dom/DOMTypedArray.h" | 28 #include "core/dom/DOMTypedArray.h" |
| 29 #include "modules/webaudio/AudioBasicProcessorNode.h" | 29 #include "modules/webaudio/AudioBasicProcessorNode.h" |
| 30 #include "modules/webaudio/BiquadProcessor.h" | 30 #include "modules/webaudio/BiquadProcessor.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class AudioParam; | 34 class AudioParamHandler; |
| 35 | 35 |
| 36 class BiquadFilterNode final : public AudioBasicProcessorNode { | 36 class BiquadFilterNode final : public AudioBasicProcessorNode { |
| 37 DEFINE_WRAPPERTYPEINFO(); | 37 DEFINE_WRAPPERTYPEINFO(); |
| 38 public: | 38 public: |
| 39 // These must be defined as in the .idl file and must match those in the Biq
uadProcessor class. | 39 // These must be defined as in the .idl file and must match those in the Biq
uadProcessor class. |
| 40 enum { | 40 enum { |
| 41 LOWPASS = 0, | 41 LOWPASS = 0, |
| 42 HIGHPASS = 1, | 42 HIGHPASS = 1, |
| 43 BANDPASS = 2, | 43 BANDPASS = 2, |
| 44 LOWSHELF = 3, | 44 LOWSHELF = 3, |
| 45 HIGHSHELF = 4, | 45 HIGHSHELF = 4, |
| 46 PEAKING = 5, | 46 PEAKING = 5, |
| 47 NOTCH = 6, | 47 NOTCH = 6, |
| 48 ALLPASS = 7 | 48 ALLPASS = 7 |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 static BiquadFilterNode* create(AudioContext* context, float sampleRate) | 51 static BiquadFilterNode* create(AudioContext* context, float sampleRate) |
| 52 { | 52 { |
| 53 return new BiquadFilterNode(context, sampleRate); | 53 return new BiquadFilterNode(context, sampleRate); |
| 54 } | 54 } |
| 55 | 55 |
| 56 String type() const; | 56 String type() const; |
| 57 void setType(const String&); | 57 void setType(const String&); |
| 58 | 58 |
| 59 AudioParam* frequency() { return biquadProcessor()->parameter1(); } | 59 AudioParamHandler* frequency() { return biquadProcessor()->parameter1(); } |
| 60 AudioParam* q() { return biquadProcessor()->parameter2(); } | 60 AudioParamHandler* q() { return biquadProcessor()->parameter2(); } |
| 61 AudioParam* gain() { return biquadProcessor()->parameter3(); } | 61 AudioParamHandler* gain() { return biquadProcessor()->parameter3(); } |
| 62 AudioParam* detune() { return biquadProcessor()->parameter4(); } | 62 AudioParamHandler* detune() { return biquadProcessor()->parameter4(); } |
| 63 | 63 |
| 64 // Get the magnitude and phase response of the filter at the given | 64 // Get the magnitude and phase response of the filter at the given |
| 65 // set of frequencies (in Hz). The phase response is in radians. | 65 // set of frequencies (in Hz). The phase response is in radians. |
| 66 void getFrequencyResponse(const DOMFloat32Array* frequencyHz, DOMFloat32Arra
y* magResponse, DOMFloat32Array* phaseResponse); | 66 void getFrequencyResponse(const DOMFloat32Array* frequencyHz, DOMFloat32Arra
y* magResponse, DOMFloat32Array* phaseResponse); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 BiquadFilterNode(AudioContext*, float sampleRate); | 69 BiquadFilterNode(AudioContext*, float sampleRate); |
| 70 | 70 |
| 71 BiquadProcessor* biquadProcessor() { return static_cast<BiquadProcessor*>(pr
ocessor()); } | 71 BiquadProcessor* biquadProcessor() { return static_cast<BiquadProcessor*>(pr
ocessor()); } |
| 72 bool setType(unsigned); // Returns true on success. | 72 bool setType(unsigned); // Returns true on success. |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 } // namespace blink | 75 } // namespace blink |
| 76 | 76 |
| 77 #endif // BiquadFilterNode_h | 77 #endif // BiquadFilterNode_h |
| OLD | NEW |