patch Synth_Dexed PluginFX to use zero cross detection

pull/955/head
Gergo Koteles 7 days ago
parent 0a85ff4789
commit b68e57e106
  1. 10
      .github/workflows/build.yml
  2. 73
      src/patches/0001-PluginFX-change-gain-at-zero-crossing.patch

@ -39,6 +39,11 @@ jobs:
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
tar xf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz tar xf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz
# Patch Synth_Dexed PluginFX
- name: Patch Synth_Dexed
run: |
( cd Synth_Dexed ; patch -p1 < ../src/patches/0001-PluginFX-change-gain-at-zero-crossing.patch )
- name: Build for Raspberry Pi 5 (64-bit) - name: Build for Raspberry Pi 5 (64-bit)
run: | run: |
set -ex set -ex
@ -124,6 +129,11 @@ jobs:
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz
tar xf gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz tar xf gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz
# Patch Synth_Dexed PluginFX
- name: Patch Synth_Dexed
run: |
( cd Synth_Dexed ; patch -p1 < ../src/patches/0001-PluginFX-change-gain-at-zero-crossing.patch )
- name: Build for Raspberry Pi 2 (32-bit) - name: Build for Raspberry Pi 2 (32-bit)
run: | run: |
set -ex set -ex

@ -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…
Cancel
Save