From 11c9bbddc5763840b095dabb017763156b187d1b Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 24 May 2023 08:48:24 -0400 Subject: [PATCH] Add bonsai (#7030) Add the Bonsai effect authored by Morgan Holley with correct control layout and display and presets. --------- Co-authored-by: Morgan Holly <98441016+morganholly@users.noreply.github.com> --- libs/sst/sst-effects | 2 +- resources/data/fx_presets/Bonsai/Burnt.srgfx | 17 +++ .../data/fx_presets/Bonsai/Deep Bass.srgfx | 17 +++ .../fx_presets/Bonsai/Excessive Bass.srgfx | 17 +++ resources/data/fx_presets/Bonsai/Init.srgfx | 17 +++ resources/data/fx_presets/Bonsai/Soft.srgfx | 17 +++ resources/data/fx_presets/Bonsai/Subtle.srgfx | 17 +++ .../data/fx_presets/Bonsai/Subtler.srgfx | 17 +++ resources/surge-shared/configuration.xml | 3 + src/common/CMakeLists.txt | 2 + src/common/Parameter.cpp | 60 +++++++++++ src/common/Parameter.h | 6 ++ src/common/SurgeStorage.h | 26 ++--- src/common/dsp/Effect.cpp | 3 + src/common/dsp/effects/BonsaiEffect.cpp | 100 ++++++++++++++++++ src/common/dsp/effects/BonsaiEffect.h | 47 ++++++++ src/common/dsp/effects/SurgeSSTFXAdapter.h | 2 +- .../gui/SurgeGUIEditorValueCallbacks.cpp | 23 ++++ 18 files changed, 379 insertions(+), 14 deletions(-) create mode 100644 resources/data/fx_presets/Bonsai/Burnt.srgfx create mode 100644 resources/data/fx_presets/Bonsai/Deep Bass.srgfx create mode 100644 resources/data/fx_presets/Bonsai/Excessive Bass.srgfx create mode 100644 resources/data/fx_presets/Bonsai/Init.srgfx create mode 100644 resources/data/fx_presets/Bonsai/Soft.srgfx create mode 100644 resources/data/fx_presets/Bonsai/Subtle.srgfx create mode 100644 resources/data/fx_presets/Bonsai/Subtler.srgfx create mode 100644 src/common/dsp/effects/BonsaiEffect.cpp create mode 100644 src/common/dsp/effects/BonsaiEffect.h diff --git a/libs/sst/sst-effects b/libs/sst/sst-effects index e8f674ee604..bbac50be9ab 160000 --- a/libs/sst/sst-effects +++ b/libs/sst/sst-effects @@ -1 +1 @@ -Subproject commit e8f674ee60481a99887026c8bb6f701910487562 +Subproject commit bbac50be9abefecf445a9e14585be48690ec4b2c diff --git a/resources/data/fx_presets/Bonsai/Burnt.srgfx b/resources/data/fx_presets/Bonsai/Burnt.srgfx new file mode 100644 index 00000000000..688a6791d95 --- /dev/null +++ b/resources/data/fx_presets/Bonsai/Burnt.srgfx @@ -0,0 +1,17 @@ + + + diff --git a/resources/data/fx_presets/Bonsai/Deep Bass.srgfx b/resources/data/fx_presets/Bonsai/Deep Bass.srgfx new file mode 100644 index 00000000000..532f402d14b --- /dev/null +++ b/resources/data/fx_presets/Bonsai/Deep Bass.srgfx @@ -0,0 +1,17 @@ + + + diff --git a/resources/data/fx_presets/Bonsai/Excessive Bass.srgfx b/resources/data/fx_presets/Bonsai/Excessive Bass.srgfx new file mode 100644 index 00000000000..88ba7ceef0a --- /dev/null +++ b/resources/data/fx_presets/Bonsai/Excessive Bass.srgfx @@ -0,0 +1,17 @@ + + + diff --git a/resources/data/fx_presets/Bonsai/Init.srgfx b/resources/data/fx_presets/Bonsai/Init.srgfx new file mode 100644 index 00000000000..efa31daf7c4 --- /dev/null +++ b/resources/data/fx_presets/Bonsai/Init.srgfx @@ -0,0 +1,17 @@ + + + diff --git a/resources/data/fx_presets/Bonsai/Soft.srgfx b/resources/data/fx_presets/Bonsai/Soft.srgfx new file mode 100644 index 00000000000..7e31d743191 --- /dev/null +++ b/resources/data/fx_presets/Bonsai/Soft.srgfx @@ -0,0 +1,17 @@ + + + diff --git a/resources/data/fx_presets/Bonsai/Subtle.srgfx b/resources/data/fx_presets/Bonsai/Subtle.srgfx new file mode 100644 index 00000000000..9c13ddae77b --- /dev/null +++ b/resources/data/fx_presets/Bonsai/Subtle.srgfx @@ -0,0 +1,17 @@ + + + diff --git a/resources/data/fx_presets/Bonsai/Subtler.srgfx b/resources/data/fx_presets/Bonsai/Subtler.srgfx new file mode 100644 index 00000000000..0da8b26020a --- /dev/null +++ b/resources/data/fx_presets/Bonsai/Subtler.srgfx @@ -0,0 +1,17 @@ + + + diff --git a/resources/surge-shared/configuration.xml b/resources/surge-shared/configuration.xml index 973e1afbef3..a75211f1883 100644 --- a/resources/surge-shared/configuration.xml +++ b/resources/surge-shared/configuration.xml @@ -73,6 +73,9 @@ + + + > 1; // 19 -> 20 (XT 1.1 release) added voice envelope mode, but super late so don't break 19 // 20 -> 21 (XT 1.2 nightlies) added absolutable mode for Combulator Offset 1/2 (to match the behavior of Center parameter) // added oddsound_as_mts_main -// 21 -> 22 (XT 1.3 nighlies) added new ring modulator modes in the mixer +// 21 -> 22 (XT 1.3 nighlies) added new ring modulator modes in the mixer, add bonsai distortion effect // clang-format on const int ff_revision = 22; @@ -383,6 +383,7 @@ enum fx_type fxt_waveshaper, fxt_mstool, fxt_spring_reverb, + fxt_bonsai, n_fx_types, }; @@ -414,19 +415,20 @@ const char fx_type_names[n_fx_types][32] = {"Off", "Treemonster", "Waveshaper", "Mid-Side Tool", - "Spring Reverb"}; + "Spring Reverb", + "Bonsai"}; const char fx_type_shortnames[n_fx_types][16] = { - "Off", "Delay", "Reverb 1", "Phaser", "Rotary", "Distortion", - "EQ", "Freq Shift", "Conditioner", "Chorus", "Vocoder", "Reverb 2", - "Flanger", "Ring Mod", "Airwindows", "Neuron", "Graphic EQ", "Resonator", - "CHOW", "Exciter", "Ensemble", "Combulator", "Nimbus", "Tape", - "Treemonster", "Waveshaper", "Mid-Side Tool", "Spring Reverb"}; - -const char fx_type_acronyms[n_fx_types][8] = {"OFF", "DLY", "RV1", "PH", "ROT", "DIST", "EQ", - "FRQ", "DYN", "CH", "VOC", "RV2", "FL", "RM", - "AW", "NEU", "GEQ", "RES", "CHW", "XCT", "ENS", - "CMB", "NIM", "TAPE", "TM", "WS", "M-S", "SRV"}; + "Off", "Delay", "Reverb 1", "Phaser", "Rotary", "Distortion", + "EQ", "Freq Shift", "Conditioner", "Chorus", "Vocoder", "Reverb 2", + "Flanger", "Ring Mod", "Airwindows", "Neuron", "Graphic EQ", "Resonator", + "CHOW", "Exciter", "Ensemble", "Combulator", "Nimbus", "Tape", + "Treemonster", "Waveshaper", "Mid-Side Tool", "Spring Reverb", "Bonsai"}; + +const char fx_type_acronyms[n_fx_types][8] = { + "OFF", "DLY", "RV1", "PH", "ROT", "DIST", "EQ", "FRQ", "DYN", "CH", + "VOC", "RV2", "FL", "RM", "AW", "NEU", "GEQ", "RES", "CHW", "XCT", + "ENS", "CMB", "NIM", "TAPE", "TM", "WS", "M-S", "SRV", "BON"}; enum fx_bypass { diff --git a/src/common/dsp/Effect.cpp b/src/common/dsp/Effect.cpp index 01a1399151d..dc56fde1a4a 100644 --- a/src/common/dsp/Effect.cpp +++ b/src/common/dsp/Effect.cpp @@ -20,6 +20,7 @@ * https://github.com/surge-synthesizer/surge */ #include "BBDEnsembleEffect.h" +#include "BonsaiEffect.h" #include "ChorusEffectImpl.h" #include "CombulatorEffect.h" #include "ConditionerEffect.h" @@ -110,6 +111,8 @@ Effect *spawn_effect(int id, SurgeStorage *storage, FxStorage *fxdata, pdata *pd return new MSToolEffect(storage, fxdata, pd); case fxt_spring_reverb: return new chowdsp::SpringReverbEffect(storage, fxdata, pd); + case fxt_bonsai: + return new BonsaiEffect(storage, fxdata, pd); default: return 0; }; diff --git a/src/common/dsp/effects/BonsaiEffect.cpp b/src/common/dsp/effects/BonsaiEffect.cpp new file mode 100644 index 00000000000..da3a3d316a3 --- /dev/null +++ b/src/common/dsp/effects/BonsaiEffect.cpp @@ -0,0 +1,100 @@ +/* + * Surge XT - a free and open source hybrid synthesizer, + * built by Surge Synth Team + * + * Learn more at https://surge-synthesizer.github.io/ + * + * Copyright 2018-2023, various authors, as described in the GitHub + * transaction log. + * + * Surge XT is released under the GNU General Public Licence v3 + * or later (GPL-3.0-or-later). The license is found in the "LICENSE" + * file in the root of this repository, or at + * https://www.gnu.org/licenses/gpl-3.0.en.html + * + * Surge was a commercial product from 2004-2018, copyright and ownership + * held by Claes Johanson at Vember Audio during that period. + * Claes made Surge open source in September 2018. + * + * All source for Surge XT is available at + * https://github.com/surge-synthesizer/surge + */ +#include "BonsaiEffect.h" +#include "Tunings.h" +#include +// #include "sst/basic-blocks/dsp/MidSide.h" + +const char *BonsaiEffect::group_label(int id) +{ + switch (id) + { + case 0: + return "Input"; + case 1: + return "Bass Boost"; + case 2: + return "Tape(ish) Sat"; + case 3: + return "Noise"; + case 4: + return "Misc"; + } + return 0; +} +int BonsaiEffect::group_label_ypos(int id) +{ + switch (id) + { + case 0: + return 1; + case 1: + return 5; + case 2: + return 11; + case 3: + return 19; + case 4: + return 25; + } + return 0; +} + +void BonsaiEffect::init_ctrltypes() +{ + Effect::init_ctrltypes(); + + fxdata->p[b_gain_in].set_type(ct_decibel_narrow); + fxdata->p[b_gain_in].posy_offset = 1; + + fxdata->p[b_bass_boost].set_type(ct_bonsai_bass_boost); + fxdata->p[b_bass_boost].posy_offset = 3; + + fxdata->p[b_bass_distort].set_type(ct_bonsai_bass_distortion); + fxdata->p[b_bass_distort].posy_offset = 3; + + fxdata->p[b_tape_bias_mode].set_type(ct_bonsai_sat_filter); + fxdata->p[b_tape_bias_mode].posy_offset = 5; + + fxdata->p[b_tape_dist_mode].set_type(ct_bonsai_sat_mode); + fxdata->p[b_tape_dist_mode].posy_offset = 5; + + fxdata->p[b_tape_sat].set_type(ct_percent); + fxdata->p[b_tape_sat].posy_offset = 5; + + fxdata->p[b_noise_sensitivity].set_type(ct_percent); + fxdata->p[b_noise_sensitivity].posy_offset = 7; + + fxdata->p[b_noise_gain].set_type(ct_bonsai_noise_gain); + fxdata->p[b_noise_gain].posy_offset = 7; + + fxdata->p[b_dull].set_type(ct_percent); + fxdata->p[b_dull].posy_offset = 9; + + fxdata->p[b_gain_out].set_type(ct_decibel_narrow); + fxdata->p[b_gain_out].posy_offset = 9; + + fxdata->p[b_mix].set_type(ct_percent); + fxdata->p[b_mix].posy_offset = 9; + + configureControlsFromFXMetadata(); +} diff --git a/src/common/dsp/effects/BonsaiEffect.h b/src/common/dsp/effects/BonsaiEffect.h new file mode 100644 index 00000000000..8dfd36bcfc7 --- /dev/null +++ b/src/common/dsp/effects/BonsaiEffect.h @@ -0,0 +1,47 @@ +/* + * Surge XT - a free and open source hybrid synthesizer, + * built by Surge Synth Team + * + * Learn more at https://surge-synthesizer.github.io/ + * + * Copyright 2018-2023, various authors, as described in the GitHub + * transaction log. + * + * Surge XT is released under the GNU General Public Licence v3 + * or later (GPL-3.0-or-later). The license is found in the "LICENSE" + * file in the root of this repository, or at + * https://www.gnu.org/licenses/gpl-3.0.en.html + * + * Surge was a commercial product from 2004-2018, copyright and ownership + * held by Claes Johanson at Vember Audio during that period. + * Claes made Surge open source in September 2018. + * + * All source for Surge XT is available at + * https://github.com/surge-synthesizer/surge + */ + +#ifndef SURGE_SRC_COMMON_DSP_EFFECTS_BONSAIEFFECT_H +#define SURGE_SRC_COMMON_DSP_EFFECTS_BONSAIEFFECT_H + +#include "Effect.h" +#include "SurgeSSTFXAdapter.h" +#include "sst/effects/Bonsai.h" + +class BonsaiEffect + : public surge::sstfx::SurgeSSTFXBase> +{ + public: + BonsaiEffect(SurgeStorage *storage, FxStorage *fxdata, pdata *pd) + : surge::sstfx::SurgeSSTFXBase>( + storage, fxdata, pd) + { + } + + virtual ~BonsaiEffect() = default; + + virtual void init_ctrltypes() override; + virtual const char *group_label(int id) override; + virtual int group_label_ypos(int id) override; +}; + +#endif // SURGE_SRC_COMMON_DSP_EFFECTS_BONSAIEFFECT_H diff --git a/src/common/dsp/effects/SurgeSSTFXAdapter.h b/src/common/dsp/effects/SurgeSSTFXAdapter.h index eef53257294..9afd78bccee 100644 --- a/src/common/dsp/effects/SurgeSSTFXAdapter.h +++ b/src/common/dsp/effects/SurgeSSTFXAdapter.h @@ -46,7 +46,7 @@ * * 1. Copy the code to a header in sst-effects and use the concrete names for * the interface which the regtests require. So now you have - * sst::effects::Foo + * sst::effects::Foo * 2. Strip that code from surge and change FooEffect : Effect into * FooEffect : SurgeSSTFXBase * diff --git a/src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp b/src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp index 38f00d882f0..24d53cf0f8f 100644 --- a/src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp +++ b/src/surge-xt/gui/SurgeGUIEditorValueCallbacks.cpp @@ -2465,6 +2465,29 @@ int32_t SurgeGUIEditor::controlModifierClicked(Surge::GUI::IComponentTagValue *c frame->repaint(); }); } + case ct_bonsai_bass_boost: + { + contextMenu.addSeparator(); + auto dt = p->deform_type; + + Surge::Widgets::MenuCenteredBoldLabel::addToMenuAsSectionHeader(contextMenu, + "ROUTING"); + + contextMenu.addItem("Stereo", true, dt == 0, [this, p]() { + undoManager()->pushParameterChange(p->id, p, p->val); + + p->deform_type = 0, synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addItem("Mono", true, dt == 1, [this, p]() { + undoManager()->pushParameterChange(p->id, p, p->val); + + p->deform_type = 1, synth->storage.getPatch().isDirty = true; + frame->repaint(); + }); + contextMenu.addSeparator(); + } + break; default: { break;