wavetable/plugin/Source/WavetableVoice.h

61 lines
1.7 KiB
C
Raw Normal View History

2020-05-20 16:44:46 -07:00
#pragma once
#include <JuceHeader.h>
#include "Cfg.h"
class WavetableAudioProcessor;
//==============================================================================
class WavetableVoice : public gin::SynthesiserVoice,
2023-08-23 08:45:23 -07:00
public gin::ModVoice
2020-05-20 16:44:46 -07:00
{
public:
2023-08-23 11:21:37 -07:00
WavetableVoice (WavetableAudioProcessor& p);
2023-08-23 08:45:23 -07:00
2020-05-20 16:44:46 -07:00
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;
2023-08-23 08:45:23 -07:00
void renderNextBlock (juce::AudioBuffer<float>& outputBuffer, int startSample, int numSamples) override;
2020-05-20 16:44:46 -07:00
bool isVoiceActive() override;
2023-08-23 11:21:37 -07:00
float getFilterCutoffNormalized();
2023-08-25 08:24:15 -07:00
gin::WTOscillator::Params getLiveWTParams (int osc);
2020-05-20 16:44:46 -07:00
private:
void updateParams (int blockSize);
WavetableAudioProcessor& proc;
2023-08-23 11:21:37 -07:00
gin::WTVoicedStereoOscillator oscillators[Cfg::numOSCs];
2023-08-26 11:17:03 -07:00
gin::StereoOscillator noise;
gin::StereoOscillator sub;
2020-05-20 16:44:46 -07:00
2023-08-23 11:21:37 -07:00
gin::Filter filter;
gin::ADSR filterADSR;
2020-05-20 16:44:46 -07:00
gin::ADSR modADSRs[Cfg::numENVs];
gin::LFO modLFOs[Cfg::numLFOs];
gin::StepLFO modStepLFO;
gin::AnalogADSR adsr;
2023-08-23 08:45:23 -07:00
float currentMidiNotes[Cfg::numOSCs];
2023-08-31 11:17:49 -07:00
gin::WTVoicedStereoOscillatorParams oscParams[Cfg::numOSCs];
2023-08-26 11:17:03 -07:00
float subNote = 0.0f;
gin::StereoOscillator::Params subParams;
gin::StereoOscillator::Params noiseParams;
2020-05-20 16:44:46 -07:00
gin::EasedValueSmoother<float> noteSmoother;
float ampKeyTrack = 1.0f;
};