From 03ed235c5e23143373c53e266d1af47ffc908001 Mon Sep 17 00:00:00 2001 From: Andreya-Autumn Date: Mon, 27 May 2024 23:09:35 +0200 Subject: [PATCH 1/2] remove unnecessary asserts --- include/sst/voice-effects/delay/Microgate.h | 1 - .../sst/voice-effects/delay/StringResonator.h | 2 - .../sst/voice-effects/distortion/BitCrusher.h | 1 - .../sst/voice-effects/eq/EqNBandParametric.h | 1 - include/sst/voice-effects/eq/MorphEQ.h | 1 - include/sst/voice-effects/filter/CytomicSVF.h | 1 - include/sst/voice-effects/filter/SSTFilters.h | 1 - include/sst/voice-effects/filter/Slewer.h | 177 ------------------ .../sst/voice-effects/filter/StaticPhaser.h | 3 - .../sst/voice-effects/filter/SurgeBiquads.h | 1 - .../voice-effects/generator/GenPulseSync.h | 1 - include/sst/voice-effects/generator/GenSaw.h | 1 - include/sst/voice-effects/generator/GenSin.h | 1 - .../voice-effects/modulation/FreqShiftMod.h | 1 - .../sst/voice-effects/modulation/PhaseMod.h | 1 - .../sst/voice-effects/modulation/RingMod.h | 1 - .../sst/voice-effects/waveshaper/WaveShaper.h | 1 - 17 files changed, 196 deletions(-) delete mode 100644 include/sst/voice-effects/filter/Slewer.h diff --git a/include/sst/voice-effects/delay/Microgate.h b/include/sst/voice-effects/delay/Microgate.h index 4955b18..90e147b 100644 --- a/include/sst/voice-effects/delay/Microgate.h +++ b/include/sst/voice-effects/delay/Microgate.h @@ -65,7 +65,6 @@ template struct MicroGate : core::VoiceEffectTemplateBase= 0 && idx < (int)MicroGateParams::num_params); using pmd = basic_blocks::params::ParamMetaData; switch ((MicroGateParams)idx) diff --git a/include/sst/voice-effects/delay/StringResonator.h b/include/sst/voice-effects/delay/StringResonator.h index 2ae17e4..cd1a08d 100644 --- a/include/sst/voice-effects/delay/StringResonator.h +++ b/include/sst/voice-effects/delay/StringResonator.h @@ -155,8 +155,6 @@ template struct StringResonator : core::VoiceEffectTemplate basic_blocks::params::ParamMetaData intParamAt(int idx) const { using pmd = basic_blocks::params::ParamMetaData; - - assert(numIntParams == 3); switch (idx) { case ipStereo: diff --git a/include/sst/voice-effects/distortion/BitCrusher.h b/include/sst/voice-effects/distortion/BitCrusher.h index ea6bdf8..61a8102 100644 --- a/include/sst/voice-effects/distortion/BitCrusher.h +++ b/include/sst/voice-effects/distortion/BitCrusher.h @@ -49,7 +49,6 @@ template struct BitCrusher : core::VoiceEffectTemplateBase< basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < bc_num_params); using pmd = basic_blocks::params::ParamMetaData; switch ((bc_fparams)idx) diff --git a/include/sst/voice-effects/eq/EqNBandParametric.h b/include/sst/voice-effects/eq/EqNBandParametric.h index 4d6e0c2..aa4c709 100644 --- a/include/sst/voice-effects/eq/EqNBandParametric.h +++ b/include/sst/voice-effects/eq/EqNBandParametric.h @@ -51,7 +51,6 @@ struct EqNBandParametric : core::VoiceEffectTemplateBase basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < numFloatParams); using pmd = basic_blocks::params::ParamMetaData; int type = idx % 3; diff --git a/include/sst/voice-effects/eq/MorphEQ.h b/include/sst/voice-effects/eq/MorphEQ.h index c230b76..7478396 100644 --- a/include/sst/voice-effects/eq/MorphEQ.h +++ b/include/sst/voice-effects/eq/MorphEQ.h @@ -228,7 +228,6 @@ template struct MorphEQ : core::VoiceEffectTemplateBase= 0 && idx < numFloatParams); using pmd = basic_blocks::params::ParamMetaData; switch (idx) diff --git a/include/sst/voice-effects/filter/CytomicSVF.h b/include/sst/voice-effects/filter/CytomicSVF.h index 0746bf8..46e2565 100644 --- a/include/sst/voice-effects/filter/CytomicSVF.h +++ b/include/sst/voice-effects/filter/CytomicSVF.h @@ -51,7 +51,6 @@ template struct CytomicSVF : core::VoiceEffectTemplateBase< basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < numFloatParams); using pmd = basic_blocks::params::ParamMetaData; switch (idx) diff --git a/include/sst/voice-effects/filter/SSTFilters.h b/include/sst/voice-effects/filter/SSTFilters.h index eb416c2..ef41335 100644 --- a/include/sst/voice-effects/filter/SSTFilters.h +++ b/include/sst/voice-effects/filter/SSTFilters.h @@ -77,7 +77,6 @@ template struct SSTFilters : core::VoiceEffectTemplateBase< basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < numFloatParams); using pmd = basic_blocks::params::ParamMetaData; switch (idx) diff --git a/include/sst/voice-effects/filter/Slewer.h b/include/sst/voice-effects/filter/Slewer.h deleted file mode 100644 index 6163fe8..0000000 --- a/include/sst/voice-effects/filter/Slewer.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * sst-effects - an open source library of audio effects - * built by Surge Synth Team. - * - * Copyright 2018-2023, various authors, as described in the GitHub - * transaction log. - * - * sst-effects 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 - * - * The majority of these effects at initiation were factored from - * Surge XT, and so git history prior to April 2023 is found in the - * surge repo, https://github.com/surge-synthesizer/surge - * - * All source in sst-effects available at - * https://github.com/surge-synthesizer/sst-effects - */ - -#ifndef INCLUDE_SST_VOICE_EFFECTS_FILTER_SLEWER_H -#define INCLUDE_SST_VOICE_EFFECTS_FILTER_SLEWER_H - -#include "sst/basic-blocks/params/ParamMetadata.h" -#include "../VoiceEffectCore.h" - -namespace sst::voice_effects::filter -{ -template struct Slewer : core::VoiceEffectTemplateBase -{ - static constexpr const char *effectName{"Slewer"}; - - enum FloatParamIdx - { - fpPreGain, - fpPreFreq, - fpPreBW, - fpSlewRate, - fpPostGain, - fpPostFreq, - fpPostBW - }; - - static constexpr int numFloatParams{7}; - static constexpr int numIntParams{0}; - - Slewer() : core::VoiceEffectTemplateBase(), bq{this, this} {} - - ~Slewer() {} - - basic_blocks::params::ParamMetaData paramAt(int idx) const - { - using pmd = basic_blocks::params::ParamMetaData; - - switch ((FloatParamIdx)idx) - { - case fpPreGain: - return pmd().asDecibelNarrow().withDefault(0).withName("Pre Gain"); - case fpPreFreq: - return pmd().asAudibleFrequency().withDefault(0).withName("Pre Freq"); - case fpPreBW: - return pmd() - .asFloat() - .withRange(0, 2) - .withDefault(1) - .withName("Pre BW") - .withLinearScaleFormatting("octaves"); - - case fpSlewRate: - return pmd().asAudibleFrequency().withDefault(0).withName("Slew Rate"); - - case fpPostGain: - return pmd().asDecibelNarrow().withDefault(0).withName("Post Gain"); - case fpPostFreq: - return pmd().asAudibleFrequency().withDefault(0).withName("Post Freq"); - case fpPostBW: - return pmd() - .asFloat() - .withRange(0, 2) - .withDefault(1) - .withName("Post BW") - .withLinearScaleFormatting("octaves"); - } - - return pmd().withName("Unknown " + std::to_string(idx)); - } - - void initVoiceEffect() - { - calc_coeffs(); - lipolRate.instantize(); - v[0] = 0.f; - v[1] = 0.f; - } - void initVoiceEffectParams() { this->initToParamMetadataDefault(this); } - - void calc_coeffs() - { - lipolRate.set_target(this->getSampleRateInv() * 440.0 * - this->note_to_pitch_ignoring_tuning(this->getFloatParam(fpSlewRate))); - std::array param; - bool diff{false}; - for (int i = 0; i < numFloatParams; i++) - { - param[i] = this->getFloatParam(i); - diff = diff || (mLastParam[i] != param[i]); - } - - if (diff) - { - bq[0].coeff_orfanidisEQ( - bq[0].calc_omega(param[fpPreFreq] / 12.f), std::max(param[fpPreBW], 0.001f), - this->dbToLinear(param[fpPreGain]), this->dbToLinear(param[fpPreGain] * 0.5), 1); - bq[1].coeff_orfanidisEQ( - bq[1].calc_omega(param[fpPostFreq] / 12.f), std::max(param[fpPostBW], 0.001f), - this->dbToLinear(param[fpPostGain]), this->dbToLinear(param[fpPostGain] * 0.5), 1); - } - } - - void processStereo(float *datainL, float *datainR, float *dataoutL, float *dataoutR, - float pitch) - { - calc_coeffs(); - float rate alignas(16)[VFXConfig::blockSize]; - lipolRate.store_block(rate); - - bq[0].process_block_to(datainL, datainR, dataoutL, dataoutR); - - for (int k = 0; k < VFXConfig::blockSize; k++) - { - if (dataoutL[k] > v[0]) - v[0] = std::min(dataoutL[k], v[0] + rate[k]); - else - v[0] = std::max(dataoutL[k], v[0] - rate[k]); - dataoutL[k] = v[0]; - - if (dataoutR[k] > v[1]) - v[1] = std::min(dataoutR[k], v[1] + rate[k]); - else - v[1] = std::max(dataoutR[k], v[1] - rate[k]); - dataoutR[k] = v[1]; - } - - bq[1].process_block_to(dataoutL, dataoutR, dataoutL, dataoutR); - } - - void processMonoToMono(float *datainL, float *dataoutL, float pitch) - { - calc_coeffs(); - float rate alignas(16)[VFXConfig::blockSize]; - lipolRate.store_block(rate); - - bq[0].process_block_to(datainL, dataoutL); - - for (int k = 0; k < VFXConfig::blockSize; k++) - { - if (dataoutL[k] > v[0]) - v[0] = std::min(dataoutL[k], v[0] + rate[k]); - else - v[0] = std::max(dataoutL[k], v[0] - rate[k]); - - dataoutL[k] = v[0]; - } - - bq[1].process_block_to(dataoutL, dataoutL); - } - - protected: - std::array mLastParam{}; - std::array v{0.f, 0.f}; - std::array::BiquadFilterType, 2> bq; - - sst::basic_blocks::dsp::lipol_sse lipolRate; -}; -} // namespace sst::voice_effects::filter - -#endif // SHORTCIRCUITXT_BITCRUSHER_H diff --git a/include/sst/voice-effects/filter/StaticPhaser.h b/include/sst/voice-effects/filter/StaticPhaser.h index ca21c58..98568d4 100644 --- a/include/sst/voice-effects/filter/StaticPhaser.h +++ b/include/sst/voice-effects/filter/StaticPhaser.h @@ -69,8 +69,6 @@ template struct StaticPhaser : core::VoiceEffectTemplateBas basic_blocks::params::ParamMetaData intParamAt(int idx) const { using pmd = basic_blocks::params::ParamMetaData; - - assert(numIntParams == 2); switch (idx) { case ipStages: @@ -92,7 +90,6 @@ template struct StaticPhaser : core::VoiceEffectTemplateBas basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < numFloatParams); using pmd = basic_blocks::params::ParamMetaData; switch (idx) diff --git a/include/sst/voice-effects/filter/SurgeBiquads.h b/include/sst/voice-effects/filter/SurgeBiquads.h index d6ad2e6..41d1f68 100644 --- a/include/sst/voice-effects/filter/SurgeBiquads.h +++ b/include/sst/voice-effects/filter/SurgeBiquads.h @@ -63,7 +63,6 @@ template struct SurgeBiquads : core::VoiceEffectTemplateBas basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < numFloatParams); using pmd = basic_blocks::params::ParamMetaData; switch (idx) diff --git a/include/sst/voice-effects/generator/GenPulseSync.h b/include/sst/voice-effects/generator/GenPulseSync.h index 32a489d..731017c 100644 --- a/include/sst/voice-effects/generator/GenPulseSync.h +++ b/include/sst/voice-effects/generator/GenPulseSync.h @@ -70,7 +70,6 @@ template struct GenPulseSync : core::VoiceEffectTemplateBas basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < (int)GenPulseSyncFloatParams::num_params); using pmd = basic_blocks::params::ParamMetaData; /* tune, diff --git a/include/sst/voice-effects/generator/GenSaw.h b/include/sst/voice-effects/generator/GenSaw.h index df51d14..173fe4d 100644 --- a/include/sst/voice-effects/generator/GenSaw.h +++ b/include/sst/voice-effects/generator/GenSaw.h @@ -58,7 +58,6 @@ template struct GenSaw : core::VoiceEffectTemplateBase= 0 && idx < (int)GenSawFloatParams::num_params); using pmd = basic_blocks::params::ParamMetaData; switch ((GenSawFloatParams)idx) diff --git a/include/sst/voice-effects/generator/GenSin.h b/include/sst/voice-effects/generator/GenSin.h index 814c352..2a0d38b 100644 --- a/include/sst/voice-effects/generator/GenSin.h +++ b/include/sst/voice-effects/generator/GenSin.h @@ -58,7 +58,6 @@ template struct GenSin : core::VoiceEffectTemplateBase= 0 && idx < (int)GenSinFloatParams::num_params); using pmd = basic_blocks::params::ParamMetaData; switch ((GenSinFloatParams)idx) diff --git a/include/sst/voice-effects/modulation/FreqShiftMod.h b/include/sst/voice-effects/modulation/FreqShiftMod.h index 2b12363..e838358 100644 --- a/include/sst/voice-effects/modulation/FreqShiftMod.h +++ b/include/sst/voice-effects/modulation/FreqShiftMod.h @@ -59,7 +59,6 @@ template struct FreqShiftMod : core::VoiceEffectTemplateBas basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < (int)FreqShiftModFloatParams::num_params); using pmd = basic_blocks::params::ParamMetaData; switch ((FreqShiftModFloatParams)idx) diff --git a/include/sst/voice-effects/modulation/PhaseMod.h b/include/sst/voice-effects/modulation/PhaseMod.h index 1c8d4e0..69276ef 100644 --- a/include/sst/voice-effects/modulation/PhaseMod.h +++ b/include/sst/voice-effects/modulation/PhaseMod.h @@ -58,7 +58,6 @@ template struct PhaseMod : core::VoiceEffectTemplateBase= 0 && idx < (int)PhaseModFloatParams::num_params); using pmd = basic_blocks::params::ParamMetaData; switch ((PhaseModFloatParams)idx) diff --git a/include/sst/voice-effects/modulation/RingMod.h b/include/sst/voice-effects/modulation/RingMod.h index aa2e573..5ff8b52 100644 --- a/include/sst/voice-effects/modulation/RingMod.h +++ b/include/sst/voice-effects/modulation/RingMod.h @@ -55,7 +55,6 @@ template struct RingMod : core::VoiceEffectTemplateBase= 0 && idx < numFloatParams); using pmd = basic_blocks::params::ParamMetaData; switch (idx) diff --git a/include/sst/voice-effects/waveshaper/WaveShaper.h b/include/sst/voice-effects/waveshaper/WaveShaper.h index 28637a6..7837ee2 100644 --- a/include/sst/voice-effects/waveshaper/WaveShaper.h +++ b/include/sst/voice-effects/waveshaper/WaveShaper.h @@ -60,7 +60,6 @@ template struct WaveShaper : core::VoiceEffectTemplateBase< basic_blocks::params::ParamMetaData paramAt(int idx) const { - assert(idx >= 0 && idx < (int)WaveShaperFloatParams::num_params); using pmd = basic_blocks::params::ParamMetaData; switch ((WaveShaperFloatParams)idx) From 190de4f30ed1f4e58b9efb896bcb4ac067abceef Mon Sep 17 00:00:00 2001 From: Andreya-Autumn Date: Tue, 28 May 2024 00:13:46 +0200 Subject: [PATCH 2/2] 20 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3f088c..778161e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.10) project(sst-effects VERSION 0.5 LANGUAGES C CXX) -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) add_library(${PROJECT_NAME} INTERFACE) target_include_directories(${PROJECT_NAME} INTERFACE include)