From 897c35aad0380b346a392b98e5738fb8eff95642 Mon Sep 17 00:00:00 2001 From: jnonis Date: Fri, 5 Jul 2024 06:00:33 +0000 Subject: [PATCH] Insert FX UI improvements --- src/effects.h | 4 +- src/uimenu.cpp | 103 ++++++++++++++++++++++++++++++++++++++++++++++--- src/uimenu.h | 1 + 3 files changed, 101 insertions(+), 7 deletions(-) diff --git a/src/effects.h b/src/effects.h index c83f21f..49789f9 100644 --- a/src/effects.h +++ b/src/effects.h @@ -36,12 +36,12 @@ inline std::string getFXTypeName(int nValue) { switch (nValue) { - case EFFECT_CHORUS: return "Juno Chorus"; + case EFFECT_CHORUS: return "YKChorus"; case EFFECT_DELAY: return "Delay"; case EFFECT_LPF: return "LP Filter"; case EFFECT_DS1: return "DS1"; case EFFECT_BIGMUFF: return "Big Muff"; - case EFFECT_TALREVERB3: return "Tal Reverb 3"; + case EFFECT_TALREVERB3: return "TalRvrb3"; case EFFECT_NONE: default: return "None"; } diff --git a/src/uimenu.cpp b/src/uimenu.cpp index 4d7a72c..2474e48 100644 --- a/src/uimenu.cpp +++ b/src/uimenu.cpp @@ -65,7 +65,7 @@ const CUIMenu::TMenuItem CUIMenu::s_TGMenu[] = #ifdef ARM_ALLOW_MULTI_CORE {"Pan", EditTGParameter, 0, CMiniDexed::TGParameterPan}, #endif - {"Insert FX", MenuHandler, s_InsertFX}, + {"Insert FX", MenuHandlerInsertFX}, {"Reverb-Send", EditTGParameter, 0, CMiniDexed::TGParameterReverbSend}, {"Detune", EditTGParameter, 0, CMiniDexed::TGParameterMasterTune}, {"Cutoff", EditTGParameter, 0, CMiniDexed::TGParameterCutoff}, @@ -139,8 +139,8 @@ const CUIMenu::TMenuItem CUIMenu::s_ReverbMenu[] = const CUIMenu::TMenuItem CUIMenu::s_InsertFX[] = { - {"Type", EditTGParameter2, 0, CMiniDexed::TGParameterInsertFXType}, - {"Edit", EditInsertFX}, + {"Type:", EditTGParameter2, 0, CMiniDexed::TGParameterInsertFXType}, + {"Edit:", EditInsertFX}, {0} }; @@ -623,6 +623,93 @@ void CUIMenu::MenuHandler (CUIMenu *pUIMenu, TMenuEvent Event) } } +void CUIMenu::MenuHandlerInsertFX (CUIMenu *pUIMenu, TMenuEvent Event) +{ + // Setup menu when it's open + if (!pUIMenu->m_pCurrentMenu) + { + pUIMenu->m_pCurrentMenu = s_InsertFX; + } + + switch (Event) + { + case MenuEventUpdate: + break; + + case MenuEventSelect: // push menu + assert (pUIMenu->m_nCurrentMenuDepth < MaxMenuDepth); + pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_pParentMenu; + pUIMenu->m_MenuStackMenu[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_pCurrentMenu; + pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth] + = pUIMenu->m_nCurrentMenuItem; + pUIMenu->m_nMenuStackSelection[pUIMenu->m_nCurrentMenuDepth] + = pUIMenu->m_nCurrentSelection; + pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth] + = pUIMenu->m_nCurrentParameter; + pUIMenu->m_nCurrentMenuDepth++; + + pUIMenu->m_pParentMenu = pUIMenu->m_pCurrentMenu; + pUIMenu->m_nCurrentParameter = + pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Parameter; + pUIMenu->m_pCurrentMenu = + pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].MenuItem; + pUIMenu->m_nCurrentMenuItem = pUIMenu->m_nCurrentSelection; + pUIMenu->m_nCurrentSelection = 0; + break; + + case MenuEventStepDown: + if (pUIMenu->m_nCurrentSelection > 0) + { + pUIMenu->m_nCurrentSelection--; + } + break; + + case MenuEventStepUp: + ++pUIMenu->m_nCurrentSelection; + if (!pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Name) // more entries? + { + pUIMenu->m_nCurrentSelection--; + } + break; + + case MenuEventPressAndStepDown: + case MenuEventPressAndStepUp: + pUIMenu->TGShortcutHandler (Event); + return; + + default: + return; + } + + if (pUIMenu->m_pCurrentMenu) // if this is another menu? + { + // Identify TG + unsigned nTG = pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth-1]; + // Create TG label + string TG ("TG"); + TG += to_string (nTG+1); + + // Get current FX type + int fxType = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TGParameterInsertFXType, nTG); + + // Create Paramter with type label + std::string value; + value.append(pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Name); + value.append(getFXTypeName(fxType)); + + pUIMenu->m_pUI->DisplayWrite ( + TG.c_str (), + pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, + value.c_str(), + pUIMenu->m_nCurrentSelection > 0, + !!pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection+1].Name); + } + else + { + pUIMenu->EventHandler (MenuEventUpdate); // no, update parameter display + } +} + void CUIMenu::EditGlobalParameter (CUIMenu *pUIMenu, TMenuEvent Event) { CMiniDexed::TParameter Param = (CMiniDexed::TParameter) pUIMenu->m_nCurrentParameter; @@ -966,9 +1053,15 @@ void CUIMenu::EditInsertFX (CUIMenu *pUIMenu, TMenuEvent Event) if (pUIMenu->m_pCurrentMenu) // if this is another menu? { + string TG ("TG"); + TG += to_string (nTG+1); + + // Get current FX type + int fxType = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TGParameterInsertFXType, nTG); + pUIMenu->m_pUI->DisplayWrite ( - pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, - "", + TG.c_str (), + getFXTypeName(fxType).c_str(), pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Name, pUIMenu->m_nCurrentSelection > 0, !!pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection+1].Name); diff --git a/src/uimenu.h b/src/uimenu.h index 682ac30..7fcc647 100644 --- a/src/uimenu.h +++ b/src/uimenu.h @@ -93,6 +93,7 @@ private: static void SavePerformanceNewFile (CUIMenu *pUIMenu, TMenuEvent Event); static void EditPerformanceBankNumber (CUIMenu *pUIMenu, TMenuEvent Event); + static void MenuHandlerInsertFX (CUIMenu *pUIMenu, TMenuEvent Event); static void EditInsertFX (CUIMenu *pUIMenu, TMenuEvent Event); static void EditTGFXParameter (CUIMenu *pUIMenu, TMenuEvent Event);