From 87b9954dfc78ee2632b4cabd260988333e576558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20M=2E=20R=2E=20Guimar=C3=A3es?= <100025288+luismrguimaraes@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:11:29 +0100 Subject: [PATCH] stereo field manipulator rename and UI improvement (#131) --- ...{StereoFieldManipulator.h => StereoTool.h} | 37 ++++++++++--------- tests/create-voice-effect.cpp | 6 +-- 2 files changed, 23 insertions(+), 20 deletions(-) rename include/sst/voice-effects/utilities/{StereoFieldManipulator.h => StereoTool.h} (81%) diff --git a/include/sst/voice-effects/utilities/StereoFieldManipulator.h b/include/sst/voice-effects/utilities/StereoTool.h similarity index 81% rename from include/sst/voice-effects/utilities/StereoFieldManipulator.h rename to include/sst/voice-effects/utilities/StereoTool.h index a0efed2..925290f 100644 --- a/include/sst/voice-effects/utilities/StereoFieldManipulator.h +++ b/include/sst/voice-effects/utilities/StereoTool.h @@ -18,8 +18,8 @@ * https://github.com/surge-synthesizer/sst-effects */ -#ifndef INCLUDE_SST_VOICE_EFFECTS_UTILITIES_STEREOFIELDMANIP_H -#define INCLUDE_SST_VOICE_EFFECTS_UTILITIES_STEREOFIELDMANIP_H +#ifndef INCLUDE_SST_VOICE_EFFECTS_UTILITIES_STEREOTOOL_H +#define INCLUDE_SST_VOICE_EFFECTS_UTILITIES_STEREOTOOL_H #include "../VoiceEffectCore.h" @@ -30,10 +30,9 @@ namespace sst::voice_effects::utilities { -template -struct StereoFieldManipulator : core::VoiceEffectTemplateBase +template struct StereoTool : core::VoiceEffectTemplateBase { - static constexpr const char *effectName{"Stereo Field Manipulator"}; + static constexpr const char *effectName{"Stereo Tool"}; static constexpr int numFloatParams{4}; static constexpr int numIntParams{0}; @@ -42,13 +41,13 @@ struct StereoFieldManipulator : core::VoiceEffectTemplateBase { fpRotation, fpWidth, - fpCenter, + fpMidSide, fpLeftRight }; - StereoFieldManipulator() : core::VoiceEffectTemplateBase() {} + StereoTool() : core::VoiceEffectTemplateBase() {} - ~StereoFieldManipulator() {} + ~StereoTool() {} basic_blocks::params::ParamMetaData paramAt(int idx) const { @@ -57,14 +56,18 @@ struct StereoFieldManipulator : core::VoiceEffectTemplateBase switch (idx) { case fpRotation: - return pmd().asFloat().withRange(-90.f, 90.f).withDefault(0.f).withName("Rotation (º)"); + return pmd() + .asFloat() + .withRange(-90.f, 90.f) + .withDefault(0.f) + .withName("Rotation") + .withLinearScaleFormatting("º"); case fpWidth: - return pmd().asPercent().withDefault(1.f).withRange(0.f, 2.f).withName("Width (%)"); - case fpCenter: - return pmd().asPercent().withDefault(0.f).withRange(-1.f, 1.f).withName("Center (%)"); + return pmd().asPercent().withDefault(1.f).withRange(0.f, 2.f).withName("Width"); + case fpMidSide: + return pmd().asPercent().withDefault(0.f).withRange(-1.f, 1.f).withName("Mid|Side"); case fpLeftRight: - return pmd().asPercent().withDefault(0.f).withRange(-1.f, 1.f).withName( - "Left/Right (%)"); + return pmd().asPercent().withDefault(0.f).withRange(-1.f, 1.f).withName("Left|Right"); } return pmd().asFloat().withName("Error"); } @@ -78,8 +81,8 @@ struct StereoFieldManipulator : core::VoiceEffectTemplateBase { auto rotRadians = this->getFloatParam(fpRotation) * 0.017453292; // degrees * PI/180 auto width = this->getFloatParam(fpWidth) / 2.f; - auto center = std::min(this->getFloatParam(fpCenter) + 1, 1.f); - auto side = 1 - this->getFloatParam(fpCenter); + auto side = std::min(this->getFloatParam(fpMidSide) + 1, 1.f); + auto center = 1 - this->getFloatParam(fpMidSide); auto left = -std::min(this->getFloatParam(fpLeftRight), 0.f); auto left1 = -std::max(this->getFloatParam(fpLeftRight) - 1, -1.f); auto right = std::max(this->getFloatParam(fpLeftRight), 0.f); @@ -130,4 +133,4 @@ struct StereoFieldManipulator : core::VoiceEffectTemplateBase } }; } // namespace sst::voice_effects::utilities -#endif // SCXT_STEREOFIELDMANIP_H +#endif // SCXT_STEREOTOOL_H diff --git a/tests/create-voice-effect.cpp b/tests/create-voice-effect.cpp index 803b45f..a07090a 100644 --- a/tests/create-voice-effect.cpp +++ b/tests/create-voice-effect.cpp @@ -48,7 +48,7 @@ #include "sst/voice-effects/modulation/FMFilter.h" #include "sst/voice-effects/generator/TiltNoise.h" #include "sst/voice-effects/modulation/NoiseAM.h" -#include "sst/voice-effects/utilities/StereoFieldManipulator.h" +#include "sst/voice-effects/utilities/StereoTool.h" #include "sst/voice-effects/utilities/VolumeAndPan.h" #include "sst/voice-effects/lifted_bus_effects/LiftedReverb1.h" @@ -194,9 +194,9 @@ TEST_CASE("Can Create Voice FX") { VTester>::TestVFX(); } - SECTION("StereoFieldManipulator") + SECTION("StereoTool") { - VTester>::TestVFX(); + VTester>::TestVFX(); } SECTION("Lifted Reverb 1") {