ChebyshevI.h
#ifndef IIR1_CHEBYSHEVI_H
#define IIR1_CHEBYSHEVI_H
#include "Common.h"
#include "Cascade.h"
#include "PoleFilter.h"
#include "State.h"
namespace Iir {
namespace ChebyshevI {
class DllExport AnalogLowPass : public LayoutBase
{
public:
AnalogLowPass ();
void design (const int numPoles,
double rippleDb);
private:
int m_numPoles;
double m_rippleDb;
};
class DllExport AnalogLowShelf : public LayoutBase
{
public:
AnalogLowShelf ();
void design (int numPoles,
double gainDb,
double rippleDb);
private:
int m_numPoles;
double m_rippleDb;
double m_gainDb;
};
//------------------------------------------------------------------------------
struct DllExport LowPassBase : PoleFilterBase <AnalogLowPass>
{
void setup (int order,
double cutoffFrequency,
double rippleDb);
};
struct DllExport HighPassBase : PoleFilterBase <AnalogLowPass>
{
void setup (int order,
double cutoffFrequency,
double rippleDb);
};
struct DllExport BandPassBase : PoleFilterBase <AnalogLowPass>
{
void setup (int order,
double centerFrequency,
double widthFrequency,
double rippleDb);
};
struct DllExport BandStopBase : PoleFilterBase <AnalogLowPass>
{
void setup (int order,
double centerFrequency,
double widthFrequency,
double rippleDb);
};
struct DllExport LowShelfBase : PoleFilterBase <AnalogLowShelf>
{
void setup (int order,
double cutoffFrequency,
double gainDb,
double rippleDb);
};
struct DllExport HighShelfBase : PoleFilterBase <AnalogLowShelf>
{
void setup (int order,
double cutoffFrequency,
double gainDb,
double rippleDb);
};
struct DllExport BandShelfBase : PoleFilterBase <AnalogLowShelf>
{
void setup (int order,
double centerFrequency,
double widthFrequency,
double gainDb,
double rippleDb);
};
//------------------------------------------------------------------------------
//
// 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 rippleDb) {
LowPassBase::setup (FilterOrder,
cutoffFrequency / sampleRate,
rippleDb);
}
void setup (int reqOrder,
double sampleRate,
double cutoffFrequency,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
LowPassBase::setup (reqOrder,
cutoffFrequency / sampleRate,
rippleDb);
}
void setupN(double cutoffFrequency,
double rippleDb) {
LowPassBase::setup (FilterOrder,
cutoffFrequency,
rippleDb);
}
void setupN(int reqOrder,
double cutoffFrequency,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
LowPassBase::setup (reqOrder,
cutoffFrequency,
rippleDb);
}
};
template <int FilterOrder = DEFAULT_FILTER_ORDER, class StateType = DEFAULT_STATE>
struct DllExport HighPass : PoleFilter <HighPassBase, StateType, FilterOrder>
{
void setup (double sampleRate,
double cutoffFrequency,
double rippleDb) {
HighPassBase::setup (FilterOrder,
cutoffFrequency / sampleRate,
rippleDb);
}
void setup (int reqOrder,
double sampleRate,
double cutoffFrequency,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
HighPassBase::setup (reqOrder,
cutoffFrequency / sampleRate,
rippleDb);
}
void setupN(double cutoffFrequency,
double rippleDb) {
HighPassBase::setup (FilterOrder,
cutoffFrequency,
rippleDb);
}
void setupN(int reqOrder,
double cutoffFrequency,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
HighPassBase::setup (reqOrder,
cutoffFrequency,
rippleDb);
}
};
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 rippleDb) {
BandPassBase::setup (FilterOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
rippleDb);
}
void setup (int reqOrder,
double sampleRate,
double centerFrequency,
double widthFrequency,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandPassBase::setup (reqOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
rippleDb);
}
void setupN(double centerFrequency,
double widthFrequency,
double rippleDb) {
BandPassBase::setup (FilterOrder,
centerFrequency,
widthFrequency,
rippleDb);
}
void setupN(int reqOrder,
double centerFrequency,
double widthFrequency,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandPassBase::setup (reqOrder,
centerFrequency,
widthFrequency,
rippleDb);
}
};
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 rippleDb) {
BandStopBase::setup (FilterOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
rippleDb);
}
void setup (int reqOrder,
double sampleRate,
double centerFrequency,
double widthFrequency,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandStopBase::setup (reqOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
rippleDb);
}
void setupN(double centerFrequency,
double widthFrequency,
double rippleDb) {
BandStopBase::setup (FilterOrder,
centerFrequency,
widthFrequency,
rippleDb);
}
void setupN(int reqOrder,
double centerFrequency,
double widthFrequency,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandStopBase::setup (reqOrder,
centerFrequency,
widthFrequency,
rippleDb);
}
};
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 rippleDb) {
LowShelfBase::setup (FilterOrder,
cutoffFrequency / sampleRate,
gainDb,
rippleDb);
}
void setup (int reqOrder,
double sampleRate,
double cutoffFrequency,
double gainDb,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
LowShelfBase::setup (reqOrder,
cutoffFrequency / sampleRate,
gainDb,
rippleDb);
}
void setupN(double cutoffFrequency,
double gainDb,
double rippleDb) {
LowShelfBase::setup (FilterOrder,
cutoffFrequency,
gainDb,
rippleDb);
}
void setupN(int reqOrder,
double cutoffFrequency,
double gainDb,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
LowShelfBase::setup (reqOrder,
cutoffFrequency,
gainDb,
rippleDb);
}
};
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 rippleDb) {
HighShelfBase::setup (FilterOrder,
cutoffFrequency / sampleRate,
gainDb,
rippleDb);
}
void setup (int reqOrder,
double sampleRate,
double cutoffFrequency,
double gainDb,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
HighShelfBase::setup (reqOrder,
cutoffFrequency / sampleRate,
gainDb,
rippleDb);
}
void setupN(double cutoffFrequency,
double gainDb,
double rippleDb) {
HighShelfBase::setup (FilterOrder,
cutoffFrequency,
gainDb,
rippleDb);
}
void setupN(int reqOrder,
double cutoffFrequency,
double gainDb,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
HighShelfBase::setup (reqOrder,
cutoffFrequency,
gainDb,
rippleDb);
}
};
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 rippleDb) {
BandShelfBase::setup (FilterOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
gainDb,
rippleDb);
}
void setup (int reqOrder,
double sampleRate,
double centerFrequency,
double widthFrequency,
double gainDb,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandShelfBase::setup (reqOrder,
centerFrequency / sampleRate,
widthFrequency / sampleRate,
gainDb,
rippleDb);
}
void setupN(double centerFrequency,
double widthFrequency,
double gainDb,
double rippleDb) {
BandShelfBase::setup (FilterOrder,
centerFrequency,
widthFrequency,
gainDb,
rippleDb);
}
void setupN(int reqOrder,
double centerFrequency,
double widthFrequency,
double gainDb,
double rippleDb) {
if (reqOrder > FilterOrder) throw std::invalid_argument(orderTooHigh);
BandShelfBase::setup (reqOrder,
centerFrequency,
widthFrequency,
gainDb,
rippleDb);
}
};
}
}
#endif
Iir::PoleFilterBase
Definition: PoleFilter.h:89
Iir::ChebyshevI::HighPass::setup
void setup(double sampleRate, double cutoffFrequency, double rippleDb)
Definition: ChebyshevI.h:232
Iir::ChebyshevI::BandStop::setupN
void setupN(int reqOrder, double centerFrequency, double widthFrequency, double rippleDb)
Definition: ChebyshevI.h:437
Iir::ChebyshevI::HighPass
Definition: ChebyshevI.h:224
Iir::ChebyshevI::BandPass::setupN
void setupN(int reqOrder, double centerFrequency, double widthFrequency, double rippleDb)
Definition: ChebyshevI.h:356
Iir::ChebyshevI::LowShelfBase
Definition: ChebyshevI.h:118
Iir::ChebyshevI::BandPass::setup
void setup(double sampleRate, double centerFrequency, double widthFrequency, double rippleDb)
Definition: ChebyshevI.h:302
Iir::ChebyshevI::LowPassBase
Definition: ChebyshevI.h:88
Iir::ChebyshevI::BandShelf
Definition: ChebyshevI.h:620
Iir::ChebyshevI::HighShelf::setupN
void setupN(int reqOrder, double cutoffFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:601
Iir::ChebyshevI::HighShelf::setupN
void setupN(double cutoffFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:585
Iir::ChebyshevI::HighPass::setupN
void setupN(int reqOrder, double cutoffFrequency, double rippleDb)
Definition: ChebyshevI.h:277
Iir::ChebyshevI::LowPass::setupN
void setupN(int reqOrder, double cutoffFrequency, double rippleDb)
Definition: ChebyshevI.h:208
Iir::ChebyshevI::LowPass
Definition: ChebyshevI.h:155
Iir::ChebyshevI::BandStopBase
Definition: ChebyshevI.h:110
Iir::ChebyshevI::HighPassBase
Definition: ChebyshevI.h:95
Iir::ChebyshevI::LowPass::setup
void setup(int reqOrder, double sampleRate, double cutoffFrequency, double rippleDb)
Definition: ChebyshevI.h:178
Iir::ChebyshevI::BandStop
Definition: ChebyshevI.h:374
Iir::ChebyshevI::BandShelf::setup
void setup(int reqOrder, double sampleRate, double centerFrequency, double widthFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:652
Iir::ChebyshevI::LowShelf::setup
void setup(int reqOrder, double sampleRate, double cutoffFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:483
Iir::ChebyshevI::AnalogLowShelf
Definition: ChebyshevI.h:71
Iir::ChebyshevI::AnalogLowPass
Definition: ChebyshevI.h:55
Iir::PoleFilter
Definition: PoleFilter.h:112
Iir::ChebyshevI::BandPass::setupN
void setupN(double centerFrequency, double widthFrequency, double rippleDb)
Definition: ChebyshevI.h:340
Iir::ChebyshevI::BandPassBase
Definition: ChebyshevI.h:102
Iir::ChebyshevI::HighShelf::setup
void setup(int reqOrder, double sampleRate, double cutoffFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:564
Iir::ChebyshevI::LowPass::setupN
void setupN(double cutoffFrequency, double rippleDb)
Definition: ChebyshevI.h:195
Iir::ChebyshevI::BandShelfBase
Definition: ChebyshevI.h:134
Iir::ChebyshevI::HighShelf::setup
void setup(double sampleRate, double cutoffFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:546
Iir
Definition: Biquad.cpp:41
Iir::ChebyshevI::BandShelf::setupN
void setupN(double centerFrequency, double widthFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:677
Iir::ChebyshevI::HighShelf
Definition: ChebyshevI.h:537
Iir::ChebyshevI::LowShelf::setupN
void setupN(int reqOrder, double cutoffFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:519
Iir::ChebyshevI::HighPass::setup
void setup(int reqOrder, double sampleRate, double cutoffFrequency, double rippleDb)
Definition: ChebyshevI.h:247
Iir::ChebyshevI::LowPass::setup
void setup(double sampleRate, double cutoffFrequency, double rippleDb)
Definition: ChebyshevI.h:163
Iir::ChebyshevI::LowShelf::setupN
void setupN(double cutoffFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:503
Iir::ChebyshevI::BandShelf::setupN
void setupN(int reqOrder, double centerFrequency, double widthFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:697
Iir::ChebyshevI::BandStop::setup
void setup(int reqOrder, double sampleRate, double centerFrequency, double widthFrequency, double rippleDb)
Definition: ChebyshevI.h:401
Iir::LayoutBase
Definition: Layout.h:63
Iir::ChebyshevI::BandStop::setup
void setup(double sampleRate, double centerFrequency, double widthFrequency, double rippleDb)
Definition: ChebyshevI.h:383
Iir::ChebyshevI::BandShelf::setup
void setup(double sampleRate, double centerFrequency, double widthFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:630
Iir::ChebyshevI::LowShelf::setup
void setup(double sampleRate, double cutoffFrequency, double gainDb, double rippleDb)
Definition: ChebyshevI.h:465
Iir::ChebyshevI::LowShelf
Definition: ChebyshevI.h:456
Iir::ChebyshevI::BandPass::setup
void setup(int reqOrder, double sampleRate, double centerFrequency, double widthFrequency, double rippleDb)
Definition: ChebyshevI.h:320
Iir::ChebyshevI::HighShelfBase
Definition: ChebyshevI.h:126
Iir::ChebyshevI::HighPass::setupN
void setupN(double cutoffFrequency, double rippleDb)
Definition: ChebyshevI.h:264
Iir::ChebyshevI::BandStop::setupN
void setupN(double centerFrequency, double widthFrequency, double rippleDb)
Definition: ChebyshevI.h:421
Iir::ChebyshevI::BandPass
Definition: ChebyshevI.h:293