diff --git a/modules/gin b/modules/gin index 051b646..3ee3c72 160000 --- a/modules/gin +++ b/modules/gin @@ -1 +1 @@ -Subproject commit 051b6464cd5bc26a1b721ef74de53704a92e2406 +Subproject commit 3ee3c72bad475a7aa7969ca638ad860147d68f19 diff --git a/plugin/Resources/layout.json b/plugin/Resources/layout.json index 72fb627..543bcd4 100644 --- a/plugin/Resources/layout.json +++ b/plugin/Resources/layout.json @@ -2,7 +2,14 @@ "children": [ { "id": "osc[1..2]", "x": "0,prevR()+1", "y": 0, "w": "parW()/2", "h": 163 }, - { "id": "flt", "x": "0", "y": "prevB()+1", "w": 400, "h": 163 }, + { "id": "flt", "x": "0", "y": "prevB()+1", "w": 400, "h": 163, "children": + [ + { "id": "FLT WT1", "x": 24, "y": 6, "w": 12, "h": 12 }, + { "id": "FLT WT2", "x": "prevR()+6", "y": 6, "w": 12, "h": 12 }, + { "id": "FLT sub", "x": "prevR()+6", "y": 6, "w": 12, "h": 12 }, + { "id": "FLT noise", "x": "prevR()+6", "y": 6, "w": 12, "h": 12 } + ] + }, { "id": "adsr", "x": "prevR()+1", "y": "prevY()", "w": 240, "h": 163 }, { "id": "noise", "x": "prevR()+1", "y": "prevY()", "w": 120, "h": 163 }, { "id": "sub", "x": "prevR()+1", "y": "prevY()", "w": 120, "h": 163 }, diff --git a/plugin/Source/Panels.h b/plugin/Source/Panels.h index fba2ece..31b57ef 100644 --- a/plugin/Source/Panels.h +++ b/plugin/Source/Panels.h @@ -247,6 +247,11 @@ public: return juce::Array(); }); + addControl (new gin::SVGPluginButton (flt.wt1, asset1)); + addControl (new gin::SVGPluginButton (flt.wt2, asset2)); + addControl (new gin::SVGPluginButton (flt.sub, assetS)); + addControl (new gin::SVGPluginButton (flt.noise, assetN)); + watchParam (flt.amount); } @@ -267,6 +272,11 @@ public: WavetableAudioProcessor& proc; gin::ParamComponent::Ptr v, a, d, s, r; gin::ADSRComponent* adsr; + + juce::String asset1 = "M0 96C0 60.7 28.7 32 64 32H384c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zm236 35.2c-7.4-4.3-16.5-4.3-24-.1l-56 32c-11.5 6.6-15.5 21.2-8.9 32.7s21.2 15.5 32.7 8.9L200 193.4V336H160c-13.3 0-24 10.7-24 24s10.7 24 24 24h64 64c13.3 0 24-10.7 24-24s-10.7-24-24-24H248V152c0-8.6-4.6-16.5-12-20.8z"; + juce::String asset2 = "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM190.7 184.7l-24.2 18.4c-10.5 8-25.6 6-33.6-4.5s-6-25.6 4.5-33.6l24.2-18.4c15.8-12 35.2-18.4 55.1-18.1l3.4 .1c46.5 .7 83.8 38.6 83.8 85.1c0 23.5-9.7 46-26.9 62.1L212.7 336H296c13.3 0 24 10.7 24 24s-10.7 24-24 24H152c-9.8 0-18.7-6-22.3-15.2s-1.3-19.6 5.9-26.3L244.3 240.6c7.5-7 11.7-16.8 11.7-27.1c0-20.3-16.3-36.8-36.6-37.1l-3.4-.1c-9.1-.1-18 2.8-25.3 8.3z"; + juce::String assetS = "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM175.6 196.2c-1.1 6.4-.2 9.7 .6 11.6c1 2 2.9 4.6 7.4 7.7c10.1 6.8 25.7 11.5 46.8 17.4l2 .6 0 0c18.4 5.2 41.4 11.7 58.6 23.2c9.5 6.4 18.5 15.1 24.1 27.2c5.7 12.3 7 25.9 4.4 40.3c-4.7 26.3-23.1 43.3-45 52c-21.3 8.4-47 9.6-72.6 5.7l-.1 0 0 0c-16.3-2.6-43.7-10.7-57.3-15.1c-12.6-4-19.6-17.6-15.5-30.2s17.6-19.6 30.2-15.5c13.9 4.5 37.8 11.4 50 13.4c20.2 3 36.8 1.4 47.7-2.9c10.3-4.1 14.2-9.6 15.4-15.8c1.1-6.4 .2-9.7-.6-11.6c-1-2-2.9-4.6-7.4-7.7c-10.1-6.8-25.7-11.5-46.8-17.4l-2-.6c-18.4-5.2-41.4-11.7-58.6-23.2c-9.5-6.4-18.5-15.1-24.1-27.2c-5.7-12.3-7-25.9-4.4-40.3c4.7-26.3 23.1-43.3 45-52c21.3-8.4 47-9.6 72.6-5.7c8.1 1.2 24.4 4.8 32 6.7c12.8 3.3 20.6 16.4 17.3 29.2s-16.4 20.6-29.2 17.3c-6.7-1.7-21.3-4.9-27.3-5.7c-20.3-3.1-36.8-1.4-47.8 2.9c-10.3 4.1-14.2 9.6-15.4 15.8z"; + juce::String assetN = "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm90.3 104.5L288 294.5V152c0-13.3 10.7-24 24-24s24 10.7 24 24V360c0 10.1-6.3 19.1-15.7 22.5s-20.1 .7-26.6-7L160 217.5V360c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-10.1 6.3-19.1 15.7-22.5s20.1-.7 26.6 7z"; }; //============================================================================== diff --git a/plugin/Source/PluginProcessor.cpp b/plugin/Source/PluginProcessor.cpp index ec0bdbc..481d047 100644 --- a/plugin/Source/PluginProcessor.cpp +++ b/plugin/Source/PluginProcessor.cpp @@ -161,6 +161,10 @@ void WavetableAudioProcessor::FilterParams::setup (WavetableAudioProcessor& p) decay = p.addExtParam (id + "decay", nm + "Decay", "D", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f); sustain = p.addExtParam (id + "sustain", nm + "Sustain", "S", "%", { 0.0, 100.0, 0.0, 1.0 }, 80.0f, 0.0f); release = p.addExtParam (id + "release", nm + "Release", "R", "s", { 0.0, 60.0, 0.0, 0.2f }, 0.1f, 0.0f); + wt1 = p.addIntParam (id + "wt1", nm + "WT1", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f); + wt2 = p.addIntParam (id + "wt2", nm + "WT2", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f); + sub = p.addIntParam (id + "sub", nm + "sub", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f); + noise = p.addIntParam (id + "noise", nm + "noise", "", "", { 0.0, 1.0, 1.0, 1.0f }, 1.0f, 0.0f); sustain->conversionFunction = [] (float in) { return in / 100.0f; }; velocityTracking->conversionFunction = [] (float in) { return in / 100.0f; }; @@ -273,8 +277,8 @@ void WavetableAudioProcessor::GlobalParams::setup (WavetableAudioProcessor& p) //============================================================================== void WavetableAudioProcessor::UIParams::setup (WavetableAudioProcessor& p) { - activeLFO = p.addExtParam ("uiLFO", "LFO", "", "", { 0.0, 2.0, 0.0, 1.0 }, 0.0, 0.0f); - activeENV = p.addExtParam ("uiENV", "ENV", "", "", { 0.0, 2.0, 0.0, 1.0 }, 0.0f, 0.0f); + activeLFO = p.addIntParam ("uiLFO", "LFO", "", "", { 0.0, 2.0, 0.0, 1.0 }, 0.0, 0.0f); + activeENV = p.addIntParam ("uiENV", "ENV", "", "", { 0.0, 2.0, 0.0, 1.0 }, 0.0f, 0.0f); } //============================================================================== diff --git a/plugin/Source/PluginProcessor.h b/plugin/Source/PluginProcessor.h index 6ecbc8c..bbf8c3c 100644 --- a/plugin/Source/PluginProcessor.h +++ b/plugin/Source/PluginProcessor.h @@ -82,7 +82,7 @@ public: gin::Parameter::Ptr enable, type, keyTracking, velocityTracking, frequency, resonance, amount, - attack, decay, sustain, release; + attack, decay, sustain, release, wt1, wt2, sub, noise; void setup (WavetableAudioProcessor& p); diff --git a/plugin/Source/WavetableVoice.cpp b/plugin/Source/WavetableVoice.cpp index ae0327a..e80be0b 100644 --- a/plugin/Source/WavetableVoice.cpp +++ b/plugin/Source/WavetableVoice.cpp @@ -151,28 +151,35 @@ void WavetableVoice::renderNextBlock (juce::AudioBuffer& outputBuffer, in updateParams (numSamples); // Run OSC - gin::ScratchBuffer buffer (2, numSamples); + gin::ScratchBuffer preFilter (2, numSamples); + gin::ScratchBuffer postFilter (2, numSamples); - for (int i = 0; i < Cfg::numOSCs; i++) - if (proc.oscParams[i].enable->isOn()) - oscillators[i].processAdding (currentMidiNotes[i], oscParams[i], buffer); + if (proc.oscParams[0].enable->isOn()) + oscillators[0].processAdding (currentMidiNotes[0], oscParams[0], proc.filterParams.wt1->isOn() ? preFilter : postFilter); + + if (proc.oscParams[1].enable->isOn()) + oscillators[1].processAdding (currentMidiNotes[1], oscParams[1], proc.filterParams.wt2->isOn() ? preFilter : postFilter); if (proc.subParams.enable->isOn()) - sub.processAdding (subNote, subParams, buffer); + sub.processAdding (subNote, subParams, proc.filterParams.sub->isOn() ? preFilter : postFilter); if (proc.noiseParams.enable->isOn()) - noise.processAdding (60.0f, noiseParams, buffer); + noise.processAdding (60.0f, noiseParams, proc.filterParams.noise->isOn() ? preFilter : postFilter); // Apply velocity float velocity = currentlyPlayingNote.noteOnVelocity.asUnsignedFloat(); - buffer.applyGain (gin::velocityToGain (velocity, ampKeyTrack)); + preFilter.applyGain (gin::velocityToGain (velocity, ampKeyTrack)); + postFilter.applyGain (gin::velocityToGain (velocity, ampKeyTrack)); // Apply filter if (proc.filterParams.enable->isOn()) - filter.process (buffer); + filter.process (preFilter); + + postFilter.addFrom (0, 0, preFilter, 0, 0, numSamples); + postFilter.addFrom (1, 0, preFilter, 1, 0, numSamples); // Run ADSR - adsr.processMultiplying (buffer); + adsr.processMultiplying (postFilter); if (adsr.getState() == gin::AnalogADSR::State::idle) { @@ -181,8 +188,8 @@ void WavetableVoice::renderNextBlock (juce::AudioBuffer& outputBuffer, in } // Copy output to synth - outputBuffer.addFrom (0, startSample, buffer, 0, 0, numSamples); - outputBuffer.addFrom (1, startSample, buffer, 1, 0, numSamples); + outputBuffer.addFrom (0, startSample, postFilter, 0, 0, numSamples); + outputBuffer.addFrom (1, startSample, postFilter, 1, 0, numSamples); finishBlock (numSamples); }