Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(XT 1.1) Add options for scene highpass slopes up to 48 dB/oct #5762

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ bool Parameter::has_deformoptions() const
{
switch (ctrltype)
{
case ct_freq_hpf:
case ct_lfodeform:
case ct_modern_trimix:
case ct_alias_mask:
Expand Down
1 change: 1 addition & 0 deletions src/common/SurgeStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ enum deform_type
type_1,
type_2,
type_3,
type_4,

n_deform_types,
};
Expand Down
32 changes: 24 additions & 8 deletions src/common/SurgeSynthesizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ using namespace std;
using CMSKey = ControllerModulationSourceVector<1>; // sigh see #4286 for failed first try

SurgeSynthesizer::SurgeSynthesizer(PluginLayer *parent, const std::string &suppliedDataPath)
: storage(suppliedDataPath), hpA(&storage), hpB(&storage), _parent(parent), halfbandA(6, true),
halfbandB(6, true), halfbandIN(6, true)
: storage(suppliedDataPath), hpA{&storage, &storage, &storage, &storage}, hpB{&storage,
&storage,
&storage,
&storage},
_parent(parent), halfbandA(6, true), halfbandB(6, true), halfbandIN(6, true)
{
switch_toggled_queued = false;
audio_processing_active = false;
Expand Down Expand Up @@ -2048,8 +2051,11 @@ void SurgeSynthesizer::allNotesOff()
halfbandB.reset();
halfbandIN.reset();

hpA.suspend();
hpB.suspend();
for (int i = 0; i < n_hpBQ; i++)
{
hpA[i].suspend();
hpB[i].suspend();
}

for (int i = 0; i < n_fx_slots; i++)
{
Expand Down Expand Up @@ -3962,17 +3968,27 @@ void SurgeSynthesizer::process()
auto freq =
storage.getPatch().scenedata[0][storage.getPatch().scene[0].lowcut.param_id_in_scene].f;

hpA.coeff_HP(hpA.calc_omega(freq / 12.0), 0.4); // var 0.707
hpA.process_block(sceneout[0][0], sceneout[0][1]); // TODO: quadify
auto slope = storage.getPatch().scene[0].lowcut.deform_type;

for (int i = 0; i <= slope; i++)
{
hpA[i].coeff_HP(hpA[i].calc_omega(freq / 12.0), 0.4); // var 0.707
hpA[i].process_block(sceneout[0][0], sceneout[0][1]); // TODO: quadify
}
}

if (storage.getPatch().scene[1].lowcut.deactivated == false)
{
auto freq =
storage.getPatch().scenedata[1][storage.getPatch().scene[1].lowcut.param_id_in_scene].f;

hpB.coeff_HP(hpB.calc_omega(freq / 12.0), 0.4);
hpB.process_block(sceneout[1][0], sceneout[1][1]);
auto slope = storage.getPatch().scene[1].lowcut.deform_type;

for (int i = 0; i <= slope; i++)
{
hpB[i].coeff_HP(hpB[i].calc_omega(freq / 12.0), 0.4); // var 0.707
hpB[i].process_block(sceneout[1][0], sceneout[1][1]); // TODO: quadify
}
}

for (int cls = 0; cls < n_scenes; ++cls)
Expand Down
5 changes: 4 additions & 1 deletion src/common/SurgeSynthesizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,10 @@ class alignas(16) SurgeSynthesizer

bool switch_toggled_queued, release_if_latched[n_scenes], release_anyway[n_scenes];
void setParameterSmoothed(long index, float value);
BiquadFilter hpA, hpB; // TODO: FIX SCENE ASSUMPTION (use std::array)

static constexpr int n_hpBQ = 4;

std::array<BiquadFilter, n_hpBQ> hpA, hpB; // TODO: FIX SCENE ASSUMPTION (use std::array)

bool fx_reload[n_fx_slots]; // if true, reload new effect parameters from fxsync
FxStorage fxsync[n_fx_slots]; // used for synchronisation of parameter init
Expand Down
20 changes: 18 additions & 2 deletions src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,24 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c
{
switch (p->ctrltype)
{
case ct_freq_hpf:
{
contextMenu.addSeparator();

contextMenu.addSectionHeader("SLOPE");

for (int i = 0; i < synth->n_hpBQ; i++)
{
std::string title = fmt::format("{:d} dB/oct", 12 * (i + 1));

bool isChecked = p->deform_type == i;

contextMenu.addItem(title, true, isChecked,
[this, p, i]() { p->deform_type = i; });
}

break;
}
case ct_lfodeform:
{
auto q = modsource_editor[current_scene];
Expand All @@ -1658,8 +1675,7 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c

for (int i = 0; i < lt_num_deforms[lfodata->shape.val.i]; i++)
{
char title[32];
sprintf(title, "Type %d", (i + 1));
std::string title = fmt::format("Type {:d}", (i + 1));

bool isChecked = p->deform_type == i;

Expand Down