mirror of
https://codeberg.org/armin/wavetable.git
synced 2026-09-01 05:50:46 +02:00
62 lines
1.7 KiB
C++
62 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
#include "Cfg.h"
|
|
|
|
class WavetableAudioProcessor;
|
|
|
|
//==============================================================================
|
|
class WavetableVoice : public gin::SynthesiserVoice,
|
|
public gin::ModVoice
|
|
{
|
|
public:
|
|
WavetableVoice (WavetableAudioProcessor& p);
|
|
|
|
void noteStarted() override;
|
|
void noteRetriggered() override;
|
|
void noteStopped (bool allowTailOff) override;
|
|
|
|
void notePressureChanged() override;
|
|
void noteTimbreChanged() override;
|
|
void notePitchbendChanged() override;
|
|
void noteKeyStateChanged() override {}
|
|
|
|
void setCurrentSampleRate (double newRate) override;
|
|
|
|
void renderNextBlock (juce::AudioBuffer<float>& outputBuffer, int startSample, int numSamples) override;
|
|
|
|
bool isVoiceActive() override;
|
|
|
|
float getFilterCutoffNormalized();
|
|
gin::WTOscillator::Params getLiveWTParams (int osc);
|
|
|
|
private:
|
|
void updateParams (int blockSize);
|
|
|
|
WavetableAudioProcessor& proc;
|
|
|
|
gin::WTVoicedStereoOscillator oscillators[Cfg::numOSCs];
|
|
gin::StereoOscillator noise;
|
|
gin::StereoOscillator sub;
|
|
|
|
gin::Filter filter;
|
|
gin::ADSR filterADSR;
|
|
|
|
gin::ADSR modADSRs[Cfg::numENVs];
|
|
gin::LFO modLFOs[Cfg::numLFOs];
|
|
gin::StepLFO modStepLFO;
|
|
|
|
gin::AnalogADSR adsr;
|
|
|
|
float currentMidiNotes[Cfg::numOSCs];
|
|
gin::WTVoicedStereoOscillatorParams oscParams[Cfg::numOSCs];
|
|
|
|
float subNote = 0.0f;
|
|
gin::StereoOscillator::Params subParams;
|
|
gin::StereoOscillator::Params noiseParams;
|
|
|
|
gin::EasedValueSmoother<float> noteSmoother;
|
|
juce::Random rng;
|
|
|
|
float ampKeyTrack = 1.0f;
|
|
};
|