Implement eqN_type and the shelving EQs
This commit is contained in:
parent
74f7290556
commit
abfd4e401f
15 changed files with 942 additions and 33 deletions
|
|
@ -63,7 +63,7 @@ for f in \
|
|||
Lsh Hsh Peq \
|
||||
Pink \
|
||||
Lpf2pSv Hpf2pSv Bpf2pSv Brf2pSv \
|
||||
Eq
|
||||
EqPeak EqLshelf EqHshelf
|
||||
do
|
||||
faustgen "$f"
|
||||
faustgen "2ch$f"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
#include "Config.h"
|
||||
#include "Defaults.h"
|
||||
#include "SfzFilter.h"
|
||||
#include "CCMap.h"
|
||||
|
||||
namespace sfz
|
||||
|
|
@ -18,6 +19,7 @@ struct EQDescription
|
|||
float gain { Default::eqGain };
|
||||
float vel2frequency { Default::eqVel2frequency };
|
||||
float vel2gain { Default::eqVel2gain };
|
||||
EqType type { EqType::kEqPeak };
|
||||
CCMap<float> bandwidthCC { Default::eqBandwidthCC };
|
||||
CCMap<float> frequencyCC { Default::eqFrequencyCC };
|
||||
CCMap<float> gainCC { Default::eqGainCC };
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ void sfz::EQHolder::reset()
|
|||
|
||||
void sfz::EQHolder::setup(const EQDescription& description, unsigned numChannels, uint8_t velocity)
|
||||
{
|
||||
eq.setType(description.type);
|
||||
eq.setChannels(numChannels);
|
||||
this->description = &description;
|
||||
const auto normalizedVelocity = normalizeVelocity(velocity);
|
||||
|
|
|
|||
|
|
@ -621,6 +621,25 @@ bool sfz::Region::parseOpcode(const Opcode& opcode)
|
|||
setValueFromOpcode(opcode, equalizers[eqNumber - 1].vel2gain, Default::eqGainModRange);
|
||||
}
|
||||
break;
|
||||
case hash("eq&_type"):
|
||||
{
|
||||
const auto eqNumber = opcode.parameters.front();
|
||||
if (eqNumber == 0)
|
||||
return false;
|
||||
if (!extendIfNecessary(equalizers, eqNumber, Default::numEQs))
|
||||
return false;
|
||||
|
||||
switch (hash(opcode.value)) {
|
||||
case hash("peak"): equalizers[eqNumber - 1].type = EqType::kEqPeak; break;
|
||||
case hash("lshelf"): equalizers[eqNumber - 1].type = EqType::kEqLowShelf; break;
|
||||
case hash("hshelf"): equalizers[eqNumber - 1].type = EqType::kEqHighShelf; break;
|
||||
default:
|
||||
equalizers[eqNumber - 1].type = EqType::kEqNone;
|
||||
DBG("Unknown EQ type: " << std::string(opcode.value));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
// Performance parameters: pitch
|
||||
case hash("pitch_keycenter"):
|
||||
setValueFromOpcode(opcode, pitchKeycenter, Default::keyRange);
|
||||
|
|
|
|||
|
|
@ -263,13 +263,24 @@ sfzFilterDsp *Filter::Impl::getDsp(unsigned channels, FilterType type)
|
|||
|
||||
|
||||
struct FilterEq::Impl {
|
||||
EqType fType = kEqNone;
|
||||
unsigned fChannels = 1;
|
||||
enum { maxChannels = 2 };
|
||||
|
||||
sfzEq fDsp;
|
||||
sfz2chEq fDsp2ch;
|
||||
sfzEqPeak fDspPeak;
|
||||
sfzEqLshelf fDspLshelf;
|
||||
sfzEqHshelf fDspHshelf;
|
||||
|
||||
sfzFilterDsp *getDsp(unsigned channels);
|
||||
sfz2chEqPeak fDsp2chPeak;
|
||||
sfz2chEqLshelf fDsp2chLshelf;
|
||||
sfz2chEqHshelf fDsp2chHshelf;
|
||||
|
||||
sfzFilterDsp *getDsp(unsigned channels, EqType type);
|
||||
|
||||
static constexpr uint32_t idDsp(unsigned channels, EqType type)
|
||||
{
|
||||
return static_cast<unsigned>(type)|(channels << 16);
|
||||
}
|
||||
};
|
||||
|
||||
FilterEq::FilterEq()
|
||||
|
|
@ -284,14 +295,17 @@ FilterEq::~FilterEq()
|
|||
void FilterEq::init(double sampleRate)
|
||||
{
|
||||
for (unsigned channels = 1; channels <= Impl::maxChannels; ++channels) {
|
||||
sfzFilterDsp *dsp = P->getDsp(channels);
|
||||
dsp->init(sampleRate);
|
||||
EqType ftype = static_cast<EqType>(1);
|
||||
while (sfzFilterDsp *dsp = P->getDsp(channels, ftype)) {
|
||||
dsp->init(sampleRate);
|
||||
ftype = static_cast<EqType>(static_cast<int>(ftype) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FilterEq::clear()
|
||||
{
|
||||
sfzFilterDsp *dsp = P->getDsp(P->fChannels);
|
||||
sfzFilterDsp *dsp = P->getDsp(P->fChannels, P->fType);
|
||||
|
||||
if (dsp)
|
||||
dsp->instanceClear();
|
||||
|
|
@ -299,7 +313,7 @@ void FilterEq::clear()
|
|||
|
||||
void FilterEq::prepare(float cutoff, float bw, float pksh)
|
||||
{
|
||||
sfzFilterDsp *dsp = P->getDsp(P->fChannels);
|
||||
sfzFilterDsp *dsp = P->getDsp(P->fChannels, P->fType);
|
||||
|
||||
if (!dsp)
|
||||
return;
|
||||
|
|
@ -323,7 +337,7 @@ void FilterEq::prepare(float cutoff, float bw, float pksh)
|
|||
void FilterEq::process(const float *const in[], float *const out[], float cutoff, float bw, float pksh, unsigned nframes)
|
||||
{
|
||||
unsigned channels = P->fChannels;
|
||||
sfzFilterDsp *dsp = P->getDsp(channels);
|
||||
sfzFilterDsp *dsp = P->getDsp(channels, P->fType);
|
||||
|
||||
if (!dsp) {
|
||||
for (unsigned c = 0; c < channels; ++c)
|
||||
|
|
@ -338,7 +352,7 @@ void FilterEq::process(const float *const in[], float *const out[], float cutoff
|
|||
void FilterEq::processModulated(const float *const in[], float *const out[], const float *cutoff, const float *bw, const float *pksh, unsigned nframes)
|
||||
{
|
||||
unsigned channels = P->fChannels;
|
||||
sfzFilterDsp *dsp = P->getDsp(channels);
|
||||
sfzFilterDsp *dsp = P->getDsp(channels, P->fType);
|
||||
|
||||
if (!dsp) {
|
||||
for (unsigned c = 0; c < channels; ++c)
|
||||
|
|
@ -383,13 +397,31 @@ void FilterEq::setChannels(unsigned channels)
|
|||
}
|
||||
}
|
||||
|
||||
sfzFilterDsp *FilterEq::Impl::getDsp(unsigned channels)
|
||||
EqType FilterEq::type() const
|
||||
{
|
||||
switch (channels) {
|
||||
return P->fType;
|
||||
}
|
||||
|
||||
void FilterEq::setType(EqType type)
|
||||
{
|
||||
if (P->fType != type) {
|
||||
P->fType = type;
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
sfzFilterDsp *FilterEq::Impl::getDsp(unsigned channels, EqType type)
|
||||
{
|
||||
switch (idDsp(channels, type)) {
|
||||
default: return nullptr;
|
||||
|
||||
case 1: return &fDsp;
|
||||
case 2: return &fDsp2ch;
|
||||
case idDsp(1, kEqPeak): return &fDspPeak;
|
||||
case idDsp(1, kEqLowShelf): return &fDspLshelf;
|
||||
case idDsp(1, kEqHighShelf): return &fDspHshelf;
|
||||
|
||||
case idDsp(2, kEqPeak): return &fDsp2chPeak;
|
||||
case idDsp(2, kEqLowShelf): return &fDsp2chLshelf;
|
||||
case idDsp(2, kEqHighShelf): return &fDsp2chHshelf;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ enum FilterType : int {
|
|||
kFilterPeq,
|
||||
};
|
||||
|
||||
enum EqType : int;
|
||||
|
||||
/**
|
||||
Equalizer filter for SFZ v1
|
||||
Available for mono and stereo. (channels=1, channels=2)
|
||||
|
|
@ -175,9 +177,26 @@ public:
|
|||
*/
|
||||
void setChannels(unsigned channels);
|
||||
|
||||
/**
|
||||
Get the type of filter.
|
||||
*/
|
||||
EqType type() const;
|
||||
|
||||
/**
|
||||
Set the type of filter.
|
||||
*/
|
||||
void setType(EqType type);
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
std::unique_ptr<Impl> P;
|
||||
};
|
||||
|
||||
enum EqType : int {
|
||||
kEqNone,
|
||||
kEqPeak,
|
||||
kEqLowShelf,
|
||||
kEqHighShelf,
|
||||
};
|
||||
|
||||
} // namespace sfz
|
||||
|
|
|
|||
|
|
@ -63,7 +63,9 @@ protected:
|
|||
#include "gen/filters/sfzLsh.cxx"
|
||||
#include "gen/filters/sfzHsh.cxx"
|
||||
#include "gen/filters/sfzPeq.cxx"
|
||||
#include "gen/filters/sfzEq.cxx"
|
||||
#include "gen/filters/sfzEqPeak.cxx"
|
||||
#include "gen/filters/sfzEqLshelf.cxx"
|
||||
#include "gen/filters/sfzEqHshelf.cxx"
|
||||
|
||||
#include "gen/filters/sfz2chApf1p.cxx"
|
||||
#include "gen/filters/sfz2chBpf1p.cxx"
|
||||
|
|
@ -88,7 +90,9 @@ protected:
|
|||
#include "gen/filters/sfz2chLsh.cxx"
|
||||
#include "gen/filters/sfz2chHsh.cxx"
|
||||
#include "gen/filters/sfz2chPeq.cxx"
|
||||
#include "gen/filters/sfz2chEq.cxx"
|
||||
#include "gen/filters/sfz2chEqPeak.cxx"
|
||||
#include "gen/filters/sfz2chEqLshelf.cxx"
|
||||
#include "gen/filters/sfz2chEqHshelf.cxx"
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
|
|
@ -182,7 +186,9 @@ struct sfzBrf2pSv final : public sfzFilter<faustBrf2pSv> {};
|
|||
struct sfzLsh final : public sfzFilterPkSh<faustLsh> {};
|
||||
struct sfzHsh final : public sfzFilterPkSh<faustHsh> {};
|
||||
struct sfzPeq final : public sfzFilterPkSh<faustPeq> {};
|
||||
struct sfzEq final : public sfzFilterEq<faustEq> {};
|
||||
struct sfzEqPeak final : public sfzFilterEq<faustEqPeak> {};
|
||||
struct sfzEqLshelf final : public sfzFilterEq<faustEqLshelf> {};
|
||||
struct sfzEqHshelf final : public sfzFilterEq<faustEqHshelf> {};
|
||||
|
||||
struct sfz2chLpf1p final : public sfzFilterNoQ<faust2chLpf1p> {};
|
||||
struct sfz2chLpf2p final : public sfzFilter<faust2chLpf2p> {};
|
||||
|
|
@ -207,4 +213,6 @@ struct sfz2chBrf2pSv final : public sfzFilter<faust2chBrf2pSv> {};
|
|||
struct sfz2chLsh final : public sfzFilterPkSh<faust2chLsh> {};
|
||||
struct sfz2chHsh final : public sfzFilterPkSh<faust2chHsh> {};
|
||||
struct sfz2chPeq final : public sfzFilterPkSh<faust2chPeq> {};
|
||||
struct sfz2chEq final : public sfzFilterEq<faust2chEq> {};
|
||||
struct sfz2chEqPeak final : public sfzFilterEq<faust2chEqPeak> {};
|
||||
struct sfz2chEqLshelf final : public sfzFilterEq<faust2chEqLshelf> {};
|
||||
struct sfz2chEqHshelf final : public sfzFilterEq<faust2chEqHshelf> {};
|
||||
|
|
|
|||
|
|
@ -94,11 +94,35 @@ sfzHsh = fm.rbjHighShelfSmooth(smoothCoefs,cutoff,pkShGain,Q);
|
|||
sfzPeq = fm.rbjPeakingEqSmooth(smoothCoefs,cutoff,pkShGain,Q);
|
||||
|
||||
// the SFZ equalizer band
|
||||
sfzEq = fm.rbjPeakingEqSmooth(smoothCoefs,cutoff,pkShGain,Q) with {
|
||||
sfzEqPeak = fm.rbjPeakingEqSmooth(smoothCoefs,cutoff,pkShGain,Q) with {
|
||||
Q = 1./(2.*ma.sinh(0.5*log(2)*bandwidth*w0/sin(w0)));
|
||||
w0 = 2*ma.PI*max(0,cutoff)/ma.SR;
|
||||
};
|
||||
|
||||
// the SFZ low-shelf with EQ controls
|
||||
sfzEqLshelf = fm.rbjLowShelfSmooth(smoothCoefs,cutoff,pkShGain,Q) with {
|
||||
slope = bandwidth; // in this case eqN_bw meaning is not bandwith but slope
|
||||
Q = sfzGetQFromSlope(slope);
|
||||
};
|
||||
|
||||
// the SFZ high-shelf with EQ controls
|
||||
sfzEqHshelf = fm.rbjHighShelfSmooth(smoothCoefs,cutoff,pkShGain,Q) with {
|
||||
slope = bandwidth; // in this case eqN_bw meaning is not bandwith but slope
|
||||
Q = sfzGetQFromSlope(slope);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
// Utility
|
||||
|
||||
// a common function that computes the EQ shelf parameter
|
||||
sfzGetQFromSlope(slope) = 1.0/sqrt((A+1.0/A)*(1.0/S-1.0)+2.0) with {
|
||||
// note(jpc) slope is a 0-1 control that is reduced into a domain of validity,
|
||||
// and clamped to avoid the extremes at both sides.
|
||||
S = (slope*root) : max(1e-2) : min(root-1e-2);
|
||||
A = 10^(pkShGain/40);
|
||||
root = (A*A+1)/((A-1)*(A-1)); // the root of the expression under sqrt()
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
// Filters (stereo)
|
||||
|
||||
|
|
@ -125,7 +149,9 @@ sfz2chBrf2pSv = par(i,2,sfzBrf2pSv);
|
|||
sfz2chLsh = par(i,2,sfzLsh);
|
||||
sfz2chHsh = par(i,2,sfzHsh);
|
||||
sfz2chPeq = par(i,2,sfzPeq);
|
||||
sfz2chEq = par(i,2,sfzEq);
|
||||
sfz2chEqPeak = par(i,2,sfzEqPeak);
|
||||
sfz2chEqLshelf = par(i,2,sfzEqLshelf);
|
||||
sfz2chEqHshelf = par(i,2,sfzEqHshelf);
|
||||
|
||||
//==============================================================================
|
||||
// Filter parameters
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ class faust2chBpf6p : public sfzFilterDsp {
|
|||
fRec6[0] = (fSlow0 * fRec6[1]);
|
||||
fRec7[0] = ((fSlow0 * fRec7[1]) + fSlow11);
|
||||
fRec2[0] = ((((fRec3[0] * fRec0[0]) + (fRec6[0] * fRec3[1])) + (fRec7[0] * fRec3[2])) - ((fRec4[0] * fRec2[1]) + (fRec5[0] * fRec2[2])));
|
||||
fRec1[0] = ((((fRec0[0] * fRec2[0]) + (fRec6[0] * fRec2[1])) + (fRec7[0] * fRec2[2])) - ((fRec4[0] * fRec1[1]) + (fRec5[0] * fRec1[2])));
|
||||
fRec1[0] = (((fRec0[0] * fRec2[0]) + ((fRec6[0] * fRec2[1]) + (fRec7[0] * fRec2[2]))) - ((fRec4[0] * fRec1[1]) + (fRec5[0] * fRec1[2])));
|
||||
output0[i] = FAUSTFLOAT((((fRec0[0] * fRec1[0]) + (fRec6[0] * fRec1[1])) + (fRec7[0] * fRec1[2])));
|
||||
fRec10[0] = (fTemp1 - ((fRec4[0] * fRec10[1]) + (fRec5[0] * fRec10[2])));
|
||||
fRec9[0] = ((((fRec0[0] * fRec10[0]) + (fRec6[0] * fRec10[1])) + (fRec7[0] * fRec10[2])) - ((fRec4[0] * fRec9[1]) + (fRec5[0] * fRec9[2])));
|
||||
|
|
|
|||
210
src/sfizz/gen/filters/sfz2chEqHshelf.cxx
Normal file
210
src/sfizz/gen/filters/sfz2chEqHshelf.cxx
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
/* ------------------------------------------------------------
|
||||
author: "Jean Pierre Cimalando"
|
||||
license: "BSD-2-Clause"
|
||||
name: "sfz_filters"
|
||||
Code generated with Faust 2.20.2 (https://faust.grame.fr)
|
||||
Compilation options: -lang cpp -inpl -double -ftz 0
|
||||
------------------------------------------------------------ */
|
||||
|
||||
#ifndef __faust2chEqHshelf_H__
|
||||
#define __faust2chEqHshelf_H__
|
||||
|
||||
#ifndef FAUSTFLOAT
|
||||
#define FAUSTFLOAT float
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
|
||||
static double faust2chEqHshelf_faustpower2_f(double value) {
|
||||
return (value * value);
|
||||
}
|
||||
|
||||
#ifndef FAUSTCLASS
|
||||
#define FAUSTCLASS faust2chEqHshelf
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define exp10f __exp10f
|
||||
#define exp10 __exp10
|
||||
#endif
|
||||
|
||||
class faust2chEqHshelf : public sfzFilterDsp {
|
||||
|
||||
public:
|
||||
|
||||
int fSampleRate;
|
||||
double fConst0;
|
||||
double fConst1;
|
||||
FAUSTFLOAT fPkShGain;
|
||||
double fConst2;
|
||||
FAUSTFLOAT fCutoff;
|
||||
FAUSTFLOAT fBandwidth;
|
||||
double fRec1[2];
|
||||
double fRec2[2];
|
||||
double fRec0[3];
|
||||
double fRec3[2];
|
||||
double fRec4[2];
|
||||
double fRec5[2];
|
||||
double fRec6[3];
|
||||
|
||||
public:
|
||||
|
||||
void metadata(Meta* m) {
|
||||
}
|
||||
|
||||
virtual int getNumInputs() {
|
||||
return 2;
|
||||
}
|
||||
virtual int getNumOutputs() {
|
||||
return 2;
|
||||
}
|
||||
virtual int getInputRate(int channel) {
|
||||
int rate;
|
||||
switch ((channel)) {
|
||||
case 0: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
rate = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
virtual int getOutputRate(int channel) {
|
||||
int rate;
|
||||
switch ((channel)) {
|
||||
case 0: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
rate = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
|
||||
static void classInit(int sample_rate) {
|
||||
}
|
||||
|
||||
virtual void instanceConstants(int sample_rate) {
|
||||
fSampleRate = sample_rate;
|
||||
fConst0 = std::min<double>(192000.0, std::max<double>(1.0, double(fSampleRate)));
|
||||
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
|
||||
fConst2 = (6.2831853071795862 / fConst0);
|
||||
}
|
||||
|
||||
virtual void instanceResetUserInterface() {
|
||||
fPkShGain = FAUSTFLOAT(0.0);
|
||||
fCutoff = FAUSTFLOAT(440.0);
|
||||
fBandwidth = FAUSTFLOAT(1.0);
|
||||
}
|
||||
|
||||
virtual void instanceClear() {
|
||||
for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
|
||||
fRec1[l0] = 0.0;
|
||||
}
|
||||
for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
|
||||
fRec2[l1] = 0.0;
|
||||
}
|
||||
for (int l2 = 0; (l2 < 3); l2 = (l2 + 1)) {
|
||||
fRec0[l2] = 0.0;
|
||||
}
|
||||
for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
|
||||
fRec3[l3] = 0.0;
|
||||
}
|
||||
for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
|
||||
fRec4[l4] = 0.0;
|
||||
}
|
||||
for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
|
||||
fRec5[l5] = 0.0;
|
||||
}
|
||||
for (int l6 = 0; (l6 < 3); l6 = (l6 + 1)) {
|
||||
fRec6[l6] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void init(int sample_rate) {
|
||||
classInit(sample_rate);
|
||||
instanceInit(sample_rate);
|
||||
}
|
||||
virtual void instanceInit(int sample_rate) {
|
||||
instanceConstants(sample_rate);
|
||||
instanceResetUserInterface();
|
||||
instanceClear();
|
||||
}
|
||||
|
||||
virtual faust2chEqHshelf* clone() {
|
||||
return new faust2chEqHshelf();
|
||||
}
|
||||
|
||||
virtual int getSampleRate() {
|
||||
return fSampleRate;
|
||||
}
|
||||
|
||||
virtual void buildUserInterface(UI* ui_interface) {
|
||||
}
|
||||
|
||||
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
|
||||
FAUSTFLOAT* input0 = inputs[0];
|
||||
FAUSTFLOAT* input1 = inputs[1];
|
||||
FAUSTFLOAT* output0 = outputs[0];
|
||||
FAUSTFLOAT* output1 = outputs[1];
|
||||
double fSlow0 = (fSmoothEnable ? fConst1 : 0.0);
|
||||
double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain)));
|
||||
double fSlow2 = (fConst2 * std::max<double>(0.0, double(fCutoff)));
|
||||
double fSlow3 = std::cos(fSlow2);
|
||||
double fSlow4 = (fSlow3 * (fSlow1 + 1.0));
|
||||
double fSlow5 = (faust2chEqHshelf_faustpower2_f(fSlow1) + 1.0);
|
||||
double fSlow6 = (fSlow1 + -1.0);
|
||||
double fSlow7 = faust2chEqHshelf_faustpower2_f(fSlow6);
|
||||
double fSlow8 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max<double>(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min<double>(((fSlow5 / fSlow7) + -0.01), std::max<double>(0.01, ((double(fBandwidth) * fSlow5) / fSlow7)))) + -1.0)) + 2.0)))));
|
||||
double fSlow9 = (fSlow3 * fSlow6);
|
||||
double fSlow10 = ((fSlow1 + fSlow8) + (1.0 - fSlow9));
|
||||
double fSlow11 = (1.0 - fSlow0);
|
||||
double fSlow12 = ((2.0 * ((fSlow1 + (-1.0 - fSlow4)) / fSlow10)) * fSlow11);
|
||||
double fSlow13 = (fSlow9 + fSlow8);
|
||||
double fSlow14 = (((fSlow1 + (1.0 - fSlow13)) / fSlow10) * fSlow11);
|
||||
double fSlow15 = (((fSlow1 * ((fSlow1 + fSlow13) + 1.0)) / fSlow10) * fSlow11);
|
||||
double fSlow16 = ((((0.0 - (2.0 * fSlow1)) * ((fSlow1 + fSlow4) + -1.0)) / fSlow10) * fSlow11);
|
||||
double fSlow17 = (((fSlow1 * ((fSlow1 + fSlow9) + (1.0 - fSlow8))) / fSlow10) * fSlow11);
|
||||
for (int i = 0; (i < count); i = (i + 1)) {
|
||||
double fTemp0 = double(input0[i]);
|
||||
double fTemp1 = double(input1[i]);
|
||||
fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow12);
|
||||
fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow14);
|
||||
fRec0[0] = (fTemp0 - ((fRec1[0] * fRec0[1]) + (fRec2[0] * fRec0[2])));
|
||||
fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow15);
|
||||
fRec4[0] = ((fSlow0 * fRec4[1]) + fSlow16);
|
||||
fRec5[0] = ((fSlow0 * fRec5[1]) + fSlow17);
|
||||
output0[i] = FAUSTFLOAT((((fRec0[0] * fRec3[0]) + (fRec4[0] * fRec0[1])) + (fRec5[0] * fRec0[2])));
|
||||
fRec6[0] = (fTemp1 - ((fRec1[0] * fRec6[1]) + (fRec2[0] * fRec6[2])));
|
||||
output1[i] = FAUSTFLOAT((((fRec3[0] * fRec6[0]) + (fRec4[0] * fRec6[1])) + (fRec5[0] * fRec6[2])));
|
||||
fRec1[1] = fRec1[0];
|
||||
fRec2[1] = fRec2[0];
|
||||
fRec0[2] = fRec0[1];
|
||||
fRec0[1] = fRec0[0];
|
||||
fRec3[1] = fRec3[0];
|
||||
fRec4[1] = fRec4[0];
|
||||
fRec5[1] = fRec5[0];
|
||||
fRec6[2] = fRec6[1];
|
||||
fRec6[1] = fRec6[0];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
210
src/sfizz/gen/filters/sfz2chEqLshelf.cxx
Normal file
210
src/sfizz/gen/filters/sfz2chEqLshelf.cxx
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
/* ------------------------------------------------------------
|
||||
author: "Jean Pierre Cimalando"
|
||||
license: "BSD-2-Clause"
|
||||
name: "sfz_filters"
|
||||
Code generated with Faust 2.20.2 (https://faust.grame.fr)
|
||||
Compilation options: -lang cpp -inpl -double -ftz 0
|
||||
------------------------------------------------------------ */
|
||||
|
||||
#ifndef __faust2chEqLshelf_H__
|
||||
#define __faust2chEqLshelf_H__
|
||||
|
||||
#ifndef FAUSTFLOAT
|
||||
#define FAUSTFLOAT float
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
|
||||
static double faust2chEqLshelf_faustpower2_f(double value) {
|
||||
return (value * value);
|
||||
}
|
||||
|
||||
#ifndef FAUSTCLASS
|
||||
#define FAUSTCLASS faust2chEqLshelf
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define exp10f __exp10f
|
||||
#define exp10 __exp10
|
||||
#endif
|
||||
|
||||
class faust2chEqLshelf : public sfzFilterDsp {
|
||||
|
||||
public:
|
||||
|
||||
int fSampleRate;
|
||||
double fConst0;
|
||||
double fConst1;
|
||||
FAUSTFLOAT fPkShGain;
|
||||
double fConst2;
|
||||
FAUSTFLOAT fCutoff;
|
||||
FAUSTFLOAT fBandwidth;
|
||||
double fRec1[2];
|
||||
double fRec2[2];
|
||||
double fRec0[3];
|
||||
double fRec3[2];
|
||||
double fRec4[2];
|
||||
double fRec5[2];
|
||||
double fRec6[3];
|
||||
|
||||
public:
|
||||
|
||||
void metadata(Meta* m) {
|
||||
}
|
||||
|
||||
virtual int getNumInputs() {
|
||||
return 2;
|
||||
}
|
||||
virtual int getNumOutputs() {
|
||||
return 2;
|
||||
}
|
||||
virtual int getInputRate(int channel) {
|
||||
int rate;
|
||||
switch ((channel)) {
|
||||
case 0: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
rate = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
virtual int getOutputRate(int channel) {
|
||||
int rate;
|
||||
switch ((channel)) {
|
||||
case 0: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
rate = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
|
||||
static void classInit(int sample_rate) {
|
||||
}
|
||||
|
||||
virtual void instanceConstants(int sample_rate) {
|
||||
fSampleRate = sample_rate;
|
||||
fConst0 = std::min<double>(192000.0, std::max<double>(1.0, double(fSampleRate)));
|
||||
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
|
||||
fConst2 = (6.2831853071795862 / fConst0);
|
||||
}
|
||||
|
||||
virtual void instanceResetUserInterface() {
|
||||
fPkShGain = FAUSTFLOAT(0.0);
|
||||
fCutoff = FAUSTFLOAT(440.0);
|
||||
fBandwidth = FAUSTFLOAT(1.0);
|
||||
}
|
||||
|
||||
virtual void instanceClear() {
|
||||
for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
|
||||
fRec1[l0] = 0.0;
|
||||
}
|
||||
for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
|
||||
fRec2[l1] = 0.0;
|
||||
}
|
||||
for (int l2 = 0; (l2 < 3); l2 = (l2 + 1)) {
|
||||
fRec0[l2] = 0.0;
|
||||
}
|
||||
for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
|
||||
fRec3[l3] = 0.0;
|
||||
}
|
||||
for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
|
||||
fRec4[l4] = 0.0;
|
||||
}
|
||||
for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
|
||||
fRec5[l5] = 0.0;
|
||||
}
|
||||
for (int l6 = 0; (l6 < 3); l6 = (l6 + 1)) {
|
||||
fRec6[l6] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void init(int sample_rate) {
|
||||
classInit(sample_rate);
|
||||
instanceInit(sample_rate);
|
||||
}
|
||||
virtual void instanceInit(int sample_rate) {
|
||||
instanceConstants(sample_rate);
|
||||
instanceResetUserInterface();
|
||||
instanceClear();
|
||||
}
|
||||
|
||||
virtual faust2chEqLshelf* clone() {
|
||||
return new faust2chEqLshelf();
|
||||
}
|
||||
|
||||
virtual int getSampleRate() {
|
||||
return fSampleRate;
|
||||
}
|
||||
|
||||
virtual void buildUserInterface(UI* ui_interface) {
|
||||
}
|
||||
|
||||
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
|
||||
FAUSTFLOAT* input0 = inputs[0];
|
||||
FAUSTFLOAT* input1 = inputs[1];
|
||||
FAUSTFLOAT* output0 = outputs[0];
|
||||
FAUSTFLOAT* output1 = outputs[1];
|
||||
double fSlow0 = (fSmoothEnable ? fConst1 : 0.0);
|
||||
double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain)));
|
||||
double fSlow2 = (fConst2 * std::max<double>(0.0, double(fCutoff)));
|
||||
double fSlow3 = std::cos(fSlow2);
|
||||
double fSlow4 = (fSlow3 * (fSlow1 + 1.0));
|
||||
double fSlow5 = (fSlow1 + -1.0);
|
||||
double fSlow6 = (fSlow3 * fSlow5);
|
||||
double fSlow7 = (faust2chEqLshelf_faustpower2_f(fSlow1) + 1.0);
|
||||
double fSlow8 = faust2chEqLshelf_faustpower2_f(fSlow5);
|
||||
double fSlow9 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max<double>(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min<double>(((fSlow7 / fSlow8) + -0.01), std::max<double>(0.01, ((double(fBandwidth) * fSlow7) / fSlow8)))) + -1.0)) + 2.0)))));
|
||||
double fSlow10 = (fSlow6 + fSlow9);
|
||||
double fSlow11 = ((fSlow1 + fSlow10) + 1.0);
|
||||
double fSlow12 = (1.0 - fSlow0);
|
||||
double fSlow13 = (((0.0 - (2.0 * ((fSlow1 + fSlow4) + -1.0))) / fSlow11) * fSlow12);
|
||||
double fSlow14 = ((((fSlow1 + fSlow6) + (1.0 - fSlow9)) / fSlow11) * fSlow12);
|
||||
double fSlow15 = (((fSlow1 * ((fSlow1 + fSlow9) + (1.0 - fSlow6))) / fSlow11) * fSlow12);
|
||||
double fSlow16 = ((2.0 * ((fSlow1 * (fSlow1 + (-1.0 - fSlow4))) / fSlow11)) * fSlow12);
|
||||
double fSlow17 = (((fSlow1 * (fSlow1 + (1.0 - fSlow10))) / fSlow11) * fSlow12);
|
||||
for (int i = 0; (i < count); i = (i + 1)) {
|
||||
double fTemp0 = double(input0[i]);
|
||||
double fTemp1 = double(input1[i]);
|
||||
fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow13);
|
||||
fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow14);
|
||||
fRec0[0] = (fTemp0 - ((fRec1[0] * fRec0[1]) + (fRec2[0] * fRec0[2])));
|
||||
fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow15);
|
||||
fRec4[0] = ((fSlow0 * fRec4[1]) + fSlow16);
|
||||
fRec5[0] = ((fSlow0 * fRec5[1]) + fSlow17);
|
||||
output0[i] = FAUSTFLOAT((((fRec0[0] * fRec3[0]) + (fRec4[0] * fRec0[1])) + (fRec5[0] * fRec0[2])));
|
||||
fRec6[0] = (fTemp1 - ((fRec1[0] * fRec6[1]) + (fRec2[0] * fRec6[2])));
|
||||
output1[i] = FAUSTFLOAT((((fRec3[0] * fRec6[0]) + (fRec4[0] * fRec6[1])) + (fRec5[0] * fRec6[2])));
|
||||
fRec1[1] = fRec1[0];
|
||||
fRec2[1] = fRec2[0];
|
||||
fRec0[2] = fRec0[1];
|
||||
fRec0[1] = fRec0[0];
|
||||
fRec3[1] = fRec3[0];
|
||||
fRec4[1] = fRec4[0];
|
||||
fRec5[1] = fRec5[0];
|
||||
fRec6[2] = fRec6[1];
|
||||
fRec6[1] = fRec6[0];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -6,8 +6,8 @@ Code generated with Faust 2.20.2 (https://faust.grame.fr)
|
|||
Compilation options: -lang cpp -inpl -double -ftz 0
|
||||
------------------------------------------------------------ */
|
||||
|
||||
#ifndef __faust2chEq_H__
|
||||
#define __faust2chEq_H__
|
||||
#ifndef __faust2chEqPeak_H__
|
||||
#define __faust2chEqPeak_H__
|
||||
|
||||
#ifndef FAUSTFLOAT
|
||||
#define FAUSTFLOAT float
|
||||
|
|
@ -20,7 +20,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0
|
|||
|
||||
|
||||
#ifndef FAUSTCLASS
|
||||
#define FAUSTCLASS faust2chEq
|
||||
#define FAUSTCLASS faust2chEqPeak
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
|
@ -28,7 +28,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0
|
|||
#define exp10 __exp10
|
||||
#endif
|
||||
|
||||
class faust2chEq : public sfzFilterDsp {
|
||||
class faust2chEqPeak : public sfzFilterDsp {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -143,8 +143,8 @@ class faust2chEq : public sfzFilterDsp {
|
|||
instanceClear();
|
||||
}
|
||||
|
||||
virtual faust2chEq* clone() {
|
||||
return new faust2chEq();
|
||||
virtual faust2chEqPeak* clone() {
|
||||
return new faust2chEqPeak();
|
||||
}
|
||||
|
||||
virtual int getSampleRate() {
|
||||
191
src/sfizz/gen/filters/sfzEqHshelf.cxx
Normal file
191
src/sfizz/gen/filters/sfzEqHshelf.cxx
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
/* ------------------------------------------------------------
|
||||
author: "Jean Pierre Cimalando"
|
||||
license: "BSD-2-Clause"
|
||||
name: "sfz_filters"
|
||||
Code generated with Faust 2.20.2 (https://faust.grame.fr)
|
||||
Compilation options: -lang cpp -inpl -double -ftz 0
|
||||
------------------------------------------------------------ */
|
||||
|
||||
#ifndef __faustEqHshelf_H__
|
||||
#define __faustEqHshelf_H__
|
||||
|
||||
#ifndef FAUSTFLOAT
|
||||
#define FAUSTFLOAT float
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
|
||||
static double faustEqHshelf_faustpower2_f(double value) {
|
||||
return (value * value);
|
||||
}
|
||||
|
||||
#ifndef FAUSTCLASS
|
||||
#define FAUSTCLASS faustEqHshelf
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define exp10f __exp10f
|
||||
#define exp10 __exp10
|
||||
#endif
|
||||
|
||||
class faustEqHshelf : public sfzFilterDsp {
|
||||
|
||||
public:
|
||||
|
||||
int fSampleRate;
|
||||
double fConst0;
|
||||
double fConst1;
|
||||
FAUSTFLOAT fPkShGain;
|
||||
double fConst2;
|
||||
FAUSTFLOAT fCutoff;
|
||||
FAUSTFLOAT fBandwidth;
|
||||
double fRec1[2];
|
||||
double fRec2[2];
|
||||
double fRec0[3];
|
||||
double fRec3[2];
|
||||
double fRec4[2];
|
||||
double fRec5[2];
|
||||
|
||||
public:
|
||||
|
||||
void metadata(Meta* m) {
|
||||
}
|
||||
|
||||
virtual int getNumInputs() {
|
||||
return 1;
|
||||
}
|
||||
virtual int getNumOutputs() {
|
||||
return 1;
|
||||
}
|
||||
virtual int getInputRate(int channel) {
|
||||
int rate;
|
||||
switch ((channel)) {
|
||||
case 0: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
rate = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
virtual int getOutputRate(int channel) {
|
||||
int rate;
|
||||
switch ((channel)) {
|
||||
case 0: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
rate = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
|
||||
static void classInit(int sample_rate) {
|
||||
}
|
||||
|
||||
virtual void instanceConstants(int sample_rate) {
|
||||
fSampleRate = sample_rate;
|
||||
fConst0 = std::min<double>(192000.0, std::max<double>(1.0, double(fSampleRate)));
|
||||
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
|
||||
fConst2 = (6.2831853071795862 / fConst0);
|
||||
}
|
||||
|
||||
virtual void instanceResetUserInterface() {
|
||||
fPkShGain = FAUSTFLOAT(0.0);
|
||||
fCutoff = FAUSTFLOAT(440.0);
|
||||
fBandwidth = FAUSTFLOAT(1.0);
|
||||
}
|
||||
|
||||
virtual void instanceClear() {
|
||||
for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
|
||||
fRec1[l0] = 0.0;
|
||||
}
|
||||
for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
|
||||
fRec2[l1] = 0.0;
|
||||
}
|
||||
for (int l2 = 0; (l2 < 3); l2 = (l2 + 1)) {
|
||||
fRec0[l2] = 0.0;
|
||||
}
|
||||
for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
|
||||
fRec3[l3] = 0.0;
|
||||
}
|
||||
for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
|
||||
fRec4[l4] = 0.0;
|
||||
}
|
||||
for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
|
||||
fRec5[l5] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void init(int sample_rate) {
|
||||
classInit(sample_rate);
|
||||
instanceInit(sample_rate);
|
||||
}
|
||||
virtual void instanceInit(int sample_rate) {
|
||||
instanceConstants(sample_rate);
|
||||
instanceResetUserInterface();
|
||||
instanceClear();
|
||||
}
|
||||
|
||||
virtual faustEqHshelf* clone() {
|
||||
return new faustEqHshelf();
|
||||
}
|
||||
|
||||
virtual int getSampleRate() {
|
||||
return fSampleRate;
|
||||
}
|
||||
|
||||
virtual void buildUserInterface(UI* ui_interface) {
|
||||
}
|
||||
|
||||
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
|
||||
FAUSTFLOAT* input0 = inputs[0];
|
||||
FAUSTFLOAT* output0 = outputs[0];
|
||||
double fSlow0 = (fSmoothEnable ? fConst1 : 0.0);
|
||||
double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain)));
|
||||
double fSlow2 = (fConst2 * std::max<double>(0.0, double(fCutoff)));
|
||||
double fSlow3 = std::cos(fSlow2);
|
||||
double fSlow4 = (fSlow3 * (fSlow1 + 1.0));
|
||||
double fSlow5 = (faustEqHshelf_faustpower2_f(fSlow1) + 1.0);
|
||||
double fSlow6 = (fSlow1 + -1.0);
|
||||
double fSlow7 = faustEqHshelf_faustpower2_f(fSlow6);
|
||||
double fSlow8 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max<double>(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min<double>(((fSlow5 / fSlow7) + -0.01), std::max<double>(0.01, ((double(fBandwidth) * fSlow5) / fSlow7)))) + -1.0)) + 2.0)))));
|
||||
double fSlow9 = (fSlow3 * fSlow6);
|
||||
double fSlow10 = ((fSlow1 + fSlow8) + (1.0 - fSlow9));
|
||||
double fSlow11 = (1.0 - fSlow0);
|
||||
double fSlow12 = ((2.0 * ((fSlow1 + (-1.0 - fSlow4)) / fSlow10)) * fSlow11);
|
||||
double fSlow13 = (fSlow9 + fSlow8);
|
||||
double fSlow14 = (((fSlow1 + (1.0 - fSlow13)) / fSlow10) * fSlow11);
|
||||
double fSlow15 = (((fSlow1 * ((fSlow1 + fSlow13) + 1.0)) / fSlow10) * fSlow11);
|
||||
double fSlow16 = ((((0.0 - (2.0 * fSlow1)) * ((fSlow1 + fSlow4) + -1.0)) / fSlow10) * fSlow11);
|
||||
double fSlow17 = (((fSlow1 * ((fSlow1 + fSlow9) + (1.0 - fSlow8))) / fSlow10) * fSlow11);
|
||||
for (int i = 0; (i < count); i = (i + 1)) {
|
||||
double fTemp0 = double(input0[i]);
|
||||
fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow12);
|
||||
fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow14);
|
||||
fRec0[0] = (fTemp0 - ((fRec1[0] * fRec0[1]) + (fRec2[0] * fRec0[2])));
|
||||
fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow15);
|
||||
fRec4[0] = ((fSlow0 * fRec4[1]) + fSlow16);
|
||||
fRec5[0] = ((fSlow0 * fRec5[1]) + fSlow17);
|
||||
output0[i] = FAUSTFLOAT((((fRec0[0] * fRec3[0]) + (fRec4[0] * fRec0[1])) + (fRec5[0] * fRec0[2])));
|
||||
fRec1[1] = fRec1[0];
|
||||
fRec2[1] = fRec2[0];
|
||||
fRec0[2] = fRec0[1];
|
||||
fRec0[1] = fRec0[0];
|
||||
fRec3[1] = fRec3[0];
|
||||
fRec4[1] = fRec4[0];
|
||||
fRec5[1] = fRec5[0];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
191
src/sfizz/gen/filters/sfzEqLshelf.cxx
Normal file
191
src/sfizz/gen/filters/sfzEqLshelf.cxx
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
/* ------------------------------------------------------------
|
||||
author: "Jean Pierre Cimalando"
|
||||
license: "BSD-2-Clause"
|
||||
name: "sfz_filters"
|
||||
Code generated with Faust 2.20.2 (https://faust.grame.fr)
|
||||
Compilation options: -lang cpp -inpl -double -ftz 0
|
||||
------------------------------------------------------------ */
|
||||
|
||||
#ifndef __faustEqLshelf_H__
|
||||
#define __faustEqLshelf_H__
|
||||
|
||||
#ifndef FAUSTFLOAT
|
||||
#define FAUSTFLOAT float
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
|
||||
static double faustEqLshelf_faustpower2_f(double value) {
|
||||
return (value * value);
|
||||
}
|
||||
|
||||
#ifndef FAUSTCLASS
|
||||
#define FAUSTCLASS faustEqLshelf
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define exp10f __exp10f
|
||||
#define exp10 __exp10
|
||||
#endif
|
||||
|
||||
class faustEqLshelf : public sfzFilterDsp {
|
||||
|
||||
public:
|
||||
|
||||
int fSampleRate;
|
||||
double fConst0;
|
||||
double fConst1;
|
||||
FAUSTFLOAT fPkShGain;
|
||||
double fConst2;
|
||||
FAUSTFLOAT fCutoff;
|
||||
FAUSTFLOAT fBandwidth;
|
||||
double fRec1[2];
|
||||
double fRec2[2];
|
||||
double fRec0[3];
|
||||
double fRec3[2];
|
||||
double fRec4[2];
|
||||
double fRec5[2];
|
||||
|
||||
public:
|
||||
|
||||
void metadata(Meta* m) {
|
||||
}
|
||||
|
||||
virtual int getNumInputs() {
|
||||
return 1;
|
||||
}
|
||||
virtual int getNumOutputs() {
|
||||
return 1;
|
||||
}
|
||||
virtual int getInputRate(int channel) {
|
||||
int rate;
|
||||
switch ((channel)) {
|
||||
case 0: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
rate = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
virtual int getOutputRate(int channel) {
|
||||
int rate;
|
||||
switch ((channel)) {
|
||||
case 0: {
|
||||
rate = 1;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
rate = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rate;
|
||||
}
|
||||
|
||||
static void classInit(int sample_rate) {
|
||||
}
|
||||
|
||||
virtual void instanceConstants(int sample_rate) {
|
||||
fSampleRate = sample_rate;
|
||||
fConst0 = std::min<double>(192000.0, std::max<double>(1.0, double(fSampleRate)));
|
||||
fConst1 = std::exp((0.0 - (1000.0 / fConst0)));
|
||||
fConst2 = (6.2831853071795862 / fConst0);
|
||||
}
|
||||
|
||||
virtual void instanceResetUserInterface() {
|
||||
fPkShGain = FAUSTFLOAT(0.0);
|
||||
fCutoff = FAUSTFLOAT(440.0);
|
||||
fBandwidth = FAUSTFLOAT(1.0);
|
||||
}
|
||||
|
||||
virtual void instanceClear() {
|
||||
for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
|
||||
fRec1[l0] = 0.0;
|
||||
}
|
||||
for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
|
||||
fRec2[l1] = 0.0;
|
||||
}
|
||||
for (int l2 = 0; (l2 < 3); l2 = (l2 + 1)) {
|
||||
fRec0[l2] = 0.0;
|
||||
}
|
||||
for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
|
||||
fRec3[l3] = 0.0;
|
||||
}
|
||||
for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
|
||||
fRec4[l4] = 0.0;
|
||||
}
|
||||
for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
|
||||
fRec5[l5] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void init(int sample_rate) {
|
||||
classInit(sample_rate);
|
||||
instanceInit(sample_rate);
|
||||
}
|
||||
virtual void instanceInit(int sample_rate) {
|
||||
instanceConstants(sample_rate);
|
||||
instanceResetUserInterface();
|
||||
instanceClear();
|
||||
}
|
||||
|
||||
virtual faustEqLshelf* clone() {
|
||||
return new faustEqLshelf();
|
||||
}
|
||||
|
||||
virtual int getSampleRate() {
|
||||
return fSampleRate;
|
||||
}
|
||||
|
||||
virtual void buildUserInterface(UI* ui_interface) {
|
||||
}
|
||||
|
||||
virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {
|
||||
FAUSTFLOAT* input0 = inputs[0];
|
||||
FAUSTFLOAT* output0 = outputs[0];
|
||||
double fSlow0 = (fSmoothEnable ? fConst1 : 0.0);
|
||||
double fSlow1 = std::pow(10.0, (0.025000000000000001 * double(fPkShGain)));
|
||||
double fSlow2 = (fConst2 * std::max<double>(0.0, double(fCutoff)));
|
||||
double fSlow3 = std::cos(fSlow2);
|
||||
double fSlow4 = (fSlow3 * (fSlow1 + 1.0));
|
||||
double fSlow5 = (fSlow1 + -1.0);
|
||||
double fSlow6 = (fSlow3 * fSlow5);
|
||||
double fSlow7 = (faustEqLshelf_faustpower2_f(fSlow1) + 1.0);
|
||||
double fSlow8 = faustEqLshelf_faustpower2_f(fSlow5);
|
||||
double fSlow9 = ((std::sqrt(fSlow1) * std::sin(fSlow2)) / std::max<double>(0.001, (1.0 / std::sqrt((((fSlow1 + (1.0 / fSlow1)) * ((1.0 / std::min<double>(((fSlow7 / fSlow8) + -0.01), std::max<double>(0.01, ((double(fBandwidth) * fSlow7) / fSlow8)))) + -1.0)) + 2.0)))));
|
||||
double fSlow10 = (fSlow6 + fSlow9);
|
||||
double fSlow11 = ((fSlow1 + fSlow10) + 1.0);
|
||||
double fSlow12 = (1.0 - fSlow0);
|
||||
double fSlow13 = (((0.0 - (2.0 * ((fSlow1 + fSlow4) + -1.0))) / fSlow11) * fSlow12);
|
||||
double fSlow14 = ((((fSlow1 + fSlow6) + (1.0 - fSlow9)) / fSlow11) * fSlow12);
|
||||
double fSlow15 = (((fSlow1 * ((fSlow1 + fSlow9) + (1.0 - fSlow6))) / fSlow11) * fSlow12);
|
||||
double fSlow16 = ((2.0 * ((fSlow1 * (fSlow1 + (-1.0 - fSlow4))) / fSlow11)) * fSlow12);
|
||||
double fSlow17 = (((fSlow1 * (fSlow1 + (1.0 - fSlow10))) / fSlow11) * fSlow12);
|
||||
for (int i = 0; (i < count); i = (i + 1)) {
|
||||
double fTemp0 = double(input0[i]);
|
||||
fRec1[0] = ((fSlow0 * fRec1[1]) + fSlow13);
|
||||
fRec2[0] = ((fSlow0 * fRec2[1]) + fSlow14);
|
||||
fRec0[0] = (fTemp0 - ((fRec1[0] * fRec0[1]) + (fRec2[0] * fRec0[2])));
|
||||
fRec3[0] = ((fSlow0 * fRec3[1]) + fSlow15);
|
||||
fRec4[0] = ((fSlow0 * fRec4[1]) + fSlow16);
|
||||
fRec5[0] = ((fSlow0 * fRec5[1]) + fSlow17);
|
||||
output0[i] = FAUSTFLOAT((((fRec0[0] * fRec3[0]) + (fRec4[0] * fRec0[1])) + (fRec5[0] * fRec0[2])));
|
||||
fRec1[1] = fRec1[0];
|
||||
fRec2[1] = fRec2[0];
|
||||
fRec0[2] = fRec0[1];
|
||||
fRec0[1] = fRec0[0];
|
||||
fRec3[1] = fRec3[0];
|
||||
fRec4[1] = fRec4[0];
|
||||
fRec5[1] = fRec5[0];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -6,8 +6,8 @@ Code generated with Faust 2.20.2 (https://faust.grame.fr)
|
|||
Compilation options: -lang cpp -inpl -double -ftz 0
|
||||
------------------------------------------------------------ */
|
||||
|
||||
#ifndef __faustEq_H__
|
||||
#define __faustEq_H__
|
||||
#ifndef __faustEqPeak_H__
|
||||
#define __faustEqPeak_H__
|
||||
|
||||
#ifndef FAUSTFLOAT
|
||||
#define FAUSTFLOAT float
|
||||
|
|
@ -20,7 +20,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0
|
|||
|
||||
|
||||
#ifndef FAUSTCLASS
|
||||
#define FAUSTCLASS faustEq
|
||||
#define FAUSTCLASS faustEqPeak
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
|
@ -28,7 +28,7 @@ Compilation options: -lang cpp -inpl -double -ftz 0
|
|||
#define exp10 __exp10
|
||||
#endif
|
||||
|
||||
class faustEq : public sfzFilterDsp {
|
||||
class faustEqPeak : public sfzFilterDsp {
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -131,8 +131,8 @@ class faustEq : public sfzFilterDsp {
|
|||
instanceClear();
|
||||
}
|
||||
|
||||
virtual faustEq* clone() {
|
||||
return new faustEq();
|
||||
virtual faustEqPeak* clone() {
|
||||
return new faustEqPeak();
|
||||
}
|
||||
|
||||
virtual int getSampleRate() {
|
||||
Loading…
Add table
Reference in a new issue