ChebyshevII.h
#ifndef IIR1_CHEBYSHEVII_H
#define IIR1_CHEBYSHEVII_H
#include "Common.h"
#include "Cascade.h"
#include "PoleFilter.h"
#include "State.h"
namespace Iir {
namespace ChebyshevII {
class DllExport AnalogLowPass : public LayoutBase
{
public:
AnalogLowPass ();
void design (const int numPoles,
double stopBandDb);
private:
int m_numPoles;
double m_stopBandDb;
};
class DllExport AnalogLowShelf : public LayoutBase
{
public:
AnalogLowShelf ();
void design (int numPoles,
double gainDb,
double stopBandDb);
private:
int m_numPoles;
double m_stopBandDb;
double m_gainDb;
};
//------------------------------------------------------------------------------
struct DllExport LowPassBase : PoleFilterBase <AnalogLowPass>
{
void setup (int order,
double cutoffFrequency,
double stopBandDb);
};
struct DllExport HighPassBase : PoleFilterBase <AnalogLowPass>
{
void setup (int order,
double cutoffFrequency,
double stopBandDb);
};
struct DllExport BandPassBase : PoleFilterBase <AnalogLowPass>
{
void setup (int order,
double centerFrequency,
double widthFrequency,
double stopBandDb);
};
struct DllExport BandStopBase : PoleFilterBase <AnalogLowPass>
{
void setup (int order,
double centerFrequency,
double widthFrequency,
double stopBandDb);
};
struct DllExport LowShelfBase : PoleFilterBase <AnalogLowShelf>
{
void setup (int order,
double cutoffFrequency,
double gainDb,
double stopBandDb);
};
struct DllExport HighShelfBase : PoleFilterBase <AnalogLowShelf>
{
void setup (int order,
double cutoffFrequency,
double gainDb,
double stopBandDb);
};
struct DllExport BandShelfBase : PoleFilterBase <AnalogLowShelf>
{
void setup (int order,
double centerFrequency,
double widthFrequency,
double gainDb,
double stopBandDb);
};
//------------------------------------------------------------------------------
//
// Userland filters
//
template <int FilterOrder = DEFAULT_FILTER_ORDER, class StateType = DEFAULT_STATE>
struct DllExport LowPass : PoleFilter <LowPassBase, StateType, FilterOrder>
{
void setup (double sampleRate,
double cutoffFrequency,
double stopBandDb) {
LowPassBase::setup (FilterOrder,
cutoffFrequency / sampleRate,
stopBandDb);
}
void setup (int reqOrder,
double sampleRate,
double cutoffFrequency,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
LowPassBase::setup (reqOrder,
cutoffFrequency / sampleRate,
stopBandDb);
}
void setupN(double cutoffFrequency,
double stopBandDb) {
LowPassBase::setup (FilterOrder,
cutoffFrequency,
stopBandDb);
}
void setupN(int reqOrder,
double cutoffFrequency,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
LowPassBase::setup (reqOrder,
cutoffFrequency,
stopBandDb);
}
};
template <int FilterOrder = DEFAULT_FILTER_ORDER, class StateType = DEFAULT_STATE>
struct DllExport HighPass : PoleFilter <HighPassBase, StateType, FilterOrder>
{
void setup (double sampleRate,
double cutoffFrequency,
double stopBandDb) {
HighPassBase::setup (FilterOrder,
cutoffFrequency / sampleRate,
stopBandDb);
}
void setup (int reqOrder,
double sampleRate,
double cutoffFrequency,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
HighPassBase::setup (reqOrder,
cutoffFrequency / sampleRate,
stopBandDb);
}
void setupN(double cutoffFrequency,
double stopBandDb) {
HighPassBase::setup (FilterOrder,
cutoffFrequency,
stopBandDb);
}
void setupN(int reqOrder,
double cutoffFrequency,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
HighPassBase::setup (reqOrder,
cutoffFrequency,
stopBandDb);
}
};
template <int FilterOrder = DEFAULT_FILTER_ORDER, class StateType = DEFAULT_STATE>
struct DllExport BandPass : PoleFilter <BandPassBase, StateType, FilterOrder, FilterOrder*2>
{
void setup (double sampleRate,
double centerFrequency,
double widthFrequency,
double stopBandDb) {
BandPassBase::setup (FilterOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
stopBandDb);
}
void setup (int reqOrder,
double sampleRate,
double centerFrequency,
double widthFrequency,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandPassBase::setup (reqOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
stopBandDb);
}
void setupN(double centerFrequency,
double widthFrequency,
double stopBandDb) {
BandPassBase::setup (FilterOrder,
centerFrequency,
widthFrequency,
stopBandDb);
}
void setupN(int reqOrder,
double centerFrequency,
double widthFrequency,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandPassBase::setup (reqOrder,
centerFrequency,
widthFrequency,
stopBandDb);
}
};
template <int FilterOrder = DEFAULT_FILTER_ORDER, class StateType = DEFAULT_STATE>
struct DllExport BandStop : PoleFilter <BandStopBase, StateType, FilterOrder, FilterOrder*2>
{
void setup (double sampleRate,
double centerFrequency,
double widthFrequency,
double stopBandDb) {
BandStopBase::setup (FilterOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
stopBandDb);
}
void setup (int reqOrder,
double sampleRate,
double centerFrequency,
double widthFrequency,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandStopBase::setup (reqOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
stopBandDb);
}
void setupN(double centerFrequency,
double widthFrequency,
double stopBandDb) {
BandStopBase::setup (FilterOrder,
centerFrequency,
widthFrequency,
stopBandDb);
}
void setupN(int reqOrder,
double centerFrequency,
double widthFrequency,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandStopBase::setup (reqOrder,
centerFrequency,
widthFrequency,
stopBandDb);
}
};
template <int FilterOrder = DEFAULT_FILTER_ORDER, class StateType = DEFAULT_STATE>
struct DllExport LowShelf : PoleFilter <LowShelfBase, StateType, FilterOrder>
{
void setup (double sampleRate,
double cutoffFrequency,
double gainDb,
double stopBandDb) {
LowShelfBase::setup (FilterOrder,
cutoffFrequency / sampleRate,
gainDb,
stopBandDb);
}
void setup (int reqOrder,
double sampleRate,
double cutoffFrequency,
double gainDb,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
LowShelfBase::setup (reqOrder,
cutoffFrequency / sampleRate,
gainDb,
stopBandDb);
}
void setupN(double cutoffFrequency,
double gainDb,
double stopBandDb) {
LowShelfBase::setup (FilterOrder,
cutoffFrequency,
gainDb,
stopBandDb);
}
void setupN(int reqOrder,
double cutoffFrequency,
double gainDb,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
LowShelfBase::setup (reqOrder,
cutoffFrequency,
gainDb,
stopBandDb);
}
};
template <int FilterOrder = DEFAULT_FILTER_ORDER, class StateType = DEFAULT_STATE>
struct DllExport HighShelf : PoleFilter <HighShelfBase, StateType, FilterOrder>
{
void setup (double sampleRate,
double cutoffFrequency,
double gainDb,
double stopBandDb) {
HighShelfBase::setup (FilterOrder,
cutoffFrequency / sampleRate,
gainDb,
stopBandDb);
}
void setup (int reqOrder,
double sampleRate,
double cutoffFrequency,
double gainDb,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
HighShelfBase::setup (reqOrder,
cutoffFrequency / sampleRate,
gainDb,
stopBandDb);
}
void setupN(double cutoffFrequency,
double gainDb,
double stopBandDb) {
HighShelfBase::setup (FilterOrder,
cutoffFrequency,
gainDb,
stopBandDb);
}
void setupN(int reqOrder,
double cutoffFrequency,
double gainDb,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
HighShelfBase::setup (reqOrder,
cutoffFrequency,
gainDb,
stopBandDb);
}
};
template <int FilterOrder = DEFAULT_FILTER_ORDER, class StateType = DEFAULT_STATE>
struct DllExport BandShelf : PoleFilter <BandShelfBase, StateType, FilterOrder, FilterOrder*2>
{
void setup (double sampleRate,
double centerFrequency,
double widthFrequency,
double gainDb,
double stopBandDb) {
BandShelfBase::setup (FilterOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
gainDb,
stopBandDb);
}
void setup (int reqOrder,
double sampleRate,
double centerFrequency,
double widthFrequency,
double gainDb,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandShelfBase::setup (reqOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
gainDb,
stopBandDb);
}
void setupN(double centerFrequency,
double widthFrequency,
double gainDb,
double stopBandDb) {
BandShelfBase::setup (FilterOrder,
centerFrequency,
widthFrequency,
gainDb,
stopBandDb);
}
void setupN(int reqOrder,
double centerFrequency,
double widthFrequency,
double gainDb,
double stopBandDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandShelfBase::setup (reqOrder,
centerFrequency,
widthFrequency,
gainDb,
stopBandDb);
}
};
}
}
#endif
Iir::PoleFilterBase
Definition: PoleFilter.h:89
Iir::ChebyshevII::BandShelf
Definition: ChebyshevII.h:635
Iir::ChebyshevII::LowShelf::setupN
void setupN(double cutoffFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:515
Iir::ChebyshevII::LowPassBase
Definition: ChebyshevII.h:92
Iir::ChebyshevII::BandStopBase
Definition: ChebyshevII.h:114
Iir::ChebyshevII::LowShelf::setup
void setup(double sampleRate, double cutoffFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:475
Iir::ChebyshevII::HighPass::setup
void setup(double sampleRate, double cutoffFrequency, double stopBandDb)
Definition: ChebyshevII.h:239
Iir::ChebyshevII::BandPass
Definition: ChebyshevII.h:302
Iir::ChebyshevII::LowShelf::setup
void setup(int reqOrder, double sampleRate, double cutoffFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:493
Iir::ChebyshevII::HighPassBase
Definition: ChebyshevII.h:99
Iir::ChebyshevII::BandPassBase
Definition: ChebyshevII.h:106
Iir::ChebyshevII::AnalogLowShelf
Definition: ChebyshevII.h:75
Iir::ChebyshevII::HighPass::setupN
void setupN(int reqOrder, double cutoffFrequency, double stopBandDb)
Definition: ChebyshevII.h:285
Iir::ChebyshevII::BandStop::setupN
void setupN(double centerFrequency, double widthFrequency, double stopBandDb)
Definition: ChebyshevII.h:432
Iir::ChebyshevII::LowShelf
Definition: ChebyshevII.h:466
Iir::ChebyshevII::BandStop::setup
void setup(int reqOrder, double sampleRate, double centerFrequency, double widthFrequency, double stopBandDb)
Definition: ChebyshevII.h:411
Iir::ChebyshevII::BandPass::setupN
void setupN(int reqOrder, double centerFrequency, double widthFrequency, double stopBandDb)
Definition: ChebyshevII.h:366
Iir::ChebyshevII::HighShelf::setupN
void setupN(int reqOrder, double cutoffFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:616
Iir::ChebyshevII::HighShelf::setupN
void setupN(double cutoffFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:600
Iir::ChebyshevII::BandPass::setupN
void setupN(double centerFrequency, double widthFrequency, double stopBandDb)
Definition: ChebyshevII.h:350
Iir::ChebyshevII::HighPass::setup
void setup(int reqOrder, double sampleRate, double cutoffFrequency, double stopBandDb)
Definition: ChebyshevII.h:254
Iir::ChebyshevII::BandShelf::setupN
void setupN(double centerFrequency, double widthFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:694
Iir::ChebyshevII::HighShelf::setup
void setup(double sampleRate, double cutoffFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:559
Iir::ChebyshevII::LowPass
Definition: ChebyshevII.h:159
Iir::ChebyshevII::HighShelf
Definition: ChebyshevII.h:550
Iir::PoleFilter
Definition: PoleFilter.h:112
Iir::ChebyshevII::HighShelf::setup
void setup(int reqOrder, double sampleRate, double cutoffFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:577
Iir::ChebyshevII::BandPass::setup
void setup(double sampleRate, double centerFrequency, double widthFrequency, double stopBandDb)
Definition: ChebyshevII.h:311
Iir::ChebyshevII::BandStop
Definition: ChebyshevII.h:384
Iir
Definition: Biquad.cpp:41
Iir::ChebyshevII::BandPass::setup
void setup(int reqOrder, double sampleRate, double centerFrequency, double widthFrequency, double stopBandDb)
Definition: ChebyshevII.h:329
Iir::ChebyshevII::AnalogLowPass
Definition: ChebyshevII.h:58
Iir::ChebyshevII::LowShelf::setupN
void setupN(int reqOrder, double cutoffFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:531
Iir::LayoutBase
Definition: Layout.h:63
Iir::ChebyshevII::LowPass::setup
void setup(int reqOrder, double sampleRate, double cutoffFrequency, double stopBandDb)
Definition: ChebyshevII.h:182
Iir::ChebyshevII::BandShelfBase
Definition: ChebyshevII.h:138
Iir::ChebyshevII::BandStop::setup
void setup(double sampleRate, double centerFrequency, double widthFrequency, double stopBandDb)
Definition: ChebyshevII.h:393
Iir::ChebyshevII::LowPass::setupN
void setupN(int reqOrder, double cutoffFrequency, double stopBandDb)
Definition: ChebyshevII.h:214
Iir::ChebyshevII::LowPass::setupN
void setupN(double cutoffFrequency, double stopBandDb)
Definition: ChebyshevII.h:201
Iir::ChebyshevII::HighPass::setupN
void setupN(double cutoffFrequency, double stopBandDb)
Definition: ChebyshevII.h:272
Iir::ChebyshevII::BandShelf::setup
void setup(int reqOrder, double sampleRate, double centerFrequency, double widthFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:667
Iir::ChebyshevII::BandShelf::setupN
void setupN(int reqOrder, double centerFrequency, double widthFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:714
Iir::ChebyshevII::LowPass::setup
void setup(double sampleRate, double cutoffFrequency, double stopBandDb)
Definition: ChebyshevII.h:167
Iir::ChebyshevII::BandShelf::setup
void setup(double sampleRate, double centerFrequency, double widthFrequency, double gainDb, double stopBandDb)
Definition: ChebyshevII.h:645
Iir::ChebyshevII::HighShelfBase
Definition: ChebyshevII.h:130
Iir::ChebyshevII::HighPass
Definition: ChebyshevII.h:231
Iir::ChebyshevII::BandStop::setupN
void setupN(int reqOrder, double centerFrequency, double widthFrequency, double stopBandDb)
Definition: ChebyshevII.h:448
Iir::ChebyshevII::LowShelfBase
Definition: ChebyshevII.h:122