mirror of
https://codeberg.org/armin/wavetable.git
synced 2026-09-01 05:50:46 +02:00
Simplify plugin
This commit is contained in:
parent
2e8de090a2
commit
5bbbac164c
7 changed files with 95 additions and 391 deletions
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
namespace Cfg
|
namespace Cfg
|
||||||
{
|
{
|
||||||
constexpr static int numOSCs = 4;
|
constexpr static int numOSCs = 2;
|
||||||
constexpr static int numFilters = 2;
|
|
||||||
constexpr static int numENVs = 3;
|
constexpr static int numENVs = 3;
|
||||||
constexpr static int numLFOs = 3;
|
constexpr static int numLFOs = 3;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,10 @@ public:
|
||||||
class FilterBox : public gin::ParamBox
|
class FilterBox : public gin::ParamBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FilterBox (const juce::String& name, WavetableAudioProcessor& proc_, int idx_)
|
FilterBox (const juce::String& name, WavetableAudioProcessor& proc_)
|
||||||
: gin::ParamBox (name), proc (proc_), idx (idx_)
|
: gin::ParamBox (name), proc (proc_)
|
||||||
{
|
{
|
||||||
auto& flt = proc.filterParams[idx];
|
auto& flt = proc.filterParams;
|
||||||
|
|
||||||
addEnable (flt.enable);
|
addEnable (flt.enable);
|
||||||
|
|
||||||
|
|
@ -67,11 +67,11 @@ public:
|
||||||
addControl (v = new gin::Knob (flt.velocityTracking), 2, 1);
|
addControl (v = new gin::Knob (flt.velocityTracking), 2, 1);
|
||||||
|
|
||||||
freq->setLiveValuesCallback ([this] ()
|
freq->setLiveValuesCallback ([this] ()
|
||||||
{
|
{
|
||||||
if (proc.filterParams[idx].amount->getUserValue() != 0.0f ||
|
if (proc.filterParams.amount->getUserValue() != 0.0f ||
|
||||||
proc.filterParams[idx].keyTracking->getUserValue() != 0.0f ||
|
proc.filterParams.keyTracking->getUserValue() != 0.0f ||
|
||||||
proc.modMatrix.isModulated (gin::ModDstId (proc.filterParams[idx].frequency->getModIndex())))
|
proc.modMatrix.isModulated (gin::ModDstId (proc.filterParams.frequency->getModIndex())))
|
||||||
return proc.getLiveFilterCutoff (idx);
|
return proc.getLiveFilterCutoff();
|
||||||
return juce::Array<float>();
|
return juce::Array<float>();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -80,12 +80,11 @@ public:
|
||||||
{
|
{
|
||||||
gin::ParamBox::paramChanged ();
|
gin::ParamBox::paramChanged ();
|
||||||
|
|
||||||
auto& flt = proc.filterParams[idx];
|
auto& flt = proc.filterParams;
|
||||||
v->setEnabled (flt.amount->getUserValue() != 0.0f);
|
v->setEnabled (flt.amount->getUserValue() != 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
WavetableAudioProcessor& proc;
|
WavetableAudioProcessor& proc;
|
||||||
int idx = 0;
|
|
||||||
gin::ParamComponent::Ptr v;
|
gin::ParamComponent::Ptr v;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -93,10 +92,10 @@ public:
|
||||||
class FilterADSRArea : public gin::ParamArea
|
class FilterADSRArea : public gin::ParamArea
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FilterADSRArea (WavetableAudioProcessor& proc_, int idx_)
|
FilterADSRArea (WavetableAudioProcessor& proc_)
|
||||||
: proc (proc_), idx (idx_)
|
: proc (proc_)
|
||||||
{
|
{
|
||||||
auto& flt = proc.filterParams[idx];
|
auto& flt = proc.filterParams;
|
||||||
|
|
||||||
adsr = new gin::ADSRComponent ();
|
adsr = new gin::ADSRComponent ();
|
||||||
adsr->setParams (flt.attack, flt.decay, flt.sustain, flt.release);
|
adsr->setParams (flt.attack, flt.decay, flt.sustain, flt.release);
|
||||||
|
|
@ -114,7 +113,7 @@ public:
|
||||||
{
|
{
|
||||||
gin::ParamArea::paramChanged ();
|
gin::ParamArea::paramChanged ();
|
||||||
|
|
||||||
auto& flt = proc.filterParams[idx];
|
auto& flt = proc.filterParams;
|
||||||
a->setEnabled (flt.amount->getUserValue() != 0.0f);
|
a->setEnabled (flt.amount->getUserValue() != 0.0f);
|
||||||
d->setEnabled (flt.amount->getUserValue() != 0.0f);
|
d->setEnabled (flt.amount->getUserValue() != 0.0f);
|
||||||
s->setEnabled (flt.amount->getUserValue() != 0.0f);
|
s->setEnabled (flt.amount->getUserValue() != 0.0f);
|
||||||
|
|
@ -123,7 +122,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
WavetableAudioProcessor& proc;
|
WavetableAudioProcessor& proc;
|
||||||
int idx;
|
|
||||||
gin::ParamComponent::Ptr a, d, s, r;
|
gin::ParamComponent::Ptr a, d, s, r;
|
||||||
gin::ADSRComponent* adsr;
|
gin::ADSRComponent* adsr;
|
||||||
};
|
};
|
||||||
|
|
@ -294,52 +292,6 @@ public:
|
||||||
WavetableAudioProcessor& proc;
|
WavetableAudioProcessor& proc;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
class EQBox : public gin::ParamBox
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
EQBox (WavetableAudioProcessor& proc_)
|
|
||||||
: gin::ParamBox ("EQ"), proc (proc_)
|
|
||||||
{
|
|
||||||
addControl (new gin::Knob (proc.eqParams.loFreq), 0, 0);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.loGain), 1, 0);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.loQ), 2, 0);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.mid1Freq), 3, 0);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.mid1Gain), 4, 0);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.mid1Q), 5, 0);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.mid2Freq), 0, 1);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.mid2Gain), 1, 1);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.mid2Q), 2, 1);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.hiFreq), 3, 1);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.hiGain), 4, 1);
|
|
||||||
addControl (new gin::Knob (proc.eqParams.hiQ), 5, 1);
|
|
||||||
|
|
||||||
setSize (308, 163);
|
|
||||||
}
|
|
||||||
|
|
||||||
WavetableAudioProcessor& proc;
|
|
||||||
};
|
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
class CompressBox : public gin::ParamBox
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CompressBox (WavetableAudioProcessor& proc_)
|
|
||||||
: gin::ParamBox ("Compress"), proc (proc_)
|
|
||||||
{
|
|
||||||
addControl (new gin::Knob (proc.compressorParams.ratio), 0, 0);
|
|
||||||
addControl (new gin::Knob (proc.compressorParams.threshold), 1, 0);
|
|
||||||
addControl (new gin::Knob (proc.compressorParams.gain), 2, 0);
|
|
||||||
|
|
||||||
addControl (new gin::Knob (proc.compressorParams.attack), 0.5f, 1.0f);
|
|
||||||
addControl (new gin::Knob (proc.compressorParams.release), 1.5f, 1.0f);
|
|
||||||
|
|
||||||
setSize (168, 163);
|
|
||||||
}
|
|
||||||
|
|
||||||
WavetableAudioProcessor& proc;
|
|
||||||
};
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
class DelayBox : public gin::ParamBox
|
class DelayBox : public gin::ParamBox
|
||||||
{
|
{
|
||||||
|
|
@ -391,24 +343,6 @@ public:
|
||||||
WavetableAudioProcessor& proc;
|
WavetableAudioProcessor& proc;
|
||||||
};
|
};
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
class LimitBox : public gin::ParamBox
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LimitBox (WavetableAudioProcessor& proc_)
|
|
||||||
: gin::ParamBox (""), proc (proc_)
|
|
||||||
{
|
|
||||||
addControl (new gin::Knob (proc.limiterParams.attack), 0, 0);
|
|
||||||
addControl (new gin::Knob (proc.limiterParams.release), 1, 0);
|
|
||||||
addControl (new gin::Knob (proc.limiterParams.threshold), 0, 1);
|
|
||||||
addControl (new gin::Knob (proc.limiterParams.gain), 1, 1);
|
|
||||||
|
|
||||||
setSize (112, 163);
|
|
||||||
}
|
|
||||||
|
|
||||||
WavetableAudioProcessor& proc;
|
|
||||||
};
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
class ScopeArea : public gin::ParamArea
|
class ScopeArea : public gin::ParamArea
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@ public:
|
||||||
: proc ( proc_ )
|
: proc ( proc_ )
|
||||||
{
|
{
|
||||||
for (auto& o : oscillators) addAndMakeVisible (o);
|
for (auto& o : oscillators) addAndMakeVisible (o);
|
||||||
for (auto& f : filters) addAndMakeVisible (f);
|
|
||||||
for (auto& a : fltADSR) addAndMakeVisible (a);
|
|
||||||
for (auto& l : lfos) addAndMakeVisible (l);
|
for (auto& l : lfos) addAndMakeVisible (l);
|
||||||
for (auto& l : lfoGraphs) addAndMakeVisible (l);
|
for (auto& l : lfoGraphs) addAndMakeVisible (l);
|
||||||
|
|
||||||
|
addAndMakeVisible (filter);
|
||||||
|
addAndMakeVisible (fltADSR);
|
||||||
addAndMakeVisible (mix);
|
addAndMakeVisible (mix);
|
||||||
|
|
||||||
for (auto& i : modItems)
|
for (auto& i : modItems)
|
||||||
|
|
@ -41,11 +41,8 @@ public:
|
||||||
effects.addBox (&pattern);
|
effects.addBox (&pattern);
|
||||||
effects.addBox (&chorus);
|
effects.addBox (&chorus);
|
||||||
effects.addBox (&distort);
|
effects.addBox (&distort);
|
||||||
effects.addBox (&eq);
|
|
||||||
effects.addBox (&compress);
|
|
||||||
effects.addBox (&delay);
|
effects.addBox (&delay);
|
||||||
effects.addBox (&reverb);
|
effects.addBox (&reverb);
|
||||||
effects.addBox (&limit);
|
|
||||||
effects.addBox (&scope);
|
effects.addBox (&scope);
|
||||||
|
|
||||||
addAndMakeVisible (effects);
|
addAndMakeVisible (effects);
|
||||||
|
|
@ -80,11 +77,9 @@ public:
|
||||||
rc.removeFromTop (1);
|
rc.removeFromTop (1);
|
||||||
|
|
||||||
auto rcFlt = rc.removeFromTop (163);
|
auto rcFlt = rc.removeFromTop (163);
|
||||||
filters[0].setBounds (rcFlt.removeFromLeft (168)); rcFlt.removeFromLeft (1);
|
filter.setBounds (rcFlt.removeFromLeft (168)); rcFlt.removeFromLeft (1);
|
||||||
fltADSR[0].setBounds (rcFlt.removeFromLeft (186)); rcFlt.removeFromLeft (1);
|
fltADSR.setBounds (rcFlt.removeFromLeft (186)); rcFlt.removeFromLeft (1);
|
||||||
mix.setBounds (rcFlt.removeFromLeft (187)); rcFlt.removeFromLeft (1);
|
mix.setBounds (rcFlt.removeFromLeft (187)); rcFlt.removeFromLeft (1);
|
||||||
fltADSR[1].setBounds (rcFlt.removeFromLeft (186)); rcFlt.removeFromLeft (1);
|
|
||||||
filters[1].setBounds (rcFlt.removeFromLeft (168)); rcFlt.removeFromLeft (1);
|
|
||||||
|
|
||||||
auto rcB1 = rc.removeFromTop (26);
|
auto rcB1 = rc.removeFromTop (26);
|
||||||
modHeader.setBounds (rcB1);
|
modHeader.setBounds (rcB1);
|
||||||
|
|
@ -101,12 +96,11 @@ public:
|
||||||
|
|
||||||
WavetableAudioProcessor& proc;
|
WavetableAudioProcessor& proc;
|
||||||
|
|
||||||
OscillatorBox oscillators[Cfg::numOSCs] { { "oscillator 1", proc, 0 }, { "oscillator 2", proc, 1 },
|
OscillatorBox oscillators[Cfg::numOSCs] { { "oscillator 1", proc, 0 }, { "oscillator 2", proc, 1 } };
|
||||||
{ "oscillator 3", proc, 2 }, { "oscillator 4", proc, 3 } };
|
|
||||||
|
|
||||||
FilterBox filters[Cfg::numFilters] { { "filter 1", proc, 0 }, { "filter 2", proc, 1 } };
|
FilterBox filter { "filter 1", proc };
|
||||||
|
|
||||||
FilterADSRArea fltADSR[Cfg::numFilters] { { proc, 0 }, { proc, 1 } };
|
FilterADSRArea fltADSR { proc };
|
||||||
|
|
||||||
MixBox mix { "osc mix", proc };
|
MixBox mix { "osc mix", proc };
|
||||||
|
|
||||||
|
|
@ -123,14 +117,11 @@ public:
|
||||||
{ "MIDI", nullptr } };
|
{ "MIDI", nullptr } };
|
||||||
gin::HeaderRow modHeader;
|
gin::HeaderRow modHeader;
|
||||||
|
|
||||||
gin::HeaderItem fxItems[8] { { "GATE", proc.gateParams.enable },
|
gin::HeaderItem fxItems[5] { { "GATE", proc.gateParams.enable },
|
||||||
{ "CHORUS", proc.chorusParams.enable },
|
{ "CHORUS", proc.chorusParams.enable },
|
||||||
{ "DISTORT", proc.distortionParams.enable },
|
{ "DISTORT", proc.distortionParams.enable },
|
||||||
{ "EQ", proc.eqParams.enable },
|
|
||||||
{ "COMPRESS", proc.compressorParams.enable },
|
|
||||||
{ "DELAY", proc.delayParams.enable },
|
{ "DELAY", proc.delayParams.enable },
|
||||||
{ "REVERB", proc.reverbParams.enable },
|
{ "REVERB", proc.reverbParams.enable } };
|
||||||
{ "LIMIT", proc.limiterParams.enable } };
|
|
||||||
|
|
||||||
gin::HeaderRow fxHeader;
|
gin::HeaderRow fxHeader;
|
||||||
|
|
||||||
|
|
@ -139,11 +130,8 @@ public:
|
||||||
GateArea pattern { proc };
|
GateArea pattern { proc };
|
||||||
ChorusBox chorus { proc };
|
ChorusBox chorus { proc };
|
||||||
DistortBox distort { proc };
|
DistortBox distort { proc };
|
||||||
EQBox eq { proc };
|
|
||||||
CompressBox compress { proc };
|
|
||||||
DelayBox delay { proc };
|
DelayBox delay { proc };
|
||||||
ReverbBox reverb { proc };
|
ReverbBox reverb { proc };
|
||||||
LimitBox limit { proc };
|
|
||||||
ScopeArea scope { proc };
|
ScopeArea scope { proc };
|
||||||
|
|
||||||
gin::BoxArea lfoBox;
|
gin::BoxArea lfoBox;
|
||||||
|
|
|
||||||
|
|
@ -122,14 +122,14 @@ void WavetableAudioProcessor::OSCParams::setup (WavetableAudioProcessor& p, int
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void WavetableAudioProcessor::FilterParams::setup (WavetableAudioProcessor& p, int idx)
|
void WavetableAudioProcessor::FilterParams::setup (WavetableAudioProcessor& p)
|
||||||
{
|
{
|
||||||
juce::String id = "flt" + juce::String (idx + 1);
|
juce::String id = "flt";
|
||||||
juce::String nm = "FLT" + juce::String (idx + 1) + " ";
|
juce::String nm = "FLT ";
|
||||||
|
|
||||||
float maxFreq = float (gin::getMidiNoteFromHertz (20000.0));
|
float maxFreq = float (gin::getMidiNoteFromHertz (20000.0));
|
||||||
|
|
||||||
enable = p.addIntParam (id + "enable", nm + "Enable", "", "", { 0.0, 1.0, 1.0, 1.0 }, idx == 0 ? 1.0f : 0.0f, 0.0f);
|
enable = p.addIntParam (id + "enable", nm + "Enable", "", "", { 0.0, 1.0, 1.0, 1.0 }, 1.0f, 0.0f);
|
||||||
type = p.addIntParam (id + "type", nm + "Type", "Type", "", { 0.0, 7.0, 1.0, 1.0 }, 0.0, 0.0f, filterTextFunction);
|
type = p.addIntParam (id + "type", nm + "Type", "Type", "", { 0.0, 7.0, 1.0, 1.0 }, 0.0, 0.0f, filterTextFunction);
|
||||||
keyTracking = p.addExtParam (id + "key", nm + "Key", "Key", "%", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
|
keyTracking = p.addExtParam (id + "key", nm + "Key", "Key", "%", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
|
||||||
velocityTracking = p.addExtParam (id + "vel", nm + "Vel", "Vel", "%", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
|
velocityTracking = p.addExtParam (id + "vel", nm + "Vel", "Vel", "%", { 0.0, 100.0, 0.0, 1.0 }, 0.0, 0.0f);
|
||||||
|
|
@ -273,60 +273,6 @@ void WavetableAudioProcessor::DistortionParams::setup (WavetableAudioProcessor&
|
||||||
mix = p.addExtParam ("dsMix", "Mix", "", "", { 0.0, 1.0, 0.0, 1.0 }, 1.0, 0.0f);
|
mix = p.addExtParam ("dsMix", "Mix", "", "", { 0.0, 1.0, 0.0, 1.0 }, 1.0, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
void WavetableAudioProcessor::EQParams::setup (WavetableAudioProcessor& p)
|
|
||||||
{
|
|
||||||
float maxFreq = float (gin::getMidiNoteFromHertz (20000.0));
|
|
||||||
float d1 = float (gin::getMidiNoteFromHertz (80.0));
|
|
||||||
float d2 = float (gin::getMidiNoteFromHertz (3000.0));
|
|
||||||
float d3 = float (gin::getMidiNoteFromHertz (5000.0));
|
|
||||||
float d4 = float (gin::getMidiNoteFromHertz (17000.0));
|
|
||||||
|
|
||||||
enable = p.addIntParam ("eqEnable", "Enable", "", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0f, 0.0f, enableTextFunction);
|
|
||||||
|
|
||||||
loFreq = p.addExtParam ("eqLoFreq", "Lo Freq", "Freq", "Hz", { 0.0, maxFreq, 0.0, 1.0 }, d1, 0.0f, freqTextFunction);
|
|
||||||
loQ = p.addExtParam ("eqLoQ", "Lo Q", "Q", "", { 0.025f, 40.0f, 0.0, 0.2f }, 1.0f, 0.0f);
|
|
||||||
loGain = p.addExtParam ("eqLoGain", "Lo Gain", "Gain", "dB", { -20.0f, 20.0f, 0.0, 1.0 }, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
mid1Freq = p.addExtParam ("eqM1Freq", "Min 1 Freq", "Freq", "Hz", { 0.0, maxFreq, 0.0, 1.0 }, d2, 0.0f, freqTextFunction);
|
|
||||||
mid1Q = p.addExtParam ("eqM1Q", "Min 1 Q", "Q", "", { 0.025f, 40.0f, 0.0, 0.2f }, 1.0f, 0.0f);
|
|
||||||
mid1Gain = p.addExtParam ("eqM1Gain", "Min 1 Gain", "Gain", "dB", { -20.0f, 20.0f, 0.0, 1.0 }, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
mid2Freq = p.addExtParam ("eqM2Freq", "Mid 2 Freq", "Freq", "Hz", { 0.0, maxFreq, 0.0, 1.0 }, d3, 0.0f, freqTextFunction);
|
|
||||||
mid2Q = p.addExtParam ("eqM2Q", "Mid 2 Q", "Q", "", { 0.025f, 40.0f, 0.0, 0.2f }, 1.0f, 0.0f);
|
|
||||||
mid2Gain = p.addExtParam ("eqM2Gain", "Mid 2 Gain", "Gain", "dB", { -20.0f, 20.0f, 0.0, 1.0 }, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
hiFreq = p.addExtParam ("eqHiFreq", "Hi Freq", "Freq", "Hz", { 0.0, maxFreq, 0.0, 1.0 }, d4, 0.0f, freqTextFunction);
|
|
||||||
hiQ = p.addExtParam ("eqHiQ", "Hi Q", "Q", "", { 0.025f, 40.0f, 0.0, 0.2f }, 1.0f, 0.0f);
|
|
||||||
hiGain = p.addExtParam ("eqHiGain", "Hi Gain", "Gain", "dB", { -20.0f, 20.0f, 0.0, 1.0 }, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
loFreq->conversionFunction = [] (float in) { return gin::getMidiNoteInHertz (in); };
|
|
||||||
mid1Freq->conversionFunction = [] (float in) { return gin::getMidiNoteInHertz (in); };
|
|
||||||
mid2Freq->conversionFunction = [] (float in) { return gin::getMidiNoteInHertz (in); };
|
|
||||||
hiFreq->conversionFunction = [] (float in) { return gin::getMidiNoteInHertz (in); };
|
|
||||||
|
|
||||||
loGain->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
|
|
||||||
mid1Gain->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
|
|
||||||
mid2Gain->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
|
|
||||||
hiGain->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
void WavetableAudioProcessor::CompressorParams::setup (WavetableAudioProcessor& p)
|
|
||||||
{
|
|
||||||
enable = p.addIntParam ("cpEnable", "Enable", "", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0f, 0.0f, enableTextFunction);
|
|
||||||
|
|
||||||
attack = p.addExtParam ("cpAttack", "Attack", "", "ms", { 1.0f, 200.0f, 0.0f, 0.4f}, 1.0f, 0.1f);
|
|
||||||
release = p.addExtParam ("cpRelease", "Release", "", "ms", { 1.0f, 2000.0f, 0.0f, 0.4f}, 5.0f, 0.1f);
|
|
||||||
ratio = p.addExtParam ("cpRatio", "Ratio", "", "", { 1.0f, 30.0f, 0.0f, 0.4f}, 5.0f, 0.1f);
|
|
||||||
threshold = p.addExtParam ("cpThreshold", "Thresh", "", "dB", { -60.0f, 0.0f, 0.0f, 1.0f}, -30.0f, 0.1f);
|
|
||||||
gain = p.addExtParam ("cpGain", "Gain", "", "dB", { -30.0f, 30.0f, 0.0f, 1.0f}, 0.0f, 0.1f);
|
|
||||||
|
|
||||||
attack->conversionFunction = [] (float in) { return in / 1000.0f; };
|
|
||||||
release->conversionFunction = [] (float in) { return in / 1000.0f; };
|
|
||||||
gain->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void WavetableAudioProcessor::DelayParams::setup (WavetableAudioProcessor& p)
|
void WavetableAudioProcessor::DelayParams::setup (WavetableAudioProcessor& p)
|
||||||
{
|
{
|
||||||
|
|
@ -360,21 +306,6 @@ void WavetableAudioProcessor::ReverbParams::setup (WavetableAudioProcessor& p)
|
||||||
mix = p.addExtParam ("rvbMix", "Mix", "", "", {0.0f, 1.0f, 0.0f, 1.0f}, 0.0f, 0.0f);
|
mix = p.addExtParam ("rvbMix", "Mix", "", "", {0.0f, 1.0f, 0.0f, 1.0f}, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
void WavetableAudioProcessor::LimiterParams::setup (WavetableAudioProcessor& p)
|
|
||||||
{
|
|
||||||
enable = p.addIntParam ("lmEnable", "Enable", "", "", { 0.0, 1.0, 1.0, 1.0 }, 0.0, 0.0f);
|
|
||||||
|
|
||||||
attack = p.addExtParam ("lmAttack", "Attack", "", "ms", { 1.0f, 5.0f, 0.0f, 0.4f}, 1.0f, 0.1f);
|
|
||||||
release = p.addExtParam ("lmRelease", "Release", "", "ms", { 1.0f, 100.0f, 0.0f, 0.4f}, 5.0f, 0.1f);
|
|
||||||
threshold = p.addExtParam ("lmThreshold", "Ceil", "", "dB", { -60.0f, 0.0f, 0.0f, 1.0f}, -30.0f, 0.1f);
|
|
||||||
gain = p.addExtParam ("lmGain", "Gain", "", "dB", { -30.0f, 30.0f, 0.0f, 1.0f}, 0.0f, 0.1f);
|
|
||||||
|
|
||||||
attack->conversionFunction = [] (float in) { return in / 1000.0f; };
|
|
||||||
release->conversionFunction = [] (float in) { return in / 1000.0f; };
|
|
||||||
gain->conversionFunction = [] (float in) { return juce::Decibels::decibelsToGain (in); };
|
|
||||||
}
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
WavetableAudioProcessor::WavetableAudioProcessor()
|
WavetableAudioProcessor::WavetableAudioProcessor()
|
||||||
{
|
{
|
||||||
|
|
@ -386,8 +317,7 @@ WavetableAudioProcessor::WavetableAudioProcessor()
|
||||||
for (int i = 0; i < juce::numElementsInArray (oscParams); i++)
|
for (int i = 0; i < juce::numElementsInArray (oscParams); i++)
|
||||||
oscParams[i].setup (*this, i);
|
oscParams[i].setup (*this, i);
|
||||||
|
|
||||||
for (int i = 0; i < juce::numElementsInArray (filterParams); i++)
|
filterParams.setup (*this);
|
||||||
filterParams[i].setup (*this, i);
|
|
||||||
|
|
||||||
for (int i = 0; i < juce::numElementsInArray (envParams); i++)
|
for (int i = 0; i < juce::numElementsInArray (envParams); i++)
|
||||||
envParams[i].setup (*this, i);
|
envParams[i].setup (*this, i);
|
||||||
|
|
@ -402,19 +332,12 @@ WavetableAudioProcessor::WavetableAudioProcessor()
|
||||||
gateParams.setup (*this);
|
gateParams.setup (*this);
|
||||||
chorusParams.setup (*this);
|
chorusParams.setup (*this);
|
||||||
distortionParams.setup (*this);
|
distortionParams.setup (*this);
|
||||||
eqParams.setup (*this);
|
|
||||||
compressorParams.setup (*this);
|
|
||||||
delayParams.setup (*this);
|
delayParams.setup (*this);
|
||||||
reverbParams.setup (*this);
|
reverbParams.setup (*this);
|
||||||
limiterParams.setup (*this);
|
|
||||||
|
|
||||||
eq.setNumChannels (2);
|
|
||||||
compressor.setNumChannels (2);
|
|
||||||
limiter.setNumChannels (2);
|
|
||||||
|
|
||||||
for (int i = 0; i < 50; i++)
|
for (int i = 0; i < 50; i++)
|
||||||
{
|
{
|
||||||
auto voice = new WavetableVoice (*this, bandLimitedLookupTables);
|
auto voice = new WavetableVoice (*this);
|
||||||
modMatrix.addVoice (voice);
|
modMatrix.addVoice (voice);
|
||||||
addVoice (voice);
|
addVoice (voice);
|
||||||
}
|
}
|
||||||
|
|
@ -465,9 +388,7 @@ void WavetableAudioProcessor::setupModMatrix()
|
||||||
|
|
||||||
modSrcMonoStep = modMatrix.addMonoModSource ("mstep", "Step LFO (Mono)", true);
|
modSrcMonoStep = modMatrix.addMonoModSource ("mstep", "Step LFO (Mono)", true);
|
||||||
modSrcStep = modMatrix.addPolyModSource ("step", "Step LFO", true);
|
modSrcStep = modMatrix.addPolyModSource ("step", "Step LFO", true);
|
||||||
|
modSrcFilter = modMatrix.addPolyModSource ("fenv", "Filter Envelope", false);
|
||||||
for (int i = 0; i < Cfg::numFilters; i++)
|
|
||||||
modSrcFilter.add (modMatrix.addPolyModSource (juce::String::formatted ("fenv%d", i + 1), juce::String::formatted ("Filter Envelope %d", i + 1), false));
|
|
||||||
|
|
||||||
for (int i = 0; i < Cfg::numENVs; i++)
|
for (int i = 0; i < Cfg::numENVs; i++)
|
||||||
modSrcEnv.add (modMatrix.addPolyModSource (juce::String::formatted ("env%d", i + 1), juce::String::formatted ("Envelope %d", i + 1), false));
|
modSrcEnv.add (modMatrix.addPolyModSource (juce::String::formatted ("env%d", i + 1), juce::String::formatted ("Envelope %d", i + 1), false));
|
||||||
|
|
@ -496,10 +417,6 @@ void WavetableAudioProcessor::reset()
|
||||||
chorus.reset();
|
chorus.reset();
|
||||||
distortion.reset();
|
distortion.reset();
|
||||||
stereoDelay.reset();
|
stereoDelay.reset();
|
||||||
compressor.reset();
|
|
||||||
limiter.reset();
|
|
||||||
|
|
||||||
eq.reset();
|
|
||||||
|
|
||||||
reverb.reset();
|
reverb.reset();
|
||||||
|
|
||||||
|
|
@ -513,7 +430,6 @@ void WavetableAudioProcessor::prepareToPlay (double newSampleRate, int newSample
|
||||||
{
|
{
|
||||||
Processor::prepareToPlay (newSampleRate, newSamplesPerBlock);
|
Processor::prepareToPlay (newSampleRate, newSamplesPerBlock);
|
||||||
|
|
||||||
bandLimitedLookupTables.setSampleRate (newSampleRate);
|
|
||||||
setCurrentPlaybackSampleRate (newSampleRate);
|
setCurrentPlaybackSampleRate (newSampleRate);
|
||||||
|
|
||||||
modMatrix.setSampleRate (newSampleRate);
|
modMatrix.setSampleRate (newSampleRate);
|
||||||
|
|
@ -522,11 +438,6 @@ void WavetableAudioProcessor::prepareToPlay (double newSampleRate, int newSample
|
||||||
chorus.setSampleRate (newSampleRate);
|
chorus.setSampleRate (newSampleRate);
|
||||||
distortion.setSampleRate (newSampleRate);
|
distortion.setSampleRate (newSampleRate);
|
||||||
stereoDelay.setSampleRate (newSampleRate);
|
stereoDelay.setSampleRate (newSampleRate);
|
||||||
compressor.setSampleRate (newSampleRate);
|
|
||||||
limiter.setSampleRate (newSampleRate);
|
|
||||||
|
|
||||||
eq.setSampleRate (newSampleRate);
|
|
||||||
|
|
||||||
reverb.setSampleRate (newSampleRate);
|
reverb.setSampleRate (newSampleRate);
|
||||||
|
|
||||||
for (auto& l : modLFOs)
|
for (auto& l : modLFOs)
|
||||||
|
|
@ -583,7 +494,7 @@ void WavetableAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, ju
|
||||||
endBlock (buffer.getNumSamples());
|
endBlock (buffer.getNumSamples());
|
||||||
}
|
}
|
||||||
|
|
||||||
juce::Array<float> WavetableAudioProcessor::getLiveFilterCutoff (int i)
|
juce::Array<float> WavetableAudioProcessor::getLiveFilterCutoff()
|
||||||
{
|
{
|
||||||
juce::Array<float> values;
|
juce::Array<float> values;
|
||||||
|
|
||||||
|
|
@ -592,7 +503,7 @@ juce::Array<float> WavetableAudioProcessor::getLiveFilterCutoff (int i)
|
||||||
if (v->isActive())
|
if (v->isActive())
|
||||||
{
|
{
|
||||||
auto vav = dynamic_cast<WavetableVoice*>(v);
|
auto vav = dynamic_cast<WavetableVoice*>(v);
|
||||||
values.add (vav->getFilterCutoffNormalized (i));
|
values.add (vav->getFilterCutoffNormalized());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
|
|
@ -612,14 +523,6 @@ void WavetableAudioProcessor::applyEffects (juce::AudioSampleBuffer& buffer)
|
||||||
if (distortionParams.enable->isOn())
|
if (distortionParams.enable->isOn())
|
||||||
distortion.process (buffer);
|
distortion.process (buffer);
|
||||||
|
|
||||||
// Apply EQ
|
|
||||||
if (eqParams.enable->isOn())
|
|
||||||
eq.process (buffer);
|
|
||||||
|
|
||||||
// Apply Compressor
|
|
||||||
if (compressorParams.enable->isOn())
|
|
||||||
compressor.process (buffer);
|
|
||||||
|
|
||||||
// Apply Delay
|
// Apply Delay
|
||||||
if (delayParams.enable->isOn())
|
if (delayParams.enable->isOn())
|
||||||
stereoDelay.process (buffer);
|
stereoDelay.process (buffer);
|
||||||
|
|
@ -628,10 +531,6 @@ void WavetableAudioProcessor::applyEffects (juce::AudioSampleBuffer& buffer)
|
||||||
if (reverbParams.enable->isOn())
|
if (reverbParams.enable->isOn())
|
||||||
reverb.processStereo (buffer.getWritePointer (0), buffer.getWritePointer (1), buffer.getNumSamples ());
|
reverb.processStereo (buffer.getWritePointer (0), buffer.getWritePointer (1), buffer.getNumSamples ());
|
||||||
|
|
||||||
// Apply Limiter
|
|
||||||
if (limiterParams.enable->isOn())
|
|
||||||
limiter.process (buffer);
|
|
||||||
|
|
||||||
// Output gain
|
// Output gain
|
||||||
outputGain.process (buffer);
|
outputGain.process (buffer);
|
||||||
}
|
}
|
||||||
|
|
@ -727,44 +626,6 @@ void WavetableAudioProcessor::updateParams (int newBlockSize)
|
||||||
modMatrix.getValue (distortionParams.mix));
|
modMatrix.getValue (distortionParams.mix));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update EQ
|
|
||||||
if (eqParams.enable->isOn())
|
|
||||||
{
|
|
||||||
eq.setParams (0, gin::EQ::lowshelf,
|
|
||||||
modMatrix.getValue (eqParams.loFreq),
|
|
||||||
modMatrix.getValue (eqParams.loQ),
|
|
||||||
modMatrix.getValue (eqParams.loGain));
|
|
||||||
|
|
||||||
eq.setParams (1, gin::EQ::peak,
|
|
||||||
modMatrix.getValue (eqParams.mid1Freq),
|
|
||||||
modMatrix.getValue (eqParams.mid1Q),
|
|
||||||
modMatrix.getValue (eqParams.mid1Gain));
|
|
||||||
|
|
||||||
eq.setParams (2, gin::EQ::peak,
|
|
||||||
modMatrix.getValue (eqParams.mid2Freq),
|
|
||||||
modMatrix.getValue (eqParams.mid2Q),
|
|
||||||
modMatrix.getValue (eqParams.mid2Gain));
|
|
||||||
|
|
||||||
eq.setParams (3, gin::EQ::highshelf,
|
|
||||||
modMatrix.getValue (eqParams.hiFreq),
|
|
||||||
modMatrix.getValue (eqParams.hiQ),
|
|
||||||
modMatrix.getValue (eqParams.hiGain));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update Compressor
|
|
||||||
if (compressorParams.enable->isOn())
|
|
||||||
{
|
|
||||||
compressor.setInputGain (1.0f);
|
|
||||||
compressor.setOutputGain (modMatrix.getValue (compressorParams.gain));
|
|
||||||
compressor.setParams (modMatrix.getValue (compressorParams.attack),
|
|
||||||
0,
|
|
||||||
modMatrix.getValue (compressorParams.release),
|
|
||||||
modMatrix.getValue (compressorParams.threshold),
|
|
||||||
modMatrix.getValue (compressorParams.ratio),
|
|
||||||
6);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update Delay
|
// Update Delay
|
||||||
if (delayParams.enable->isOn())
|
if (delayParams.enable->isOn())
|
||||||
{
|
{
|
||||||
|
|
@ -803,18 +664,6 @@ void WavetableAudioProcessor::updateParams (int newBlockSize)
|
||||||
reverb.setParameters (p);
|
reverb.setParameters (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Limiter
|
|
||||||
if (limiterParams.enable->isOn())
|
|
||||||
{
|
|
||||||
limiter.setInputGain (1.0f);
|
|
||||||
limiter.setOutputGain (modMatrix.getValue (limiterParams.gain));
|
|
||||||
limiter.setParams (modMatrix.getValue (limiterParams.attack),
|
|
||||||
0,
|
|
||||||
modMatrix.getValue (limiterParams.release),
|
|
||||||
modMatrix.getValue (limiterParams.threshold),
|
|
||||||
100, 6);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Output gain
|
// Output gain
|
||||||
outputGain.setGain (modMatrix.getValue (globalParams.level));
|
outputGain.setGain (modMatrix.getValue (globalParams.level));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,13 +30,11 @@ public:
|
||||||
void updateParams (int blockSize);
|
void updateParams (int blockSize);
|
||||||
void setupModMatrix();
|
void setupModMatrix();
|
||||||
|
|
||||||
gin::BandLimitedLookupTables bandLimitedLookupTables;
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
void handleMidiEvent (const juce::MidiMessage& m) override;
|
void handleMidiEvent (const juce::MidiMessage& m) override;
|
||||||
void handleController (int ch, int num, int val) override;
|
void handleController (int ch, int num, int val) override;
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
juce::Array<float> getLiveFilterCutoff (int idx);
|
juce::Array<float> getLiveFilterCutoff();
|
||||||
|
|
||||||
void applyEffects (juce::AudioSampleBuffer& buffer);
|
void applyEffects (juce::AudioSampleBuffer& buffer);
|
||||||
|
|
||||||
|
|
@ -61,7 +59,7 @@ public:
|
||||||
frequency, resonance, amount,
|
frequency, resonance, amount,
|
||||||
attack, decay, sustain, release;
|
attack, decay, sustain, release;
|
||||||
|
|
||||||
void setup (WavetableAudioProcessor& p, int idx);
|
void setup (WavetableAudioProcessor& p);
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE (FilterParams)
|
JUCE_DECLARE_NON_COPYABLE (FilterParams)
|
||||||
};
|
};
|
||||||
|
|
@ -158,32 +156,6 @@ public:
|
||||||
JUCE_DECLARE_NON_COPYABLE (DistortionParams)
|
JUCE_DECLARE_NON_COPYABLE (DistortionParams)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EQParams
|
|
||||||
{
|
|
||||||
EQParams() = default;
|
|
||||||
|
|
||||||
gin::Parameter::Ptr enable,
|
|
||||||
loFreq, loGain, loQ,
|
|
||||||
mid1Freq, mid1Gain, mid1Q,
|
|
||||||
mid2Freq, mid2Gain, mid2Q,
|
|
||||||
hiFreq, hiGain, hiQ;
|
|
||||||
|
|
||||||
void setup (WavetableAudioProcessor& p);
|
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE (EQParams)
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CompressorParams
|
|
||||||
{
|
|
||||||
CompressorParams() = default;
|
|
||||||
|
|
||||||
gin::Parameter::Ptr enable, attack, release, ratio, threshold, gain;
|
|
||||||
|
|
||||||
void setup (WavetableAudioProcessor& p);
|
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE (CompressorParams)
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DelayParams
|
struct DelayParams
|
||||||
{
|
{
|
||||||
DelayParams() = default;
|
DelayParams() = default;
|
||||||
|
|
@ -206,27 +178,16 @@ public:
|
||||||
JUCE_DECLARE_NON_COPYABLE (ReverbParams)
|
JUCE_DECLARE_NON_COPYABLE (ReverbParams)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LimiterParams
|
|
||||||
{
|
|
||||||
LimiterParams() = default;
|
|
||||||
|
|
||||||
gin::Parameter::Ptr enable, attack, release, threshold, gain;
|
|
||||||
|
|
||||||
void setup (WavetableAudioProcessor& p);
|
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE (LimiterParams)
|
|
||||||
};
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
gin::ModSrcId modSrcPressure, modSrcTimbre, modScrPitchBend,
|
gin::ModSrcId modSrcPressure, modSrcTimbre, modScrPitchBend, modSrcFilter,
|
||||||
modSrcNote, modSrcVelocity, modSrcStep, modSrcMonoStep;
|
modSrcNote, modSrcVelocity, modSrcStep, modSrcMonoStep;
|
||||||
|
|
||||||
juce::Array<gin::ModSrcId> modSrcCC, modSrcMonoLFO, modSrcLFO, modSrcFilter, modSrcEnv;
|
juce::Array<gin::ModSrcId> modSrcCC, modSrcMonoLFO, modSrcLFO, modSrcEnv;
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
OSCParams oscParams[Cfg::numOSCs];
|
OSCParams oscParams[Cfg::numOSCs];
|
||||||
FilterParams filterParams[Cfg::numFilters];
|
FilterParams filterParams;
|
||||||
EnvParams envParams[Cfg::numENVs];
|
EnvParams envParams[Cfg::numENVs];
|
||||||
LFOParams lfoParams[Cfg::numLFOs];
|
LFOParams lfoParams[Cfg::numLFOs];
|
||||||
StepLFOParams stepLfoParams;
|
StepLFOParams stepLfoParams;
|
||||||
|
|
@ -237,20 +198,14 @@ public:
|
||||||
GateParams gateParams;
|
GateParams gateParams;
|
||||||
ChorusParams chorusParams;
|
ChorusParams chorusParams;
|
||||||
DistortionParams distortionParams;
|
DistortionParams distortionParams;
|
||||||
EQParams eqParams;
|
|
||||||
CompressorParams compressorParams;
|
|
||||||
DelayParams delayParams;
|
DelayParams delayParams;
|
||||||
ReverbParams reverbParams;
|
ReverbParams reverbParams;
|
||||||
LimiterParams limiterParams;
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
gin::GateEffect gate;
|
gin::GateEffect gate;
|
||||||
gin::Modulation chorus { 0.5f };
|
gin::Modulation chorus { 0.5f };
|
||||||
gin::Distortion distortion;
|
gin::Distortion distortion;
|
||||||
gin::StereoDelay stereoDelay { 120.1 };
|
gin::StereoDelay stereoDelay { 120.1 };
|
||||||
gin::Dynamics compressor;
|
|
||||||
gin::Dynamics limiter;
|
|
||||||
gin::EQ eq {4};
|
|
||||||
juce::Reverb reverb;
|
juce::Reverb reverb;
|
||||||
gin::GainProcessor outputGain;
|
gin::GainProcessor outputGain;
|
||||||
gin::AudioFifo fifo { 2, 44100 };
|
gin::AudioFifo fifo { 2, 44100 };
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,10 @@
|
||||||
#include "PluginProcessor.h"
|
#include "PluginProcessor.h"
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
WavetableVoice::WavetableVoice (WavetableAudioProcessor& p, gin::BandLimitedLookupTables& bllt)
|
WavetableVoice::WavetableVoice (WavetableAudioProcessor& p)
|
||||||
: proc (p)
|
: proc (p)
|
||||||
, bandLimitedLookupTables (bllt)
|
|
||||||
{
|
{
|
||||||
for (auto& f : filters)
|
filter.setNumChannels (2);
|
||||||
f.setNumChannels (2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WavetableVoice::noteStarted()
|
void WavetableVoice::noteStarted()
|
||||||
|
|
@ -33,11 +31,8 @@ void WavetableVoice::noteStarted()
|
||||||
|
|
||||||
juce::ScopedValueSetter<bool> svs (disableSmoothing, true);
|
juce::ScopedValueSetter<bool> svs (disableSmoothing, true);
|
||||||
|
|
||||||
for (auto& f : filters)
|
filter.reset();
|
||||||
f.reset();
|
filterADSR.reset();
|
||||||
|
|
||||||
for (auto& a : filterADSRs)
|
|
||||||
a.reset();
|
|
||||||
|
|
||||||
for (auto& a : modADSRs)
|
for (auto& a : modADSRs)
|
||||||
a.noteOn();
|
a.noteOn();
|
||||||
|
|
@ -53,8 +48,7 @@ void WavetableVoice::noteStarted()
|
||||||
for (auto& osc : oscillators)
|
for (auto& osc : oscillators)
|
||||||
osc.noteOn();
|
osc.noteOn();
|
||||||
|
|
||||||
for (auto& a : filterADSRs)
|
filterADSR.noteOn();
|
||||||
a.noteOn();
|
|
||||||
|
|
||||||
for (auto& a : modADSRs)
|
for (auto& a : modADSRs)
|
||||||
a.noteOn();
|
a.noteOn();
|
||||||
|
|
@ -92,8 +86,7 @@ void WavetableVoice::noteRetriggered()
|
||||||
for (auto& osc : oscillators)
|
for (auto& osc : oscillators)
|
||||||
osc.noteOn();
|
osc.noteOn();
|
||||||
|
|
||||||
for (auto& a : filterADSRs)
|
filterADSR.noteOn();
|
||||||
a.noteOn();
|
|
||||||
|
|
||||||
for (auto& a : modADSRs)
|
for (auto& a : modADSRs)
|
||||||
a.noteOn();
|
a.noteOn();
|
||||||
|
|
@ -105,9 +98,7 @@ void WavetableVoice::noteRetriggered()
|
||||||
void WavetableVoice::noteStopped (bool allowTailOff)
|
void WavetableVoice::noteStopped (bool allowTailOff)
|
||||||
{
|
{
|
||||||
adsr.noteOff();
|
adsr.noteOff();
|
||||||
|
filterADSR.noteOff();
|
||||||
for (auto& a : filterADSRs)
|
|
||||||
a.noteOff();
|
|
||||||
|
|
||||||
for (auto& a : modADSRs)
|
for (auto& a : modADSRs)
|
||||||
a.noteOff();
|
a.noteOff();
|
||||||
|
|
@ -138,11 +129,9 @@ void WavetableVoice::setCurrentSampleRate (double newRate)
|
||||||
for (auto& osc : oscillators)
|
for (auto& osc : oscillators)
|
||||||
osc.setSampleRate (newRate);
|
osc.setSampleRate (newRate);
|
||||||
|
|
||||||
for (auto& f : filters)
|
filter.setSampleRate (newRate);
|
||||||
f.setSampleRate (newRate);
|
|
||||||
|
|
||||||
for (auto& a : filterADSRs)
|
filterADSR.setSampleRate (newRate);
|
||||||
a.setSampleRate (newRate);
|
|
||||||
|
|
||||||
for (auto& l : modLFOs)
|
for (auto& l : modLFOs)
|
||||||
l.setSampleRate (newRate);
|
l.setSampleRate (newRate);
|
||||||
|
|
@ -168,9 +157,8 @@ void WavetableVoice::renderNextBlock (juce::AudioBuffer<float>& outputBuffer, in
|
||||||
buffer.applyGain (gin::velocityToGain (velocity, ampKeyTrack));
|
buffer.applyGain (gin::velocityToGain (velocity, ampKeyTrack));
|
||||||
|
|
||||||
// Apply filters
|
// Apply filters
|
||||||
for (int i = 0; i < juce::numElementsInArray (filters); i++)
|
if (proc.filterParams.enable->isOn())
|
||||||
if (proc.filterParams[i].enable->isOn())
|
filter.process (buffer);
|
||||||
filters[i].process (buffer);
|
|
||||||
|
|
||||||
// Run ADSR
|
// Run ADSR
|
||||||
adsr.processMultiplying (buffer);
|
adsr.processMultiplying (buffer);
|
||||||
|
|
@ -215,75 +203,73 @@ void WavetableVoice::updateParams (int blockSize)
|
||||||
|
|
||||||
ampKeyTrack = getValue (proc.adsrParams.velocityTracking);
|
ampKeyTrack = getValue (proc.adsrParams.velocityTracking);
|
||||||
|
|
||||||
for (int i = 0; i < Cfg::numFilters; i++)
|
if (! proc.filterParams.enable->isOn())
|
||||||
{
|
{
|
||||||
if (! proc.filterParams[i].enable->isOn())
|
proc.modMatrix.setPolyValue (*this, proc.modSrcFilter, 0);
|
||||||
{
|
}
|
||||||
proc.modMatrix.setPolyValue (*this, proc.modSrcFilter[i], 0);
|
else
|
||||||
continue;
|
{
|
||||||
}
|
filterADSR.setAttack (getValue (proc.filterParams.attack));
|
||||||
|
filterADSR.setSustainLevel (getValue (proc.filterParams.sustain));
|
||||||
filterADSRs[i].setAttack (getValue (proc.filterParams[i].attack));
|
filterADSR.setDecay (getValue (proc.filterParams.decay));
|
||||||
filterADSRs[i].setSustainLevel (getValue (proc.filterParams[i].sustain));
|
filterADSR.setRelease (getValue (proc.filterParams.release));
|
||||||
filterADSRs[i].setDecay (getValue (proc.filterParams[i].decay));
|
|
||||||
filterADSRs[i].setRelease (getValue (proc.filterParams[i].release));
|
|
||||||
|
|
||||||
filterADSRs[i].process (blockSize);
|
filterADSR.process (blockSize);
|
||||||
|
|
||||||
float filterWidth = float (gin::getMidiNoteFromHertz (20000.0));
|
float filterWidth = float (gin::getMidiNoteFromHertz (20000.0));
|
||||||
float filterEnv = filterADSRs[i].getOutput();
|
float filterEnv = filterADSR.getOutput();
|
||||||
float filterSens = getValue (proc.filterParams[i].velocityTracking);
|
float filterSens = getValue (proc.filterParams.velocityTracking);
|
||||||
filterSens = currentlyPlayingNote.noteOnVelocity.asUnsignedFloat() * filterSens + 1.0f - filterSens;
|
filterSens = currentlyPlayingNote.noteOnVelocity.asUnsignedFloat() * filterSens + 1.0f - filterSens;
|
||||||
|
|
||||||
float n = getValue (proc.filterParams[i].frequency);
|
float n = getValue (proc.filterParams.frequency);
|
||||||
n += (currentlyPlayingNote.initialNote - 60) * getValue (proc.filterParams[i].keyTracking);
|
n += (currentlyPlayingNote.initialNote - 60) * getValue (proc.filterParams.keyTracking);
|
||||||
n += filterEnv * filterSens * getValue (proc.filterParams[i].amount) * filterWidth;
|
n += filterEnv * filterSens * getValue (proc.filterParams.amount) * filterWidth;
|
||||||
|
|
||||||
float f = gin::getMidiNoteInHertz (n);
|
float f = gin::getMidiNoteInHertz (n);
|
||||||
float maxFreq = std::min (20000.0f, float (getSampleRate() / 2));
|
float maxFreq = std::min (20000.0f, float (getSampleRate() / 2));
|
||||||
f = juce::jlimit (4.0f, maxFreq, f);
|
f = juce::jlimit (4.0f, maxFreq, f);
|
||||||
|
|
||||||
float q = gin::Q / (1.0f - (getValue (proc.filterParams[i].resonance) / 100.0f) * 0.99f);
|
float q = gin::Q / (1.0f - (getValue (proc.filterParams.resonance) / 100.0f) * 0.99f);
|
||||||
|
|
||||||
switch (int (proc.filterParams[i].type->getProcValue()))
|
switch (int (proc.filterParams.type->getProcValue()))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
filters[i].setType (gin::Filter::lowpass);
|
filter.setType (gin::Filter::lowpass);
|
||||||
filters[i].setSlope (gin::Filter::db12);
|
filter.setSlope (gin::Filter::db12);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
filters[i].setType (gin::Filter::lowpass);
|
filter.setType (gin::Filter::lowpass);
|
||||||
filters[i].setSlope (gin::Filter::db24);
|
filter.setSlope (gin::Filter::db24);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
filters[i].setType (gin::Filter::highpass);
|
filter.setType (gin::Filter::highpass);
|
||||||
filters[i].setSlope (gin::Filter::db12);
|
filter.setSlope (gin::Filter::db12);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
filters[i].setType (gin::Filter::highpass);
|
filter.setType (gin::Filter::highpass);
|
||||||
filters[i].setSlope (gin::Filter::db24);
|
filter.setSlope (gin::Filter::db24);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
filters[i].setType (gin::Filter::bandpass);
|
filter.setType (gin::Filter::bandpass);
|
||||||
filters[i].setSlope (gin::Filter::db12);
|
filter.setSlope (gin::Filter::db12);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
filters[i].setType (gin::Filter::bandpass);
|
filter.setType (gin::Filter::bandpass);
|
||||||
filters[i].setSlope (gin::Filter::db24);
|
filter.setSlope (gin::Filter::db24);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
filters[i].setType (gin::Filter::notch);
|
filter.setType (gin::Filter::notch);
|
||||||
filters[i].setSlope (gin::Filter::db12);
|
filter.setSlope (gin::Filter::db12);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
filters[i].setType (gin::Filter::notch);
|
filter.setType (gin::Filter::notch);
|
||||||
filters[i].setSlope (gin::Filter::db24);
|
filter.setSlope (gin::Filter::db24);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
filters[i].setParams (f, q);
|
|
||||||
|
|
||||||
proc.modMatrix.setPolyValue (*this, proc.modSrcFilter[i], filterADSRs[i].getOutput());
|
filter.setParams (f, q);
|
||||||
|
|
||||||
|
proc.modMatrix.setPolyValue (*this, proc.modSrcFilter, filterADSR.getOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < Cfg::numENVs; i++)
|
for (int i = 0; i < Cfg::numENVs; i++)
|
||||||
|
|
@ -370,8 +356,8 @@ bool WavetableVoice::isVoiceActive()
|
||||||
return isActive();
|
return isActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
float WavetableVoice::getFilterCutoffNormalized (int idx)
|
float WavetableVoice::getFilterCutoffNormalized()
|
||||||
{
|
{
|
||||||
float freq = filters[idx].getFrequency();
|
float freq = filter.getFrequency();
|
||||||
return proc.filterParams[idx].frequency->getUserRange().convertTo0to1 (gin::getMidiNoteFromHertz (freq));
|
return proc.filterParams.frequency->getUserRange().convertTo0to1 (gin::getMidiNoteFromHertz (freq));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class WavetableVoice : public gin::SynthesiserVoice,
|
||||||
public gin::ModVoice
|
public gin::ModVoice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WavetableVoice (WavetableAudioProcessor& p, gin::BandLimitedLookupTables& bandLimitedLookupTables);
|
WavetableVoice (WavetableAudioProcessor& p);
|
||||||
|
|
||||||
void noteStarted() override;
|
void noteStarted() override;
|
||||||
void noteRetriggered() override;
|
void noteRetriggered() override;
|
||||||
|
|
@ -27,24 +27,17 @@ public:
|
||||||
|
|
||||||
bool isVoiceActive() override;
|
bool isVoiceActive() override;
|
||||||
|
|
||||||
float getFilterCutoffNormalized (int idx);
|
float getFilterCutoffNormalized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateParams (int blockSize);
|
void updateParams (int blockSize);
|
||||||
|
|
||||||
WavetableAudioProcessor& proc;
|
WavetableAudioProcessor& proc;
|
||||||
gin::BandLimitedLookupTables& bandLimitedLookupTables;
|
|
||||||
|
|
||||||
gin::BLLTVoicedStereoOscillator oscillators[Cfg::numOSCs] =
|
gin::WTVoicedStereoOscillator oscillators[Cfg::numOSCs];
|
||||||
{
|
|
||||||
bandLimitedLookupTables,
|
|
||||||
bandLimitedLookupTables,
|
|
||||||
bandLimitedLookupTables,
|
|
||||||
bandLimitedLookupTables,
|
|
||||||
};
|
|
||||||
|
|
||||||
gin::Filter filters[Cfg::numFilters];
|
gin::Filter filter;
|
||||||
gin::ADSR filterADSRs[Cfg::numFilters];
|
gin::ADSR filterADSR;
|
||||||
|
|
||||||
gin::ADSR modADSRs[Cfg::numENVs];
|
gin::ADSR modADSRs[Cfg::numENVs];
|
||||||
gin::LFO modLFOs[Cfg::numLFOs];
|
gin::LFO modLFOs[Cfg::numLFOs];
|
||||||
|
|
@ -53,7 +46,7 @@ private:
|
||||||
gin::AnalogADSR adsr;
|
gin::AnalogADSR adsr;
|
||||||
|
|
||||||
float currentMidiNotes[Cfg::numOSCs];
|
float currentMidiNotes[Cfg::numOSCs];
|
||||||
gin::BLLTVoicedStereoOscillator::Params oscParams[Cfg::numOSCs];
|
gin::WTVoicedStereoOscillator::Params oscParams[Cfg::numOSCs];
|
||||||
|
|
||||||
gin::EasedValueSmoother<float> noteSmoother;
|
gin::EasedValueSmoother<float> noteSmoother;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue