Skip to content

Commit

Permalink
clamp (#78)
Browse files Browse the repository at this point in the history
Fixes delay time == 0 issue
  • Loading branch information
Andreya-Autumn authored May 12, 2024
1 parent 5d7ef6d commit 65c5511
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions include/sst/voice-effects/delay/ShortDelay.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,12 @@ template <typename VFXConfig> struct ShortDelay : core::VoiceEffectTemplateBase<
namespace sdsp = sst::basic_blocks::dsp;
mech::copy_from_to<VFXConfig::blockSize>(datainL, dataoutL);
mech::copy_from_to<VFXConfig::blockSize>(datainR, dataoutR);
float FIRipol = static_cast<float>(SincTable::FIRipol_N);

lipolDelay[0].set_target(std::clamp(this->getFloatParam(fpTimeL), 0.f, maxMiliseconds) *
this->getSampleRate() / 1000.f);
lipolDelay[1].set_target(std::clamp(this->getFloatParam(fpTimeR), 0.f, maxMiliseconds) *
this->getSampleRate() / 1000.f);
lipolDelay[0].set_target(std::max((std::clamp(this->getFloatParam(fpTimeL), 0.f, maxMiliseconds) *
this->getSampleRate() / 1000.f), FIRipol));
lipolDelay[1].set_target(std::max((std::clamp(this->getFloatParam(fpTimeR), 0.f, maxMiliseconds) *
this->getSampleRate() / 1000.f), FIRipol));

lipolFb.set_target(std::clamp(this->getFloatParam(fpFeedback), 0.f, 1.f));
lipolCross.set_target(std::clamp(this->getFloatParam(fpCrossFeed), 0.f, 1.f));
Expand Down

0 comments on commit 65c5511

Please sign in to comment.