Skip to content

Commit

Permalink
Feedback Overdrive
Browse files Browse the repository at this point in the history
10x feedback depth for all your noise source needs
  • Loading branch information
baconpaul committed Jan 16, 2025
1 parent d7d4668 commit 35803b5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/dsp/matrix_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,13 @@ struct MatrixNodeSelf : EnvelopeSupport<Patch::SelfNode>,
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()
{
Expand All @@ -214,6 +215,7 @@ struct MatrixNodeSelf : EnvelopeSupport<Patch::SelfNode>,
calculateModulation();
envAttack();
lfoAttack();
overdriveFactor = overdriveV > 0.5 ? 10.0 : 1.0;
}
}
void applyBlock()
Expand Down Expand Up @@ -253,7 +255,7 @@ struct MatrixNodeSelf : EnvelopeSupport<Patch::SelfNode>,
}
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);
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/synth/patch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Param, numModsPer>(
[this, idx](int i)
Expand All @@ -610,14 +615,14 @@ struct Patch
return name(index);
}

Param fbLevel, lfoToFB, envToFB;
Param fbLevel, lfoToFB, envToFB, overdrive;
Param active;

std::array<Param, numModsPer> modtarget;

std::vector<Param *> params()
{
std::vector<Param *> res{&fbLevel, &active, &lfoToFB, &envToFB};
std::vector<Param *> res{&fbLevel, &active, &lfoToFB, &envToFB, &overdrive};
appendDAHDSRParams(res);
appendLFOParams(res);

Expand Down
19 changes: 17 additions & 2 deletions src/ui/self-sub-panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ void SelfSubPanel::setSelectedIndex(int idx)
modLabelL->setText(std::string() + "LFO" + u8"\U00002192");
addAndMakeVisible(*modLabelL);

overdriveTitle = std::make_unique<jcmp::RuledLabel>();
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)
Expand All @@ -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();

Expand All @@ -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);
}
Expand Down
4 changes: 4 additions & 0 deletions src/ui/self-sub-panel.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ struct SelfSubPanel : juce::Component,
std::unique_ptr<jcmp::MultiSwitch> envMul;
std::unique_ptr<PatchDiscrete> envMulD;

std::unique_ptr<jcmp::ToggleButton> overdrive;
std::unique_ptr<PatchDiscrete> overdriveD;
std::unique_ptr<jcmp::RuledLabel> overdriveTitle;

void setEnabledState();
};
} // namespace baconpaul::six_sines::ui
Expand Down

0 comments on commit 35803b5

Please sign in to comment.