36 #ifndef DSPFILTERS_CASCADE_H
37 #define DSPFILTERS_CASCADE_H
43 #include "MathSupplement.h"
56 template <
class StateType>
60 template <
typename Sample>
61 inline Sample process (
const Sample in,
const Cascade& c)
64 StateType* state = m_stateArray;
65 Biquad const* stage = c.m_stageArray;
66 const double vsa = ac();
67 int i = c.m_numStages - 1;
68 out = (state++)->process1 (out, *stage++, vsa);
70 out = (state++)->process1 (out, *stage++, 0);
73 return static_cast<Sample
> (out);
78 : m_stateArray (stateArray)
83 StateType* m_stateArray;
93 : maxStages (maxStages_)
94 , stageArray (stageArray_)
102 int getNumStages ()
const
107 const Stage& operator[] (
int index)
109 assert (index >= 0 && index <= m_numStages);
110 return m_stageArray[index];
115 complex_t response (
double normalizedFrequency)
const;
117 std::vector<PoleZeroPair> getPoleZeros ()
const;
120 template <
class StateType,
typename Sample>
121 void process (
int numSamples, Sample* dest, StateType& state)
const
123 while (--numSamples >= 0)
124 *dest++ = state.process (*dest, *
this);
130 void setCascadeStorage (
const Storage& storage);
132 void applyScale (
double scale);
133 void setLayout (
const LayoutBase& proto);
144 template <
int MaxStages>
148 template <
class StateType>
160 StateType* state = m_states;
161 for (
int i = MaxStages; --i >= 0; ++state)
166 StateType m_states[MaxStages];