From 35803b5e0e50d81381c3e8fb9d29387471339913 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Wed, 15 Jan 2025 21:22:06 -0500 Subject: [PATCH] Feedback Overdrive 10x feedback depth for all your noise source needs --- src/dsp/matrix_node.h | 10 ++++++---- src/synth/patch.h | 9 +++++++-- src/ui/self-sub-panel.cpp | 19 +++++++++++++++++-- src/ui/self-sub-panel.h | 4 ++++ 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/dsp/matrix_node.h b/src/dsp/matrix_node.h index 690b50f..c7a94d7 100644 --- a/src/dsp/matrix_node.h +++ b/src/dsp/matrix_node.h @@ -198,12 +198,13 @@ struct MatrixNodeSelf : EnvelopeSupport, const MonoValues &monoValues; const VoiceValues &voiceValues; - const float &fbBase, &lfoToFB, &activeV, &envToFB; + const float &fbBase, &lfoToFB, &activeV, &envToFB, &overdriveV; MatrixNodeSelf(const Patch::SelfNode &sn, OpSource &on, MonoValues &mv, const VoiceValues &vv) : selfNode(sn), monoValues(mv), voiceValues(vv), onto(on), fbBase(sn.fbLevel), - lfoToFB(sn.lfoToFB), activeV(sn.active), envToFB(sn.envToFB), EnvelopeSupport(sn, mv, vv), - LFOSupport(sn, mv), ModulationSupport(sn, mv, vv){}; + lfoToFB(sn.lfoToFB), activeV(sn.active), envToFB(sn.envToFB), overdriveV(sn.overdrive), + EnvelopeSupport(sn, mv, vv), LFOSupport(sn, mv), ModulationSupport(sn, mv, vv){}; bool active{true}, lfoMul{false}; + float overdriveFactor{1.0}; void attack() { @@ -214,6 +215,7 @@ struct MatrixNodeSelf : EnvelopeSupport, calculateModulation(); envAttack(); lfoAttack(); + overdriveFactor = overdriveV > 0.5 ? 10.0 : 1.0; } } void applyBlock() @@ -253,7 +255,7 @@ struct MatrixNodeSelf : EnvelopeSupport, } for (int j = 0; j < blockSize; ++j) { - onto.feedbackLevel[j] = (int32_t)((1 << 24) * modlev[j]); + onto.feedbackLevel[j] = (int32_t)((1 << 24) * modlev[j] * overdriveFactor); } } diff --git a/src/synth/patch.h b/src/synth/patch.h index 919b51b..742f7ee 100644 --- a/src/synth/patch.h +++ b/src/synth/patch.h @@ -584,6 +584,11 @@ struct Patch .withGroupName(name(idx)) .withID(id(27, idx)) .withDefault(0)), + overdrive(boolMd() + .withName(name(idx) + " Overdrive") + .withGroupName(name(idx)) + .withDefault(false) + .withID(id(28, idx))), ModulationMixin(name(idx), id(40, idx)), modtarget(scpu::make_array_lambda( [this, idx](int i) @@ -610,14 +615,14 @@ struct Patch return name(index); } - Param fbLevel, lfoToFB, envToFB; + Param fbLevel, lfoToFB, envToFB, overdrive; Param active; std::array modtarget; std::vector params() { - std::vector res{&fbLevel, &active, &lfoToFB, &envToFB}; + std::vector res{&fbLevel, &active, &lfoToFB, &envToFB, &overdrive}; appendDAHDSRParams(res); appendLFOParams(res); diff --git a/src/ui/self-sub-panel.cpp b/src/ui/self-sub-panel.cpp index 8f6b600..aba87cc 100644 --- a/src/ui/self-sub-panel.cpp +++ b/src/ui/self-sub-panel.cpp @@ -55,6 +55,13 @@ void SelfSubPanel::setSelectedIndex(int idx) modLabelL->setText(std::string() + "LFO" + u8"\U00002192"); addAndMakeVisible(*modLabelL); + overdriveTitle = std::make_unique(); + overdriveTitle->setText("OverDrv"); + addAndMakeVisible(*overdriveTitle); + createComponent(editor, *this, n.overdrive, overdrive, overdriveD); + addAndMakeVisible(*overdrive); + overdrive->setLabel("10x"); + auto op = [w = juce::Component::SafePointer(this)]() { if (w) @@ -76,7 +83,7 @@ void SelfSubPanel::resized() pn = pn.translated(uicMargin, 0); auto r = layoutLFOAt(pn.getX(), p.getY()); - auto xtraW = 4; + auto xtraW = 12; auto depx = r.getX() + uicMargin; auto depy = r.getY(); @@ -88,7 +95,15 @@ void SelfSubPanel::resized() depx += uicKnobSize + uicMargin + 2 * xtraW; positionTitleLabelAt(depx, depy, uicKnobSize + 2 * xtraW, modLabelL); - positionKnobAndLabel(depx + xtraW, r.getY() + uicTitleLabelHeight, lfoToFb, lfoToFbL); + depy += uicTitleLabelHeight + uicMargin; + positionKnobAndLabel(depx + xtraW, depy, lfoToFb, lfoToFbL); + + depy = r.getY(); + depx += uicKnobSize + uicMargin + 2 * xtraW; + positionTitleLabelAt(depx, depy, uicKnobSize + 2 * xtraW, overdriveTitle); + depy += uicTitleLabelHeight; + overdrive->setBounds(depx, depy, uicKnobSize + 2 * xtraW, uicLabelHeight); + // positionKnobAndLabel(depx + xtraW, r.getY() + uicTitleLabelHeight, overdrive, overdriveD); layoutModulation(p); } diff --git a/src/ui/self-sub-panel.h b/src/ui/self-sub-panel.h index 7ad2d3e..3c1d12d 100644 --- a/src/ui/self-sub-panel.h +++ b/src/ui/self-sub-panel.h @@ -51,6 +51,10 @@ struct SelfSubPanel : juce::Component, std::unique_ptr envMul; std::unique_ptr envMulD; + std::unique_ptr overdrive; + std::unique_ptr overdriveD; + std::unique_ptr overdriveTitle; + void setEnabledState(); }; } // namespace baconpaul::six_sines::ui