MCPcopy Create free account
hub / github.com/LabSound/LabSound / process

Method process

src/internal/src/Biquad.cpp:27–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25Biquad::~Biquad() { }
26
27void Biquad::process(const float * sourceP, float * destP, int framesToProcess)
28{
29 int n = framesToProcess;
30
31 // Biquad needs to be double precision at 48khz for frequencies less than 500Hz
32 // according to multiple references.
33
34 // Create local copies of member variables
35 double x1 = m_x1;
36 double x2 = m_x2;
37 double y1 = m_y1;
38 double y2 = m_y2;
39
40 double b0 = m_b0;
41 double b1 = m_b1;
42 double b2 = m_b2;
43 double a1 = m_a1;
44 double a2 = m_a2;
45
46 while (n--)
47 {
48 float x = *sourceP++;
49 float y = static_cast<float>(b0 * x + b1 * x1 + b2 * x2 - a1 * y1 - a2 * y2);
50
51 *destP++ = y;
52
53 // Update state variables
54 x2 = x1;
55 x1 = x;
56 y2 = y1;
57 y1 = y;
58 }
59
60 m_x1 = x1;// DenormalDisabler::flushDenormalFloatToZero(x1);
61 m_x2 = x2;// DenormalDisabler::flushDenormalFloatToZero(x2);
62 m_y1 = y1;// DenormalDisabler::flushDenormalFloatToZero(y1);
63 m_y2 = y2;// DenormalDisabler::flushDenormalFloatToZero(y2);
64
65 m_b0 = b0;
66 m_b1 = b1;
67 m_b2 = b2;
68 m_a1 = a1;
69 m_a2 = a2;
70}
71
72void Biquad::reset()
73{

Callers 1

panMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected