void Cascade::setLayout (const LayoutBase& proto) { const int numPoles = proto.getNumPoles(); m_numStages = (numPoles + 1)/ 2; assert (m_numStages <= m_maxStages); Biquad* stage = m_stageArray; for (int i = 0; i < m_numStages; ++i, ++stage) stage->setPoleZeroPair (proto[i]); applyScale (proto.getNormalGain() / std::abs (response (proto.getNormalW() / (2 * doublePi)))); }
void Cascade::setLayout (const LayoutBase& proto) { const int numPoles = proto.getNumPoles(); m_numStages = (numPoles + 1)/ 2; if (m_numStages > m_maxStages) throw std::invalid_argument("Number of stages is larger than the max stages."); Biquad* stage = m_stageArray; for (int i = 0; i < m_numStages; ++i, ++stage) stage->setPoleZeroPair (proto[i]); applyScale (proto.getNormalGain() / std::abs (response (proto.getNormalW() / (2 * doublePi)))); }