Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(857)

Unified Diff: third_party/WebKit/Source/modules/webaudio/IIRProcessor.h

Issue 1361233004: Implement IIRFilter node for WebAudio. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update according to review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/IIRProcessor.h
diff --git a/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h
new file mode 100644
index 0000000000000000000000000000000000000000..599a9c67c8855c23e61ac26d98be134e3e8547be
--- /dev/null
+++ b/third_party/WebKit/Source/modules/webaudio/IIRProcessor.h
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IIRProcessor_h
+#define IIRProcessor_h
+
+#include "modules/webaudio/AudioNode.h"
+#include "platform/audio/AudioDSPKernel.h"
+#include "platform/audio/AudioDSPKernelProcessor.h"
+#include "platform/audio/IIRFilter.h"
+
+namespace blink {
+
+class IIRDSPKernel;
+
+class IIRProcessor final : public AudioDSPKernelProcessor {
+public:
+ IIRProcessor(float sampleRate, size_t numberOfChannels,
+ const Vector<float>& feedforwardCoef, const Vector<float>& feedbackCoef);
+ ~IIRProcessor() override;
+
+ PassOwnPtr<AudioDSPKernel> createKernel() override;
+
+ void process(const AudioBus* source, AudioBus* destination, size_t framesToProcess) override;
+
+ // Get the magnitude and phase response of the filter at the given
+ // set of frequencies (in Hz). The phase response is in radians.
+ void getFrequencyResponse(int nFrequencies, const float* frequencyHz, float* magResponse, float* phaseResponse);
+
+ AudioFloatArray* feedback() { return &m_feedback; }
+ AudioFloatArray* feedforward() { return &m_feedforward; }
+private:
+ // The feedback and feedforward filter coefficients for the IIR filter.
+ AudioFloatArray m_feedback;
+ AudioFloatArray m_feedforward;
+ // This holds the IIR kernel for computing the frequency response.
+ OwnPtr<IIRDSPKernel> m_responseKernel;
+};
+
+} // blink
+
+#endif // IIRProcessor_h

Powered by Google App Engine
This is Rietveld 408576698