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

Side by Side Diff: third_party/WebKit/Source/platform/audio/IIRFilter.h

Issue 2851873003: Compute the tail time for an IIRFilter from its coefficients (Closed)
Patch Set: Rebase Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 IIRFilter_h 5 #ifndef IIRFilter_h
6 #define IIRFilter_h 6 #define IIRFilter_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/audio/AudioArray.h" 9 #include "platform/audio/AudioArray.h"
10 #include "platform/wtf/Vector.h" 10 #include "platform/wtf/Vector.h"
(...skipping 12 matching lines...) Expand all
23 23
24 void Process(const float* source_p, float* dest_p, size_t frames_to_process); 24 void Process(const float* source_p, float* dest_p, size_t frames_to_process);
25 25
26 void Reset(); 26 void Reset();
27 27
28 void GetFrequencyResponse(int n_frequencies, 28 void GetFrequencyResponse(int n_frequencies,
29 const float* frequency, 29 const float* frequency,
30 float* mag_response, 30 float* mag_response,
31 float* phase_response); 31 float* phase_response);
32 32
33 // Compute the tail time of the IIR filter
34 double TailTime(double sample_rate);
35
36 // Reset the internal state of the IIR filter to the initial state.
37 void ResetState();
38
33 private: 39 private:
34 // Filter memory 40 // Filter memory
35 // 41 //
36 // For simplicity, we assume |m_xBuffer| and |m_yBuffer| have the same length, 42 // For simplicity, we assume |m_xBuffer| and |m_yBuffer| have the same length,
37 // and the length is a power of two. Since the number of coefficients has a 43 // and the length is a power of two. Since the number of coefficients has a
38 // fixed upper length, the size of xBuffer and yBuffer is fixed. |m_xBuffer| 44 // fixed upper length, the size of xBuffer and yBuffer is fixed. |m_xBuffer|
39 // holds the old input values and |m_yBuffer| holds the old output values 45 // holds the old input values and |m_yBuffer| holds the old output values
40 // needed to compute the new output value. 46 // needed to compute the new output value.
41 // 47 //
42 // m_yBuffer[m_bufferIndex] holds the most recent output value, say, y[n]. 48 // m_yBuffer[m_bufferIndex] holds the most recent output value, say, y[n].
(...skipping 11 matching lines...) Expand all
54 60
55 // Coefficients of the IIR filter. To minimize storage, these point to the 61 // Coefficients of the IIR filter. To minimize storage, these point to the
56 // arrays given in the constructor. 62 // arrays given in the constructor.
57 const AudioDoubleArray* feedback_; 63 const AudioDoubleArray* feedback_;
58 const AudioDoubleArray* feedforward_; 64 const AudioDoubleArray* feedforward_;
59 }; 65 };
60 66
61 } // namespace blink 67 } // namespace blink
62 68
63 #endif // IIRFilter_h 69 #endif // IIRFilter_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/IIRDSPKernel.cpp ('k') | third_party/WebKit/Source/platform/audio/IIRFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698