RBJ.h
#ifndef IIR1_RBJ_H
#define IIR1_RBJ_H
#include "Common.h"
#include "Biquad.h"
#include "State.h"
namespace Iir {
#define ONESQRT2 (1/sqrt(2))
namespace RBJ {
struct DllExport RBJbase : Biquad
{
public:
template <typename Sample>
inline Sample filter(Sample s) {
return static_cast<Sample>(state.filter((double)s,*this));
}
void reset() {
state.reset();
}
const DirectFormI& getState() {
return state;
}
private:
DirectFormI state;
};
struct DllExport LowPass : RBJbase
{
void setupN(double cutoffFrequency,
double q = ONESQRT2);
void setup(double sampleRate,
double cutoffFrequency,
double q = ONESQRT2) {
setupN(cutoffFrequency / sampleRate, q);
}
};
struct DllExport HighPass : RBJbase
{
void setupN(double cutoffFrequency,
double q = ONESQRT2);
void setup (double sampleRate,
double cutoffFrequency,
double q = ONESQRT2) {
setupN(cutoffFrequency / sampleRate, q);
}
};
struct DllExport BandPass1 : RBJbase
{
void setupN(double centerFrequency,
double bandWidth);
void setup (double sampleRate,
double centerFrequency,
double bandWidth) {
setupN(centerFrequency / sampleRate, bandWidth);
}
};
struct DllExport BandPass2 : RBJbase
{
void setupN(double centerFrequency,
double bandWidth);
void setup (double sampleRate,
double centerFrequency,
double bandWidth) {
setupN(centerFrequency / sampleRate, bandWidth);
}
};
struct DllExport BandStop : RBJbase
{
void setupN(double centerFrequency,
double bandWidth);
void setup (double sampleRate,
double centerFrequency,
double bandWidth) {
setupN(centerFrequency / sampleRate, bandWidth);
}
};
struct DllExport IIRNotch : RBJbase
{
void setupN(double centerFrequency,
double q_factor = 10);
void setup (double sampleRate,
double centerFrequency,
double q_factor = 10) {
setupN(centerFrequency / sampleRate, q_factor);
}
};
struct DllExport LowShelf : RBJbase
{
void setupN(double cutoffFrequency,
double gainDb,
double shelfSlope = 1);
void setup (double sampleRate,
double cutoffFrequency,
double gainDb,
double shelfSlope = 1) {
setupN( cutoffFrequency / sampleRate, gainDb, shelfSlope);
}
};
struct DllExport HighShelf : RBJbase
{
void setupN(double cutoffFrequency,
double gainDb,
double shelfSlope = 1);
void setup (double sampleRate,
double cutoffFrequency,
double gainDb,
double shelfSlope = 1) {
setupN( cutoffFrequency / sampleRate, gainDb, shelfSlope);
}
};
struct DllExport BandShelf : RBJbase
{
void setupN(double centerFrequency,
double gainDb,
double bandWidth);
void setup (double sampleRate,
double centerFrequency,
double gainDb,
double bandWidth) {
setupN(centerFrequency / sampleRate, gainDb, bandWidth);
}
};
struct DllExport AllPass : RBJbase
{
void setupN(double phaseFrequency,
double q = ONESQRT2);
void setup (double sampleRate,
double phaseFrequency,
double q = ONESQRT2) {
setupN( phaseFrequency / sampleRate, q);
}
};
}
}
#endif
Iir::RBJ::BandShelf
Definition: RBJ.h:307
Iir::RBJ::AllPass::setup
void setup(double sampleRate, double phaseFrequency, double q=(1/sqrt(2)))
Definition: RBJ.h:352
Iir::Biquad
Definition: Biquad.h:52
Iir::RBJ::LowPass
Definition: RBJ.h:89
Iir::RBJ::AllPass
Definition: RBJ.h:336
Iir::RBJ::HighShelf
Definition: RBJ.h:278
Iir::RBJ::HighShelf::setup
void setup(double sampleRate, double cutoffFrequency, double gainDb, double shelfSlope=1)
Definition: RBJ.h:296
Iir::RBJ::BandPass2
Definition: RBJ.h:165
Iir::RBJ::LowShelf::setup
void setup(double sampleRate, double cutoffFrequency, double gainDb, double shelfSlope=1)
Definition: RBJ.h:267
Iir::RBJ::RBJbase
Definition: RBJ.h:66
Iir::DirectFormI
Definition: State.h:56
Iir::RBJ::BandStop
Definition: RBJ.h:191
Iir::RBJ::IIRNotch::setup
void setup(double sampleRate, double centerFrequency, double q_factor=10)
Definition: RBJ.h:239
Iir
Definition: Biquad.cpp:41
Iir::RBJ::LowPass::setup
void setup(double sampleRate, double cutoffFrequency, double q=(1/sqrt(2)))
Definition: RBJ.h:105
Iir::RBJ::BandShelf::setup
void setup(double sampleRate, double centerFrequency, double gainDb, double bandWidth)
Definition: RBJ.h:325
Iir::RBJ::RBJbase::getState
const DirectFormI & getState()
gets the delay lines (=state) of the filter
Definition: RBJ.h:79
Iir::RBJ::RBJbase::reset
void reset()
resets the delay lines to zero
Definition: RBJ.h:75
Iir::RBJ::LowShelf
Definition: RBJ.h:249
Iir::RBJ::HighPass
Definition: RBJ.h:115
Iir::RBJ::RBJbase::filter
Sample filter(Sample s)
filter operation
Definition: RBJ.h:71
Iir::RBJ::BandStop::setup
void setup(double sampleRate, double centerFrequency, double bandWidth)
Definition: RBJ.h:206
Iir::RBJ::IIRNotch
Definition: RBJ.h:224
Iir::RBJ::BandPass1::setup
void setup(double sampleRate, double centerFrequency, double bandWidth)
Definition: RBJ.h:155
Iir::RBJ::BandPass2::setup
void setup(double sampleRate, double centerFrequency, double bandWidth)
Definition: RBJ.h:180
Iir::RBJ::BandPass1
Definition: RBJ.h:140
Iir::RBJ::HighPass::setup
void setup(double sampleRate, double cutoffFrequency, double q=(1/sqrt(2)))
Definition: RBJ.h:130