55 lines
1.6 KiB
C++
55 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
#include "Params.h"
|
|
|
|
namespace serum
|
|
{
|
|
|
|
// ===========================================================================
|
|
// Base class for a stereo effect unit. Each unit processes a full-wet buffer.
|
|
// ===========================================================================
|
|
class FXUnit
|
|
{
|
|
public:
|
|
virtual ~FXUnit() = default;
|
|
virtual void prepare (double sampleRate, int maxBlockSize) = 0;
|
|
virtual void reset() = 0;
|
|
virtual void process (float* l, float* r, int numSamples, const float p[4]) = 0;
|
|
};
|
|
|
|
// ===========================================================================
|
|
// Snapshot of one FX slot.
|
|
// ===========================================================================
|
|
struct FxSlotParams
|
|
{
|
|
int type = (int) FxType::Off;
|
|
float mix = 0.0f;
|
|
float p[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
|
};
|
|
|
|
// ===========================================================================
|
|
// Reorderable effects rack. Slots are processed in list order; reordering is
|
|
// simply swapping FxSlotParams entries. Nine effect unit implementations are
|
|
// owned here and shared across slots.
|
|
// ===========================================================================
|
|
class FXProcessor
|
|
{
|
|
public:
|
|
FXProcessor();
|
|
~FXProcessor();
|
|
|
|
void prepare (double sampleRate, int maxBlockSize);
|
|
void reset();
|
|
|
|
void process (juce::AudioBuffer<float>& buffer, const FxSlotParams* slots, int numSlots);
|
|
|
|
static juce::String fxTypeName (int type);
|
|
|
|
private:
|
|
std::array<std::unique_ptr<FXUnit>, 9> units;
|
|
juce::AudioBuffer<float> dry, wet;
|
|
};
|
|
|
|
} // namespace serum
|