From 3a51fd74a7e0b294a6160e7009a5ea58f2cc931a Mon Sep 17 00:00:00 2001 From: Luca <51792528+donluca@users.noreply.github.com> Date: Fri, 7 Apr 2023 22:27:14 +0200 Subject: [PATCH] Skip empty voices while scrolling (#466) * Skip empty voices while scrolling * Added more cases where the voice is empty * Filter out "EMPTY " To be used together with a curated collection of banks that use the name `EMPTY ` instead of `INIT VOICE` --------- Co-authored-by: probonopd --- src/uimenu.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/uimenu.cpp b/src/uimenu.cpp index cc1d670..ee83016 100644 --- a/src/uimenu.cpp +++ b/src/uimenu.cpp @@ -581,15 +581,29 @@ void CUIMenu::EditProgramNumber (CUIMenu *pUIMenu, TMenuEvent Event) return; } - string TG ("TG"); - TG += to_string (nTG+1); + string voiceName = pUIMenu->m_pMiniDexed->GetVoiceName (nTG); // Skip empty voices + if (voiceName == "EMPTY " + || voiceName == " " + || voiceName == "----------" + || voiceName == "~~~~~~~~~~" ) + { + if (Event == MenuEventStepUp) { + CUIMenu::EditProgramNumber (pUIMenu, MenuEventStepUp); + } + if (Event == MenuEventStepDown) { + CUIMenu::EditProgramNumber (pUIMenu, MenuEventStepDown); + } + } else { + string TG ("TG"); + TG += to_string (nTG+1); - string Value = to_string (nValue+1) + "=" + pUIMenu->m_pMiniDexed->GetVoiceName (nTG); + string Value = to_string (nValue+1) + "=" + pUIMenu->m_pMiniDexed->GetVoiceName (nTG); - pUIMenu->m_pUI->DisplayWrite (TG.c_str (), - pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, - Value.c_str (), - nValue > 0, nValue < (int) CSysExFileLoader::VoicesPerBank-1); + pUIMenu->m_pUI->DisplayWrite (TG.c_str (), + pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, + Value.c_str (), + nValue > 0, nValue < (int) CSysExFileLoader::VoicesPerBank-1); + } } void CUIMenu::EditTGParameter (CUIMenu *pUIMenu, TMenuEvent Event)