From 9b585c619d50258724c1cb2cf81ed58f9ce3ba64 Mon Sep 17 00:00:00 2001 From: Andreya-Autumn Date: Thu, 30 May 2024 20:41:06 +0200 Subject: [PATCH] clang-format --- include/sst/voice-effects/delay/ShortDelay.h | 65 +++++++++---------- include/sst/voice-effects/filter/CytomicSVF.h | 62 +++++++++--------- 2 files changed, 60 insertions(+), 67 deletions(-) diff --git a/include/sst/voice-effects/delay/ShortDelay.h b/include/sst/voice-effects/delay/ShortDelay.h index b279bad..e7f156a 100644 --- a/include/sst/voice-effects/delay/ShortDelay.h +++ b/include/sst/voice-effects/delay/ShortDelay.h @@ -61,12 +61,12 @@ template struct ShortDelay : core::VoiceEffectTemplateBase< fpLowCut, fpHighCut }; - + enum IntParams { ipStereo }; - + ShortDelay(const SincTable &st) : sSincTable(st), core::VoiceEffectTemplateBase(), lp(this), hp(this) { @@ -120,7 +120,7 @@ template struct ShortDelay : core::VoiceEffectTemplateBase< } return pmd().withName("Error"); } - + basic_blocks::params::ParamMetaData intParamAt(int idx) const { using pmd = basic_blocks::params::ParamMetaData; @@ -165,36 +165,32 @@ template struct ShortDelay : core::VoiceEffectTemplateBase< template void stereoImpl(const std::array &lines, float *datainL, float *datainR, - float *dataoutL, float *dataoutR) + float *dataoutL, float *dataoutR) { namespace mech = sst::basic_blocks::mechanics; namespace sdsp = sst::basic_blocks::dsp; auto stereoSwitch = this->getIntParam(ipStereo); - + mech::copy_from_to(datainL, dataoutL); mech::copy_from_to(datainR, dataoutR); float FIRipol = static_cast(SincTable::FIRipol_N); - + auto timeL = this->getFloatParam(fpTimeL); auto timeR = (stereoSwitch) ? this->getFloatParam(fpTimeR) : timeL; - - lipolDelay[0].set_target( - std::max((std::clamp(timeL, 0.f, maxMiliseconds) * - this->getSampleRate() / 1000.f), - FIRipol)); - lipolDelay[1].set_target( - std::max((std::clamp(timeR, 0.f, maxMiliseconds) * - this->getSampleRate() / 1000.f), - FIRipol)); + + lipolDelay[0].set_target(std::max( + (std::clamp(timeL, 0.f, maxMiliseconds) * this->getSampleRate() / 1000.f), FIRipol)); + lipolDelay[1].set_target(std::max( + (std::clamp(timeR, 0.f, maxMiliseconds) * this->getSampleRate() / 1000.f), FIRipol)); float ld alignas(16)[2][VFXConfig::blockSize]; lipolDelay[0].store_block(ld[0]); lipolDelay[1].store_block(ld[1]); - + lipolFb.set_target(std::clamp(this->getFloatParam(fpFeedback), 0.f, 1.f)); float feedback alignas(16)[VFXConfig::blockSize]; lipolFb.store_block(feedback); - + lipolCross.set_target(std::clamp(this->getFloatParam(fpCrossFeed), 0.f, 1.f)); float crossfeed alignas(16)[VFXConfig::blockSize]; lipolCross.store_block(crossfeed); @@ -215,11 +211,11 @@ template struct ShortDelay : core::VoiceEffectTemplateBase< auto fbc0 = feedback[i] * dataoutL[i]; auto fbc1 = feedback[i] * dataoutR[i]; - + if (stereoSwitch) { - fbc0 += crossfeed[i] * dataoutR[i]; - fbc1 += crossfeed[i] * dataoutL[i]; + fbc0 += crossfeed[i] * dataoutR[i]; + fbc1 += crossfeed[i] * dataoutL[i]; } // soft clip for now @@ -233,9 +229,8 @@ template struct ShortDelay : core::VoiceEffectTemplateBase< lines[1]->write(datainR[i] + fbc1); } } - - template - void monoImpl(T *line, float *datainL, float *dataoutL) + + template void monoImpl(T *line, float *datainL, float *dataoutL) { namespace mech = sst::basic_blocks::mechanics; namespace sdsp = sst::basic_blocks::dsp; @@ -284,33 +279,33 @@ template struct ShortDelay : core::VoiceEffectTemplateBase< if (isShort) { stereoImpl(std::array{lineSupport[0].template getLinePointer(), - lineSupport[1].template getLinePointer()}, - datainL, datainR, dataoutL, dataoutR); + lineSupport[1].template getLinePointer()}, + datainL, datainR, dataoutL, dataoutR); } else { stereoImpl(std::array{lineSupport[0].template getLinePointer(), - lineSupport[1].template getLinePointer()}, - datainL, datainR, dataoutL, dataoutR); + lineSupport[1].template getLinePointer()}, + datainL, datainR, dataoutL, dataoutR); } } - + void processMonoToStereo(float *datain, float *dataoutL, float *dataoutR, float pitch) { if (isShort) { stereoImpl(std::array{lineSupport[0].template getLinePointer(), - lineSupport[1].template getLinePointer()}, - datain, datain, dataoutL, dataoutR); + lineSupport[1].template getLinePointer()}, + datain, datain, dataoutL, dataoutR); } else { stereoImpl(std::array{lineSupport[0].template getLinePointer(), - lineSupport[1].template getLinePointer()}, - datain, datain, dataoutL, dataoutR); + lineSupport[1].template getLinePointer()}, + datain, datain, dataoutL, dataoutR); } } - + void processMonoToMono(float *datain, float *dataout, float pitch) { if (isShort) @@ -322,9 +317,9 @@ template struct ShortDelay : core::VoiceEffectTemplateBase< monoImpl(lineSupport[0].template getLinePointer(), datain, dataout); } } - + bool getMonoToStereoSetting() const { return this->getIntParam(ipStereo) > 0; } - + protected: std::array lineSupport; bool isShort{true}; diff --git a/include/sst/voice-effects/filter/CytomicSVF.h b/include/sst/voice-effects/filter/CytomicSVF.h index e34e43c..e13242f 100644 --- a/include/sst/voice-effects/filter/CytomicSVF.h +++ b/include/sst/voice-effects/filter/CytomicSVF.h @@ -47,7 +47,7 @@ template struct CytomicSVF : core::VoiceEffectTemplateBase< } ~CytomicSVF() {} - + enum floatParams { fpFreqL, @@ -55,13 +55,13 @@ template struct CytomicSVF : core::VoiceEffectTemplateBase< fpResonance, fpShelf, }; - + enum intParams { ipMode, ipStereo }; - + basic_blocks::params::ParamMetaData paramAt(int idx) const { using pmd = basic_blocks::params::ParamMetaData; @@ -79,7 +79,7 @@ template struct CytomicSVF : core::VoiceEffectTemplateBase< .withLinearScaleFormatting("semitones"); } return pmd().asAudibleFrequency().withName("Cutoff (L)").withDefault(0); - + case 1: if (keytrackOn) { @@ -112,33 +112,32 @@ template struct CytomicSVF : core::VoiceEffectTemplateBase< using md = sst::filters::CytomicSVF::Mode; switch (idx) { - case ipMode: - return pmd() - .asInt() - .withRange(0, 8) - .withName("Mode") - .withUnorderedMapFormatting({ - {md::LP, "Low Pass"}, - {md::HP, "High Pass"}, - {md::BP, "Band Pass"}, - {md::NOTCH, "Notch"}, - {md::PEAK, "Peak"}, - {md::ALL, "All Pass"}, - {md::BELL, "Bell"}, - {md::LOW_SHELF, "Low Shelf"}, - {md::HIGH_SHELF, "High Shelf"}, - }) - .withDefault(md::LP); + case ipMode: + return pmd() + .asInt() + .withRange(0, 8) + .withName("Mode") + .withUnorderedMapFormatting({ + {md::LP, "Low Pass"}, + {md::HP, "High Pass"}, + {md::BP, "Band Pass"}, + {md::NOTCH, "Notch"}, + {md::PEAK, "Peak"}, + {md::ALL, "All Pass"}, + {md::BELL, "Bell"}, + {md::LOW_SHELF, "Low Shelf"}, + {md::HIGH_SHELF, "High Shelf"}, + }) + .withDefault(md::LP); case ipStereo: return pmd().asBool().withDefault(false).withName("Stereo"); } return pmd().withName("error"); - } void initVoiceEffect() {} void initVoiceEffectParams() { this->initToParamMetadataDefault(this); } - + void calc_coeffs(float pitch = 0.f) { std::array param; @@ -169,21 +168,21 @@ template struct CytomicSVF : core::VoiceEffectTemplateBase< } auto mode = (sst::filters::CytomicSVF::Mode)(iparam[0]); - auto res = std::clamp(param[2], 0.f, 1.f); auto shelf = this->dbToLinear(param[3]); - + if (this->getIntParam(ipStereo)) { auto freqL = 440.0 * this->note_to_pitch_ignoring_tuning(param[0]); auto freqR = 440.0 * this->note_to_pitch_ignoring_tuning(param[1]); - cySvf.setCoeffForBlock(mode, freqL, freqR, res, res, this->getSampleRateInv(), shelf, shelf); + cySvf.setCoeffForBlock( + mode, freqL, freqR, res, res, this->getSampleRateInv(), shelf, shelf); } else { auto freq = 440.0 * this->note_to_pitch_ignoring_tuning(param[0]); - cySvf.setCoeffForBlock(mode, freq, res, this->getSampleRateInv(), - shelf); + cySvf.setCoeffForBlock(mode, freq, res, + this->getSampleRateInv(), shelf); } mLastParam = param; @@ -207,14 +206,13 @@ template struct CytomicSVF : core::VoiceEffectTemplateBase< calc_coeffs(pitch); cySvf.processBlock(datainL, dataoutL); } - - void processMonoToStereo(float *datainL, float *dataoutL, float *dataoutR, - float pitch) + + void processMonoToStereo(float *datainL, float *dataoutL, float *dataoutR, float pitch) { calc_coeffs(pitch); cySvf.processBlock(datainL, datainL, dataoutL, dataoutR); } - + bool getMonoToStereoSetting() const { return this->getIntParam(ipStereo) > 0; } bool enableKeytrack(bool b)