From d87f5e43157cd0235df3c43fc552a92857db4822 Mon Sep 17 00:00:00 2001 From: Michael Willis Date: Wed, 28 Dec 2022 11:05:10 -0700 Subject: [PATCH] Fix bug that happens when setting predelay to zero --- common/DragonflyVersion.h | 2 +- plugins/dragonfly-hall-reverb/DSP.cpp | 9 ++++++++- plugins/dragonfly-plate-reverb/DSP.cpp | 13 ++++++++++--- plugins/dragonfly-room-reverb/DSP.cpp | 9 ++++++++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/common/DragonflyVersion.h b/common/DragonflyVersion.h index 6c749d8..45cee4a 100644 --- a/common/DragonflyVersion.h +++ b/common/DragonflyVersion.h @@ -16,5 +16,5 @@ #define MAJOR_VERSION 3 #define MINOR_VERSION 2 -#define PATCH_VERSION 7 +#define PATCH_VERSION 8 #define VERSION_SUFFIX "" diff --git a/plugins/dragonfly-hall-reverb/DSP.cpp b/plugins/dragonfly-hall-reverb/DSP.cpp index 797a223..050c336 100644 --- a/plugins/dragonfly-hall-reverb/DSP.cpp +++ b/plugins/dragonfly-hall-reverb/DSP.cpp @@ -71,7 +71,14 @@ void DragonflyReverbDSP::run(const float** inputs, float** outputs, uint32_t fra late.setRSFactor (value / 80.0); break; case paramWidth: early.setwidth (value / 100.0); late.setwidth (value / 100.0); break; - case paramPredelay: late.setPreDelay (value); break; + case paramPredelay: + // Freeverb doesn't handle zero predelay properly + // Instead of modifying the library, avoid it here + if (value < 0.1) { + value = 0.1; + } + late.setPreDelay (value); + break; case paramDiffuse: late.setidiffusion1(value / 140.0); late.setapfeedback (value / 140.0); break; case paramLowCut: early.setoutputhpf (value); diff --git a/plugins/dragonfly-plate-reverb/DSP.cpp b/plugins/dragonfly-plate-reverb/DSP.cpp index b5f177c..2f90d0e 100644 --- a/plugins/dragonfly-plate-reverb/DSP.cpp +++ b/plugins/dragonfly-plate-reverb/DSP.cpp @@ -187,9 +187,16 @@ void DragonflyReverbDSP::run(const float** inputs, float** outputs, uint32_t fra case paramWidth: strev.setwidth (value / 120.0); nrev.setwidth (value / 120.0); nrevb.setwidth (value / 120.0); break; - case paramPredelay: strev.setPreDelay (value); - nrev.setPreDelay (value); - nrevb.setPreDelay (value); break; + case paramPredelay: + // Freeverb doesn't handle zero predelay properly + // Instead of modifying the library, avoid it here + if (value < 0.1) { + value = 0.1; + } + strev.setPreDelay (value); + nrev.setPreDelay (value); + nrevb.setPreDelay (value); + break; case paramDecay: strev.setrt60 (value); nrev.setrt60 (value); nrevb.setrt60 (value); break; diff --git a/plugins/dragonfly-room-reverb/DSP.cpp b/plugins/dragonfly-room-reverb/DSP.cpp index 4b8ba84..e49efcc 100644 --- a/plugins/dragonfly-room-reverb/DSP.cpp +++ b/plugins/dragonfly-room-reverb/DSP.cpp @@ -83,7 +83,14 @@ void DragonflyReverbDSP::run(const float** inputs, float** outputs, uint32_t fra late.setbassboost( newParams[paramBoost] / 20.0 / pow(newParams[paramDecay], 1.5) * (newParams[paramSize] / 10.0) ); break; case paramWidth: early.setwidth (value / 120.0); late.setwidth (value / 100.0); break; - case paramPredelay: late.setPreDelay (value); break; + case paramPredelay: + // Freeverb doesn't handle zero predelay properly + // Instead of modifying the library, avoid it here + if (value < 0.1) { + value = 0.1; + } + late.setPreDelay (value); + break; case paramDecay: late.setrt60 (value); late.setbassboost( newParams[paramBoost] / 20.0 / pow(newParams[paramDecay], 1.5) * (newParams[paramSize] / 10.0) ); break; case paramDiffuse: late.setidiffusion1(value / 120.0);