feat(dsp): add core synthesizer oscillators, wavetable and voice engine
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <JuceHeader.h>
|
||||
#include "Params.h"
|
||||
|
||||
namespace serum
|
||||
{
|
||||
|
||||
// ===========================================================================
|
||||
// Simple sub oscillator: sine or triangle, one/two octaves down or unison.
|
||||
// ===========================================================================
|
||||
class SubOscillator
|
||||
{
|
||||
public:
|
||||
void prepare (double sampleRate) { sr = sampleRate; phase = 0.0; }
|
||||
void reset() { phase = 0.0; }
|
||||
|
||||
void noteOn (double freqHz, int octaveShift);
|
||||
|
||||
// Accumulate into out (mono; the caller pans/levels it).
|
||||
void processAdd (double freqHz, int shape, float level, float& out) noexcept;
|
||||
|
||||
private:
|
||||
double sr = 44100.0;
|
||||
double phase = 0.0;
|
||||
static constexpr double kTwoPi = 6.28318530717958647692;
|
||||
};
|
||||
|
||||
} // namespace serum
|
||||
Reference in New Issue
Block a user