46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
#include "Params.h"
|
|
#include "Filter.h"
|
|
|
|
namespace serum
|
|
{
|
|
|
|
// ===========================================================================
|
|
// Snapshot of the two-slot filter section.
|
|
// ===========================================================================
|
|
struct FilterBankParams
|
|
{
|
|
bool f1On = false, f2On = false;
|
|
int f1Type = 0, f2Type = 0;
|
|
float f1Cutoff = 0.5f, f2Cutoff = 0.5f;
|
|
float f1Res = 0.0f, f2Res = 0.0f;
|
|
float f1Drive = 0.0f, f2Drive = 0.0f;
|
|
float f1Key = 0.0f, f2Key = 0.0f;
|
|
int f1Slope = 2, f2Slope = 2;
|
|
int route = 0;
|
|
float mix = 0.5f;
|
|
float out = 1.0f;
|
|
};
|
|
|
|
// ===========================================================================
|
|
// Two filter slots with serial / parallel / split routing, processed stereo.
|
|
// ===========================================================================
|
|
class FilterBank
|
|
{
|
|
public:
|
|
void prepare (double sampleRate, int maxBlockSize);
|
|
void reset();
|
|
|
|
void process (float* l, float* r, int numSamples, const FilterBankParams& p, float noteHz) noexcept;
|
|
|
|
private:
|
|
Filter f1L, f1R, f2L, f2R;
|
|
|
|
static void applySlot (Filter& f, float* buf, int n, bool on, int type, float cutoff,
|
|
float res, float drive, float key, int slope, float noteHz) noexcept;
|
|
};
|
|
|
|
} // namespace serum
|