Skip to content

Commit

Permalink
Merge pull request #3 from Wasted-Audio/feature/manual_gain
Browse files Browse the repository at this point in the history
add gain control; use parameter enum; bump version
  • Loading branch information
dromer authored May 6, 2024
2 parents 1b5b695 + 859904c commit 35e1e47
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 33 deletions.
Binary file modified WSTD_MANGLR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion dep/wstd.cmpnnts
Submodule wstd.cmpnnts updated 6 files
+28 −28 dbcalc.pd
+61 −47 eq_pass.pd
+62 −0 linmix.pd
+25 −23 lmtr~.pd
+27 −11 manglr.pd
+35 −0 manglr_st.pd
89 changes: 64 additions & 25 deletions override/HeavyDPF_WSTD_MANGLR_UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@
START_NAMESPACE_DISTRHO

// --------------------------------------------------------------------------------------------------------------------
enum HeavyParams {
CRSHR,
FLDR,
GAIN,
LMTR,
MIX,
SMTHR,
SQNC,
};

class ImGuiPluginUI : public UI
{
int fcrshr = 512;
float ffldr = 1.0f;
float fgain = 0.0f;
bool flmtr = 1.0f != 0.0f;
float fmix = 50.0f;
float fsmthr = 1.0f;
Expand Down Expand Up @@ -62,22 +73,25 @@ class ImGuiPluginUI : public UI
void parameterChanged(uint32_t index, float value) override
{
switch (index) {
case 0:
case CRSHR:
fcrshr = value;
break;
case 1:
case FLDR:
ffldr = value;
break;
case 2:
case GAIN:
fgain = value;
break;
case LMTR:
flmtr = value != 0.0f;
break;
case 3:
case MIX:
fmix = value;
break;
case 4:
case SMTHR:
fsmthr = value;
break;
case 5:
case SQNC:
fsqnc = value;
break;

Expand All @@ -104,11 +118,11 @@ class ImGuiPluginUI : public UI
{
if (ImGui::IsItemActivated())
{
editParameter(0, true);
editParameter(CRSHR, true);
if (ImGui::IsMouseDoubleClicked(0))
fcrshr = 512;
}
setParameterValue(0, fcrshr);
setParameterValue(CRSHR, fcrshr);
}
ImGui::PopStyleColor(2);
ImGui::SameLine();
Expand All @@ -128,11 +142,11 @@ class ImGuiPluginUI : public UI
{
if (ImGui::IsItemActivated())
{
editParameter(1, true);
editParameter(FLDR, true);
if (ImGui::IsMouseDoubleClicked(0))
ffldr = 1.0f;
}
setParameterValue(1, ffldr);
setParameterValue(FLDR, ffldr);
}
ImGui::PopStyleColor(2);
ImGui::SameLine();
Expand All @@ -152,11 +166,11 @@ class ImGuiPluginUI : public UI
{
if (ImGui::IsItemActivated())
{
editParameter(4, true);
editParameter(SMTHR, true);
if (ImGui::IsMouseDoubleClicked(0))
fsmthr = 1.0f;
}
setParameterValue(4, fsmthr);
setParameterValue(SMTHR, fsmthr);
}
ImGui::SameLine();
}
Expand Down Expand Up @@ -186,13 +200,15 @@ class ImGuiPluginUI : public UI
ImFont* titleBarFont = io.Fonts->Fonts[2];
ImFont* mediumFont = io.Fonts->Fonts[3];

auto intense = 20.0f / 5.0f;
auto intense = (20.0f + (4.0f * fgain)) / 5.0f;

auto SyncSw = ColorBright(WhiteDr, intense);
auto SyncGr = ColorBright(Grey, intense);
auto SyncGrHovered = ColorBright(GreyBr, intense);
auto SyncAct = ColorBright(GreenDr, intense);
auto SyncActHovered = ColorBright(Green, intense);
auto GainActive = ColorBright(Green, intense);
auto GainHovered = ColorBright(GreenBr, intense);
auto MixActive = ColorMix(Green, Yellow, intense, fmix);
auto MixHovered = ColorMix(GreenBr, YellowBr, intense, fmix);

Expand All @@ -203,12 +219,14 @@ class ImGuiPluginUI : public UI
auto crshstep = 8;
auto elevstep = 0.1f;
auto percstep = 1.0f;
auto dbstep = 0.1f;

if (io.KeyShift)
{
crshstep = 1;
elevstep = 0.01f;
percstep = 0.1f;
dbstep = 0.01f;
}

const char* sqnc_list[6] = {
Expand Down Expand Up @@ -249,8 +267,8 @@ class ImGuiPluginUI : public UI
if (ImGui::Selectable(sqnc_list[n], is_selected))
{
fsqnc = n;
editParameter(5, true);
setParameterValue(5, fsqnc);
editParameter(SQNC, true);
setParameterValue(SQNC, fsqnc);
}
if (is_selected)
ImGui::SetItemDefaultFocus();
Expand Down Expand Up @@ -340,40 +358,61 @@ class ImGuiPluginUI : public UI
{
if (ImGui::IsItemActivated())
{
editParameter(2, true);
setParameterValue(2, flmtr);
editParameter(LMTR, true);
setParameterValue(LMTR, flmtr);
}
}
ImGui::PopStyleColor(5);
}
ImGui::EndGroup();
ImGui::SameLine();

ImGui::BeginGroup();
{
ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)GainActive);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)GainHovered);
if (ImGuiKnobs::Knob(
"Gain", &fgain, -20.0f, 0.0f, dbstep, "%.2fdB", ImGuiKnobVariant_SteppedTick, hundred, ImGuiKnob_Flags, 5))
{
if (ImGui::IsItemActivated())
{
editParameter(GAIN, true);
if (ImGui::IsMouseDoubleClicked(0))
fgain = 0.0f;
}
setParameterValue(GAIN, fgain);
}
ImGui::PopStyleColor(2);
}
ImGui::EndGroup();
ImGui::SameLine();

ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)MixActive);
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)MixHovered);
if (ImGuiKnobs::Knob(
"Mix", &fmix, 0.0f, 100.0f, percstep, "%.1f%%", ImGuiKnobVariant_SteppedTick, hundred, ImGuiKnob_Flags, 11))
{
if (ImGui::IsItemActivated())
{
editParameter(3, true);
editParameter(MIX, true);
if (ImGui::IsMouseDoubleClicked(0))
fmix = 50.0f;
}
setParameterValue(3, fmix);
setParameterValue(MIX, fmix);
}
ImGui::PopStyleColor(2);
}
ImGui::EndGroup();

if (ImGui::IsItemDeactivated())
{
editParameter(0, false);
editParameter(1, false);
editParameter(2, false);
editParameter(3, false);
editParameter(4, false);
editParameter(5, false);
editParameter(CRSHR, false);
editParameter(FLDR, false);
editParameter(GAIN, false);
editParameter(LMTR, false);
editParameter(MIX, false);
editParameter(SMTHR, false);
editParameter(SQNC, false);
}
}
ImGui::End();
Expand Down
4 changes: 2 additions & 2 deletions wstd_manglr.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"enable_ui": true,
"ui_size": {
"width": 606,
"width": 707,
"height": 191
},
"midi_input": 0,
Expand All @@ -22,7 +22,7 @@
"S~F~C"
]
},
"version": "1, 0, 2",
"version": "1, 1, 0",
"license": "GPL-3.0-or-later",
"homepage": "https://wasted.audio/software/wstd_manglr",
"plugin_uri": "https://wasted.audio/software/wstd_manglr",
Expand Down
20 changes: 15 additions & 5 deletions wstd_manglr.pd
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@
#X restore 441 750 pd mix;
#X msg 441 823 \$1 100;
#X obj 441 843 line~;
#X obj 853 279 vsl 17 128 0 1 0 0 empty empty empty 0 -9 0 10 #191919 #ffffff #ffffff 0 1;
#X obj 848 428 s \$0-mix;
#X obj 963 352 vsl 17 128 0 1 0 0 empty empty empty 0 -9 0 10 #191919 #ffffff #ffffff 0 1;
#X obj 958 501 s \$0-mix;
#X obj 238 167 adc~;
#X msg 358 279 sqnc \$1;
#X obj 358 219 r Sqnc @hv_param 0 5 0 int;
#X obj 848 219 r Mix @hv_param 0 100 50;
#X obj 958 292 r Mix @hv_param 0 100 50;
#X obj 522 369 hsl 128 16 1 11 0 0 empty empty empty -2 -8 0 10 #191919 #ffffff #ffffff 0 1;
#X obj 444 313 hsl 128 16 2 512 1 0 empty empty STEPS -2 -6 0 12 #7c7c7c #fcfcfc #808080 0 1;
#X obj 591 432 hsl 128 16 1 11 1 1 empty empty empty -2 -6 0 12 #ffffff #202020 #808080 0 1;
#X msg 441 343 crshr \$1;
#X obj 848 248 / 100;
#X obj 958 321 / 100;
#X obj 519 968 *~;
#X obj 519 1086 +~;
#X obj 589 1043 *~;
Expand All @@ -65,7 +65,7 @@
#X msg 58 479 lmtr \$1;
#X msg 441 139 512;
#X msg 519 139 1;
#X msg 658 139 50;
#X msg 958 245 50;
#X obj 441 49 bng 25 250 50 0 empty empty empty 17 7 0 10 #191919 #ffffff #ffffff;
#X obj 19 390 loadbang;
#X msg 19 419 1;
Expand All @@ -74,6 +74,10 @@
#X obj 848 79 declare -path dep;
#X obj 238 533 wstd.cmpnnts/manglr L;
#X obj 328 563 wstd.cmpnnts/manglr R;
#X obj 771 356 vsl 17 128 -20 0 0 0 empty empty empty 0 -9 0 10 #191919 #ffffff #ffffff 0 1;
#X msg 766 501 gain \$1;
#X msg 770 261 0;
#X obj 767 307 r Gain @hv_param -20 0 0;
#X connect 0 0 15 0;
#X connect 2 0 3 0;
#X connect 3 0 1 0;
Expand Down Expand Up @@ -127,9 +131,15 @@
#X connect 44 0 41 0;
#X connect 44 0 42 0;
#X connect 44 0 43 0;
#X connect 44 0 54 0;
#X connect 45 0 46 0;
#X connect 46 0 39 0;
#X connect 47 0 18 0;
#X connect 48 0 20 0;
#X connect 50 0 27 0;
#X connect 51 0 29 0;
#X connect 52 0 53 0;
#X connect 53 0 50 1;
#X connect 53 0 51 1;
#X connect 54 0 52 0;
#X connect 55 0 52 0;

0 comments on commit 35e1e47

Please sign in to comment.