|
|
|
@ -30,6 +30,7 @@ |
|
|
|
|
#include <circle/sysconfig.h> |
|
|
|
|
#include <assert.h> |
|
|
|
|
#include <chrono> |
|
|
|
|
#include <random> |
|
|
|
|
|
|
|
|
|
#include <dexed.h> |
|
|
|
|
|
|
|
|
@ -197,8 +198,7 @@ const CUIMenu::TMenuItem CUIMenu::s_OperatorMenu[] = |
|
|
|
|
{"K Vel. Sens.", EditOPParameter, 0, DEXED_OP_KEY_VEL_SENS}, |
|
|
|
|
{"Enable", EditOPParameter, 0, DEXED_OP_ENABLE}, |
|
|
|
|
{"Random", CUIMenu::GenerateRandomOperator, nullptr, 0}, |
|
|
|
|
{0} |
|
|
|
|
}; |
|
|
|
|
{0}}; |
|
|
|
|
|
|
|
|
|
const CUIMenu::TMenuItem CUIMenu::s_SaveMenu[] = |
|
|
|
|
{ |
|
|
|
@ -323,7 +323,6 @@ const char CUIMenu::s_NoteName[100][4] = |
|
|
|
|
"A8", "A#8", "B8", "C8", "C#8", "D8", "D#8", "E8", "F8", "F#8", "G8", "G#8", |
|
|
|
|
"A9", "A#9", "B9", "C9" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static const unsigned NoteC3 = 27; |
|
|
|
|
|
|
|
|
|
const CUIMenu::TMenuItem CUIMenu::s_PerformanceMenu[] = |
|
|
|
@ -335,6 +334,7 @@ const CUIMenu::TMenuItem CUIMenu::s_PerformanceMenu[] = |
|
|
|
|
{0} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CUIMenu::CUIMenu (CUserInterface *pUI, CMiniDexed *pMiniDexed) |
|
|
|
|
: m_pUI (pUI), |
|
|
|
|
m_pMiniDexed (pMiniDexed), |
|
|
|
@ -426,9 +426,12 @@ void CUIMenu::MenuHandler(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
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_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; |
|
|
|
@ -510,8 +513,7 @@ void CUIMenu::EditGlobalParameter(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
|
|
|
|
|
const char *pMenuName = |
|
|
|
|
pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth-1] |
|
|
|
|
[pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth - 1]] |
|
|
|
|
.Name; |
|
|
|
|
[pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth-1]].Name; |
|
|
|
|
|
|
|
|
|
string Value = GetGlobalValueString (Param, pUIMenu->m_pMiniDexed->GetParameter (Param)); |
|
|
|
|
|
|
|
|
@ -556,7 +558,8 @@ void CUIMenu::EditVoiceBankNumber(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
string TG ("TG"); |
|
|
|
|
TG += to_string (nTG+1); |
|
|
|
|
|
|
|
|
|
string Value = to_string(nValue + 1) + "=" + pUIMenu->m_pMiniDexed->GetSysExFileLoader()->GetBankName(nValue); |
|
|
|
|
string Value = to_string (nValue+1) + "=" |
|
|
|
|
+ pUIMenu->m_pMiniDexed->GetSysExFileLoader ()->GetBankName (nValue); |
|
|
|
|
|
|
|
|
|
pUIMenu->m_pUI->DisplayWrite (TG.c_str (), |
|
|
|
|
pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, |
|
|
|
@ -609,19 +612,18 @@ void CUIMenu::EditProgramNumber(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string voiceName = pUIMenu->m_pMiniDexed->GetVoiceName (nTG); // Skip empty voices
|
|
|
|
|
if (voiceName == "EMPTY " || voiceName == " " || voiceName == "----------" || voiceName == "~~~~~~~~~~") |
|
|
|
|
{ |
|
|
|
|
if (Event == MenuEventStepUp) |
|
|
|
|
if (voiceName == "EMPTY " |
|
|
|
|
|| voiceName == " " |
|
|
|
|
|| voiceName == "----------" |
|
|
|
|
|| voiceName == "~~~~~~~~~~" ) |
|
|
|
|
{ |
|
|
|
|
if (Event == MenuEventStepUp) { |
|
|
|
|
CUIMenu::EditProgramNumber (pUIMenu, MenuEventStepUp); |
|
|
|
|
} |
|
|
|
|
if (Event == MenuEventStepDown) |
|
|
|
|
{ |
|
|
|
|
if (Event == MenuEventStepDown) { |
|
|
|
|
CUIMenu::EditProgramNumber (pUIMenu, MenuEventStepDown); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
string TG ("TG"); |
|
|
|
|
TG += to_string (nTG+1); |
|
|
|
|
|
|
|
|
@ -737,6 +739,7 @@ void CUIMenu::EditTGParameter2(CUIMenu *pUIMenu, TMenuEvent Event) // second men |
|
|
|
|
pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, |
|
|
|
|
Value.c_str (), |
|
|
|
|
nValue > rParam.Minimum, nValue < rParam.Maximum); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CUIMenu::EditVoiceParameter (CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
@ -905,8 +908,7 @@ void CUIMenu::SavePerformance(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
|
|
|
|
|
const char *pMenuName = |
|
|
|
|
pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth-1] |
|
|
|
|
[pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth - 1]] |
|
|
|
|
.Name; |
|
|
|
|
[pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth-1]].Name; |
|
|
|
|
|
|
|
|
|
pUIMenu->m_pUI->DisplayWrite (pMenuName, |
|
|
|
|
pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, |
|
|
|
@ -1021,12 +1023,9 @@ string CUIMenu::ToMIDIChannel(int nValue) |
|
|
|
|
{ |
|
|
|
|
switch (nValue) |
|
|
|
|
{ |
|
|
|
|
case CMIDIDevice::OmniMode: |
|
|
|
|
return "Omni"; |
|
|
|
|
case CMIDIDevice::Disabled: |
|
|
|
|
return "Off"; |
|
|
|
|
default: |
|
|
|
|
return to_string(nValue + 1); |
|
|
|
|
case CMIDIDevice::OmniMode: return "Omni"; |
|
|
|
|
case CMIDIDevice::Disabled: return "Off"; |
|
|
|
|
default: return to_string (nValue+1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1110,12 +1109,9 @@ string CUIMenu::ToPortaMode(int nValue) |
|
|
|
|
{ |
|
|
|
|
switch (nValue) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
return "Fingered"; |
|
|
|
|
case 1: |
|
|
|
|
return "Full time"; |
|
|
|
|
default: |
|
|
|
|
return to_string(nValue); |
|
|
|
|
case 0: return "Fingered"; |
|
|
|
|
case 1: return "Full time"; |
|
|
|
|
default: return to_string (nValue); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -1123,12 +1119,9 @@ string CUIMenu::ToPortaGlissando(int nValue) |
|
|
|
|
{ |
|
|
|
|
switch (nValue) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
return "Off"; |
|
|
|
|
case 1: |
|
|
|
|
return "On"; |
|
|
|
|
default: |
|
|
|
|
return to_string(nValue); |
|
|
|
|
case 0: return "Off"; |
|
|
|
|
case 1: return "On"; |
|
|
|
|
default: return to_string (nValue); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -1136,12 +1129,9 @@ string CUIMenu::ToPolyMono(int nValue) |
|
|
|
|
{ |
|
|
|
|
switch (nValue) |
|
|
|
|
{ |
|
|
|
|
case 0: |
|
|
|
|
return "Poly"; |
|
|
|
|
case 1: |
|
|
|
|
return "Mono"; |
|
|
|
|
default: |
|
|
|
|
return to_string(nValue); |
|
|
|
|
case 0: return "Poly"; |
|
|
|
|
case 1: return "Mono"; |
|
|
|
|
default: return to_string (nValue); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1154,7 +1144,8 @@ void CUIMenu::TGShortcutHandler(TMenuEvent Event) |
|
|
|
|
assert (m_nMenuStackItem[1] == nTG); |
|
|
|
|
assert (m_nMenuStackParameter[1] == nTG); |
|
|
|
|
|
|
|
|
|
assert(Event == MenuEventPressAndStepDown || Event == MenuEventPressAndStepUp); |
|
|
|
|
assert ( Event == MenuEventPressAndStepDown |
|
|
|
|
|| Event == MenuEventPressAndStepUp); |
|
|
|
|
if (Event == MenuEventPressAndStepDown) |
|
|
|
|
{ |
|
|
|
|
nTG--; |
|
|
|
@ -1183,7 +1174,8 @@ void CUIMenu::OPShortcutHandler(TMenuEvent Event) |
|
|
|
|
assert (m_nMenuStackItem[m_nCurrentMenuDepth-1] == nOP); |
|
|
|
|
assert (m_nMenuStackParameter[m_nCurrentMenuDepth-1] == nOP); |
|
|
|
|
|
|
|
|
|
assert(Event == MenuEventPressAndStepDown || Event == MenuEventPressAndStepUp); |
|
|
|
|
assert ( Event == MenuEventPressAndStepDown |
|
|
|
|
|| Event == MenuEventPressAndStepUp); |
|
|
|
|
if (Event == MenuEventPressAndStepDown) |
|
|
|
|
{ |
|
|
|
|
nOP--; |
|
|
|
@ -1333,6 +1325,7 @@ void CUIMenu::PerformanceMenu(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
{ |
|
|
|
|
Value = pUIMenu->m_pMiniDexed->GetPerformanceName(nValue); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string nPSelected = ""; |
|
|
|
|
if(nValue == pUIMenu->m_pMiniDexed->GetActualPerformanceID()) |
|
|
|
|
{ |
|
|
|
@ -1401,6 +1394,7 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
unsigned nPosition = pUIMenu->m_InputTextPosition; |
|
|
|
|
unsigned nChar = pUIMenu->m_InputText[nPosition]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (Event) |
|
|
|
|
{ |
|
|
|
|
case MenuEventUpdate: |
|
|
|
@ -1428,10 +1422,10 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
case MenuEventStepDown: |
|
|
|
|
if (nChar > 32) |
|
|
|
|
{ |
|
|
|
|
do |
|
|
|
|
{ |
|
|
|
|
do { |
|
|
|
|
--nChar; |
|
|
|
|
} while (NoValidChars.find(nChar) != std::string::npos); |
|
|
|
|
} |
|
|
|
|
while (NoValidChars.find(nChar) != std::string::npos); |
|
|
|
|
} |
|
|
|
|
pUIMenu->m_InputTextChar = nChar; |
|
|
|
|
break; |
|
|
|
@ -1439,14 +1433,16 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
case MenuEventStepUp: |
|
|
|
|
if (nChar < 126) |
|
|
|
|
{ |
|
|
|
|
do |
|
|
|
|
{ |
|
|
|
|
do { |
|
|
|
|
++nChar; |
|
|
|
|
} while (NoValidChars.find(nChar) != std::string::npos); |
|
|
|
|
} |
|
|
|
|
while (NoValidChars.find(nChar) != std::string::npos);
|
|
|
|
|
} |
|
|
|
|
pUIMenu->m_InputTextChar = nChar; |
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case MenuEventSelect:
|
|
|
|
|
if(pUIMenu->m_nCurrentParameter == 1) |
|
|
|
|
{
|
|
|
|
@ -1484,6 +1480,7 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// \E[2;%dH Cursor move to row %1 and column %2 (starting at 1)
|
|
|
|
|
// \E[?25h Normal cursor visible
|
|
|
|
|
// \E[?25l Cursor invisible
|
|
|
|
@ -1492,6 +1489,7 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
escCursor += to_string(nPosition + 2); |
|
|
|
|
escCursor += "H"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string Value = pUIMenu->m_InputText; |
|
|
|
|
Value[nPosition]=nChar; |
|
|
|
|
pUIMenu->m_InputText = Value; |
|
|
|
@ -1503,6 +1501,8 @@ void CUIMenu::InputTxt(CUIMenu *pUIMenu, TMenuEvent Event) |
|
|
|
|
|
|
|
|
|
Value = Value + " " + escCursor ; |
|
|
|
|
pUIMenu->m_pUI->DisplayWrite (MenuTitleR.c_str(),MenuTitleL.c_str(), Value.c_str(), false, false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CUIMenu::EditTGParameterModulation (CUIMenu *pUIMenu, TMenuEvent Event)
|
|
|
|
|