Update uimenu.cpp

pull/206/head
arsamus 3 years ago committed by GitHub
parent 3b6cb21d64
commit fad2ae4ba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 84
      src/uimenu.cpp

@ -86,16 +86,16 @@ const CUIMenu::TMenuItem CUIMenu::s_EffectsMenu[] =
const CUIMenu::TMenuItem CUIMenu::s_EditPitchBenderMenu[] =
{
{"Bender Range", EditTGParameter, 0, CMiniDexed::TGParameterPitchBenderRange},
{"Bender Step", EditTGParameter, 0, CMiniDexed::TGParameterPitchBenderStep},
{"Bender Range", EditTGParameter2, 0, CMiniDexed::TGParameterPitchBenderRange},
{"Bender Step", EditTGParameter2, 0, CMiniDexed::TGParameterPitchBenderStep},
{0}
};
const CUIMenu::TMenuItem CUIMenu::s_EditPortamentoMenu[] =
{
{"Mode", EditTGParameter, 0, CMiniDexed::TGParameterPortamentoMode},
{"Glissando", EditTGParameter, 0, CMiniDexed::TGParameterPortamentoGlissando},
{"Time", EditTGParameter, 0, CMiniDexed::TGParameterPortamentoTime},
{"Mode", EditTGParameter2, 0, CMiniDexed::TGParameterPortamentoMode},
{"Glissando", EditTGParameter2, 0, CMiniDexed::TGParameterPortamentoGlissando},
{"Time", EditTGParameter2, 0, CMiniDexed::TGParameterPortamentoTime},
{0}
};
@ -581,6 +581,60 @@ void CUIMenu::EditTGParameter (CUIMenu *pUIMenu, TMenuEvent Event)
nValue > rParam.Minimum, nValue < rParam.Maximum);
}
void CUIMenu::EditTGParameter2 (CUIMenu *pUIMenu, TMenuEvent Event) // second menu level. Redundant code but in order to not modified original code
{
unsigned nTG = pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth-2];
CMiniDexed::TTGParameter Param = (CMiniDexed::TTGParameter) pUIMenu->m_nCurrentParameter;
const TParameter &rParam = s_TGParameter[Param];
int nValue = pUIMenu->m_pMiniDexed->GetTGParameter (Param, nTG);
switch (Event)
{
case MenuEventUpdate:
break;
case MenuEventStepDown:
nValue -= rParam.Increment;
if (nValue < rParam.Minimum)
{
nValue = rParam.Minimum;
}
pUIMenu->m_pMiniDexed->SetTGParameter (Param, nValue, nTG);
break;
case MenuEventStepUp:
nValue += rParam.Increment;
if (nValue > rParam.Maximum)
{
nValue = rParam.Maximum;
}
pUIMenu->m_pMiniDexed->SetTGParameter (Param, nValue, nTG);
break;
case MenuEventPressAndStepDown:
case MenuEventPressAndStepUp:
pUIMenu->TGShortcutHandler (Event);
return;
default:
return;
}
string TG ("TG");
TG += to_string (nTG+1);
string Value = GetTGValueString (Param, pUIMenu->m_pMiniDexed->GetTGParameter (Param, nTG));
pUIMenu->m_pUI->DisplayWrite (TG.c_str (),
pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name,
Value.c_str (),
nValue > rParam.Minimum, nValue < rParam.Maximum);
}
void CUIMenu::EditVoiceParameter (CUIMenu *pUIMenu, TMenuEvent Event)
{
unsigned nTG = pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth-2];
@ -944,6 +998,26 @@ string CUIMenu::ToOscillatorDetune (int nValue)
return Result;
}
string CUIMenu::ToPortaMode (int nValue)
{
switch (nValue)
{
case 0: return "Fingered";
case 1: return "Full time";
default: return to_string (nValue);
}
};
string CUIMenu::ToPortaGlissando (int nValue)
{
switch (nValue)
{
case 0: return "Off";
case 1: return "On";
default: return to_string (nValue);
}
};
void CUIMenu::TGShortcutHandler (TMenuEvent Event)
{
assert (m_nCurrentMenuDepth >= 2);

Loading…
Cancel
Save