mirror of https://github.com/probonopd/MiniDexed
Merge b68e57e106
into b8804a0d2e
commit
d5e0c16e6e
@ -0,0 +1,73 @@ |
|||||||
|
From 7daa07bd662d1894bc312b81c6b9e79260e7a66a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Gergo Koteles <soyer@irl.hu>
|
||||||
|
Date: Fri, 11 Jul 2025 20:28:52 +0200
|
||||||
|
Subject: [PATCH] PluginFX change gain at zero crossing
|
||||||
|
|
||||||
|
---
|
||||||
|
src/PluginFx.cpp | 26 +++++++++++++++++++-------
|
||||||
|
src/PluginFx.h | 2 ++
|
||||||
|
2 files changed, 21 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/PluginFx.cpp b/src/PluginFx.cpp
|
||||||
|
index 7c3a1ab..2b7bb9b 100644
|
||||||
|
--- a/src/PluginFx.cpp
|
||||||
|
+++ b/src/PluginFx.cpp
|
||||||
|
@@ -56,6 +56,7 @@ PluginFx::PluginFx() {
|
||||||
|
Cutoff = 1.0;
|
||||||
|
Reso = 0.0;
|
||||||
|
Gain = 1.0;
|
||||||
|
+ aGain = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PluginFx::init(FRAC_NUM sr) {
|
||||||
|
@@ -117,16 +118,27 @@ void PluginFx::process(float *work, uint16_t sampleSize) {
|
||||||
|
|
||||||
|
dc_od = work[sampleSize - 1];
|
||||||
|
|
||||||
|
- // Gain
|
||||||
|
- if (Gain == 0.0)
|
||||||
|
- {
|
||||||
|
+ if (Gain != aGain) {
|
||||||
|
for (uint16_t i = 0; i < sampleSize; i++ )
|
||||||
|
- work[i] = 0.0;
|
||||||
|
+ {
|
||||||
|
+ if (i != 0 && work[i] >= 0 && work[i-1] <= 0)
|
||||||
|
+ aGain = Gain;
|
||||||
|
+ work[i] *= aGain;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
- else if ( Gain != 1.0)
|
||||||
|
+ else
|
||||||
|
{
|
||||||
|
- for (uint16_t i = 0; i < sampleSize; i++ )
|
||||||
|
- work[i] *= Gain;
|
||||||
|
+ // Gain
|
||||||
|
+ if (aGain == 0.0)
|
||||||
|
+ {
|
||||||
|
+ for (uint16_t i = 0; i < sampleSize; i++ )
|
||||||
|
+ work[i] = 0.0;
|
||||||
|
+ }
|
||||||
|
+ else if ( aGain != 1.0)
|
||||||
|
+ {
|
||||||
|
+ for (uint16_t i = 0; i < sampleSize; i++ )
|
||||||
|
+ work[i] *= aGain;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't apply the LPF if the cutoff is to maximum
|
||||||
|
diff --git a/src/PluginFx.h b/src/PluginFx.h
|
||||||
|
index 090e241..c27ccc5 100644
|
||||||
|
--- a/src/PluginFx.h
|
||||||
|
+++ b/src/PluginFx.h
|
||||||
|
@@ -67,6 +67,8 @@ class PluginFx {
|
||||||
|
float Reso;
|
||||||
|
float Gain;
|
||||||
|
|
||||||
|
+ float aGain;
|
||||||
|
+
|
||||||
|
void init(FRAC_NUM sampleRate);
|
||||||
|
void process(float *work, uint16_t sampleSize);
|
||||||
|
float getGain(void);
|
||||||
|
--
|
||||||
|
2.50.1
|
||||||
|
|
Loading…
Reference in new issue