From a4f84e2ef1d57cb400b9028075f76a8912753a77 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 9 Nov 2024 13:45:44 +0100 Subject: [PATCH 1/8] Update Synth_Dexed Hopefully closes https://github.com/probonopd/MiniDexed/issues/624 --- submod.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submod.sh b/submod.sh index f9524a32..2d9da801 100755 --- a/submod.sh +++ b/submod.sh @@ -20,5 +20,5 @@ cd - # # Use fixed master branch of Synth_Dexed cd Synth_Dexed/ -git checkout c9f5274 +git checkout cb7ad15 cd - From 39a2c73c0fef264d432dd67c54cced6907e5bea4 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 9 Nov 2024 13:51:47 +0100 Subject: [PATCH 2/8] Also update circle --- submod.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submod.sh b/submod.sh index 2d9da801..0180966b 100755 --- a/submod.sh +++ b/submod.sh @@ -12,7 +12,7 @@ cd - # # Optional update submodules explicitly cd circle-stdlib/libs/circle -git checkout fff3764 +git checkout c243194 cd - cd circle-stdlib/libs/circle-newlib #git checkout develop From e949513b31a9d1edfc606507929b3a3c0e714e26 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 9 Nov 2024 14:08:57 +0100 Subject: [PATCH 3/8] Apply build fix from #746 Thanks @soyersoyer --- src/effect_compressor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/effect_compressor.cpp b/src/effect_compressor.cpp index d2aaec7c..1b35c26d 100644 --- a/src/effect_compressor.cpp +++ b/src/effect_compressor.cpp @@ -12,6 +12,7 @@ MIT License. use at your own risk. */ +#include #include #include #include "effect_compressor.h" @@ -203,7 +204,7 @@ void Compressor::setPreGain_dB(float32_t gain_dB) void Compressor::setCompressionRatio(float32_t cr) { - comp_ratio = max(0.001f, cr); //limit to positive values + comp_ratio = std::max(0.001f, cr); //limit to positive values updateThresholdAndCompRatioConstants(); } @@ -213,7 +214,7 @@ void Compressor::setAttack_sec(float32_t a, float32_t fs_Hz) attack_const = expf(-1.0f / (attack_sec * fs_Hz)); //expf() is much faster than exp() //also update the time constant for the envelope extraction - setLevelTimeConst_sec(min(attack_sec,release_sec) / 5.0, fs_Hz); //make the level time-constant one-fifth the gain time constants + setLevelTimeConst_sec(std::min(attack_sec,release_sec) / 5.0, fs_Hz); //make the level time-constant one-fifth the gain time constants } void Compressor::setRelease_sec(float32_t r, float32_t fs_Hz) @@ -222,13 +223,13 @@ void Compressor::setRelease_sec(float32_t r, float32_t fs_Hz) release_const = expf(-1.0f / (release_sec * fs_Hz)); //expf() is much faster than exp() //also update the time constant for the envelope extraction - setLevelTimeConst_sec(min(attack_sec,release_sec) / 5.0, fs_Hz); //make the level time-constant one-fifth the gain time constants + setLevelTimeConst_sec(std::min(attack_sec,release_sec) / 5.0, fs_Hz); //make the level time-constant one-fifth the gain time constants } void Compressor::setLevelTimeConst_sec(float32_t t_sec, float32_t fs_Hz) { const float32_t min_t_sec = 0.002f; //this is the minimum allowed value - level_lp_sec = max(min_t_sec,t_sec); + level_lp_sec = std::max(min_t_sec,t_sec); level_lp_const = expf(-1.0f / (level_lp_sec * fs_Hz)); //expf() is much faster than exp() } From 69c3d43a7f53c647735e883d787822332db8c98d Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 9 Nov 2024 15:51:16 +0100 Subject: [PATCH 4/8] Apply fix from https://codeberg.org/dcoredump/Synth_Dexed/pulls/9 Can be removed once https://codeberg.org/dcoredump/Synth_Dexed/pulls/9 is merged --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8df59112..1d94de85 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,7 @@ jobs: - name: Get specific commits of git submodules run: | sh -ex ./submod.sh + sed -i -e 's|int E;|int32_t E;|g' Synth_Dexed/src/compressor.h # https://codeberg.org/dcoredump/Synth_Dexed/pulls/9 - name: Install toolchains run: | set -ex From d61011000432e36bda2dcd4aa57eebdf00c9f69b Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 9 Nov 2024 16:21:24 +0100 Subject: [PATCH 5/8] Patch properly --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d94de85..1ca67235 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Get specific commits of git submodules run: | sh -ex ./submod.sh - sed -i -e 's|int E;|int32_t E;|g' Synth_Dexed/src/compressor.h # https://codeberg.org/dcoredump/Synth_Dexed/pulls/9 + sed -i -e 's|int32_t E;|int E;|g' Synth_Dexed/src/compressor.h # https://codeberg.org/dcoredump/Synth_Dexed/pulls/9 - name: Install toolchains run: | set -ex From f3c7584b80170d5193a7647bac1c5f878c2135d9 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 9 Nov 2024 15:57:21 +0000 Subject: [PATCH 6/8] Apply soyersoyer@882d6c0 https://github.com/soyersoyer/MiniDexed/commit/882d6c0bcd74b8e948ff327d7927c68b8befd458 --- src/mididevice.cpp | 5 +++++ src/minidexed.cpp | 9 +++++++++ src/minidexed.h | 1 + 3 files changed, 15 insertions(+) diff --git a/src/mididevice.cpp b/src/mididevice.cpp index f2b51def..135d03e2 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -44,6 +44,7 @@ LOGMODULE ("mididevice"); #define MIDI_CC_PAN_POSITION 10 #define MIDI_CC_BANK_SELECT_LSB 32 #define MIDI_CC_BANK_SUSTAIN 64 + #define MIDI_CC_BANK_SOSTENUTO 66 #define MIDI_CC_RESONANCE 71 #define MIDI_CC_FREQUENCY_CUTOFF 74 #define MIDI_CC_REVERB_LEVEL 91 @@ -380,6 +381,10 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign case MIDI_CC_BANK_SUSTAIN: m_pSynthesizer->setSustain (pMessage[2] >= 64, nTG); break; + + case MIDI_CC_BANK_SOSTENUTO: + m_pSynthesizer->setSostenuto (pMessage[2] >= 64, nTG); + break; case MIDI_CC_RESONANCE: m_pSynthesizer->SetResonance (maplong (pMessage[2], 0, 127, 0, 99), nTG); diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 2e45f46b..9e144998 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -830,6 +830,15 @@ void CMiniDexed::setSustain(bool sustain, unsigned nTG) m_pTG[nTG]->setSustain (sustain); } +void CMiniDexed::setSostenuto(bool sostenuto, unsigned nTG) +{ + assert (nTG < CConfig::AllToneGenerators); + if (nTG >= m_nToneGenerators) return; // Not an active TG + + assert (m_pTG[nTG]); + m_pTG[nTG]->setSostenuto (sostenuto); +} + void CMiniDexed::panic(uint8_t value, unsigned nTG) { assert (nTG < CConfig::AllToneGenerators); diff --git a/src/minidexed.h b/src/minidexed.h index 69dcf9ce..cc625349 100644 --- a/src/minidexed.h +++ b/src/minidexed.h @@ -84,6 +84,7 @@ class CMiniDexed void keydown (int16_t pitch, uint8_t velocity, unsigned nTG); void setSustain (bool sustain, unsigned nTG); + void setSostenuto (bool sostenuto, unsigned nTG); void panic (uint8_t value, unsigned nTG); void notesOff (uint8_t value, unsigned nTG); void setModWheel (uint8_t value, unsigned nTG); From d98bc80d1a7a7268ca4a2e4fb764a1dbb7fc5341 Mon Sep 17 00:00:00 2001 From: probonopd Date: Fri, 15 Nov 2024 18:42:29 +0100 Subject: [PATCH 7/8] Update Synth_Dexed to 919f71f --- submod.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submod.sh b/submod.sh index 0180966b..5beea0b3 100755 --- a/submod.sh +++ b/submod.sh @@ -20,5 +20,5 @@ cd - # # Use fixed master branch of Synth_Dexed cd Synth_Dexed/ -git checkout cb7ad15 +git checkout 919f71f cd - From 820aeb33fb45c88b54b9ac6cbda59acb1d46a251 Mon Sep 17 00:00:00 2001 From: probonopd Date: Fri, 15 Nov 2024 19:46:04 +0100 Subject: [PATCH 8/8] Remove patch no longer needed --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ca67235..4bc6d012 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,10 @@ jobs: - name: Get specific commits of git submodules run: | sh -ex ./submod.sh - sed -i -e 's|int32_t E;|int E;|g' Synth_Dexed/src/compressor.h # https://codeberg.org/dcoredump/Synth_Dexed/pulls/9 + - name: Apply patches + run: | + # Put git hash in startup message + sed -i "s/Loading.../$(date +%Y%m%d)-$(git rev-parse --short HEAD)/g" src/userinterface.cpp - name: Install toolchains run: | set -ex