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:
WavetableVoice (WavetableAudioProcessor& p, gin::BandLimitedLookupTables& bandLimitedLookupTables);
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;
float getFilterCutoffNormalized (int idx);
private:
void updateParams (int blockSize);
WavetableAudioProcessor& proc;
gin::BandLimitedLookupTables& bandLimitedLookupTables;
2020-05-21 21:39:47 -07:00
gin::BLLTVoicedStereoOscillator oscillators[Cfg::numOSCs] =
2020-05-20 16:44:46 -07:00
{
bandLimitedLookupTables,
2023-08-23 08:45:23 -07:00
bandLimitedLookupTables,
bandLimitedLookupTables,
bandLimitedLookupTables,
2020-05-20 16:44:46 -07:00
};
gin::Filter filters[Cfg::numFilters];
gin::ADSR filterADSRs[Cfg::numFilters];
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];
2020-05-21 21:39:47 -07:00
gin::BLLTVoicedStereoOscillator::Params oscParams[Cfg::numOSCs];
2020-05-20 16:44:46 -07:00
gin::EasedValueSmoother<float> noteSmoother;
float ampKeyTrack = 1.0f;
};