From 4a9bf44b56145e913e1fa5fe8894206bda931b10 Mon Sep 17 00:00:00 2001 From: Electric Keet Date: Tue, 22 Aug 2023 13:24:45 -0700 Subject: [PATCH 1/4] Fix macro mode changes resetting Bottom and Top. --- src/gui/insEdit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 86f08232b..cdbbe9d12 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1767,8 +1767,8 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail \ /* if ADSR/LFO, populate min/max */ \ if (i.macro->open&6) { \ - i.macro->val[0]=i.min; \ - i.macro->val[1]=i.max; \ + i.macro->val[0]=(i.macro->val[0]val[0]>i.max ? i.max : i.macro->val[0])); \ + i.macro->val[1]=(i.macro->val[1]val[1]>i.max ? i.max : i.macro->val[1])); \ } \ } \ PARAMETER; \ From ab76546f7a60a1c39a735b161b2c2ae95c73cd7f Mon Sep 17 00:00:00 2001 From: Electric Keet Date: Tue, 22 Aug 2023 14:23:32 -0700 Subject: [PATCH 2/4] Fixing the fix. This checks for both values being set to zero (their freshly-initialized state, which shouldn't happen in normal use) and sets them to proper defaults if so. Otherwise, it uses what was already there. --- src/gui/insEdit.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index cdbbe9d12..0dcd729db 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1767,6 +1767,10 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail \ /* if ADSR/LFO, populate min/max */ \ if (i.macro->open&6) { \ + if ((i.macro->val[0]==0) & (i.macro->val[1]==0)) { \ + i.macro->val[0]=i.min; \ + i.macro->val[1]=i.max; \ + } \ i.macro->val[0]=(i.macro->val[0]val[0]>i.max ? i.max : i.macro->val[0])); \ i.macro->val[1]=(i.macro->val[1]val[1]>i.max ? i.max : i.macro->val[1])); \ } \ From 92773adb376a11850a82351f56af5eb701afc0d0 Mon Sep 17 00:00:00 2001 From: Electric Keet Date: Wed, 23 Aug 2023 09:47:31 -0700 Subject: [PATCH 3/4] Correcting an ampersand. Little things like this make a difference. --- src/gui/insEdit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 0dcd729db..04350a8a6 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1767,7 +1767,7 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail \ /* if ADSR/LFO, populate min/max */ \ if (i.macro->open&6) { \ - if ((i.macro->val[0]==0) & (i.macro->val[1]==0)) { \ + if ((i.macro->val[0]==0) && (i.macro->val[1]==0)) { \ i.macro->val[0]=i.min; \ i.macro->val[1]=i.max; \ } \ From cb0a8396c4151bbebca7669af2b4cf5a9008e651 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 24 Aug 2023 04:31:32 -0500 Subject: [PATCH 4/4] improve --- src/gui/insEdit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index b470e7632..562c8222c 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1767,12 +1767,12 @@ void FurnaceGUI::drawMacroEdit(FurnaceGUIMacroDesc& i, int totalFit, float avail \ /* if ADSR/LFO, populate min/max */ \ if (i.macro->open&6) { \ - if ((i.macro->val[0]==0) && (i.macro->val[1]==0)) { \ + if (i.macro->val[0]==0 && i.macro->val[1]==0) { \ i.macro->val[0]=i.min; \ i.macro->val[1]=i.max; \ } \ - i.macro->val[0]=(i.macro->val[0]val[0]>i.max ? i.max : i.macro->val[0])); \ - i.macro->val[1]=(i.macro->val[1]val[1]>i.max ? i.max : i.macro->val[1])); \ + i.macro->val[0]=CLAMP(i.macro->val[0],i.min,i.max); \ + i.macro->val[1]=CLAMP(i.macro->val[1],i.min,i.max); \ } \ } \ PARAMETER; \