Support hierarchic menus (#61)
* Support hierarchic menus
This introduces a new menu engine implemented in the class CUIMenu,
which can be configured with C-tables. This should make it easier to
extend the menus, without modifying the code too much. The UI provides
a main menu, which selects the TG to be edited and a TG sub-menu, which
presents the already known TG parameters (voice bank, voice, volume,
pan, detune and channel). A sub-menu is entered with single click and
left with double click. There are arrows displayed on the LCD, which
show the direction(s), to which the knob can be moved. All TG related
parameters are maintained in the class CMiniDexed now.
* uimenu: Make the tables const
* uimenu: Add sub-menu "Edit Voice"
Menu items can be re-sorted, if necessary.
* uimenu: Add "Reverb" sub-menu
* Map reverb float parameters to range 0 .. 99
* minidexed: Add global (non-TG) parameters
* minidexed: Protect reverb module with spin lock
3 years ago
|
|
|
//
|
|
|
|
// uimenu.h
|
|
|
|
//
|
|
|
|
// MiniDexed - Dexed FM synthesizer for bare metal Raspberry Pi
|
|
|
|
// Copyright (C) 2022 The MiniDexed Team
|
|
|
|
//
|
|
|
|
// Original author of this class:
|
|
|
|
// R. Stange <rsta2@o2online.de>
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//
|
|
|
|
#ifndef _uimenu_h
|
|
|
|
#define _uimenu_h
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <circle/timer.h>
|
Support hierarchic menus (#61)
* Support hierarchic menus
This introduces a new menu engine implemented in the class CUIMenu,
which can be configured with C-tables. This should make it easier to
extend the menus, without modifying the code too much. The UI provides
a main menu, which selects the TG to be edited and a TG sub-menu, which
presents the already known TG parameters (voice bank, voice, volume,
pan, detune and channel). A sub-menu is entered with single click and
left with double click. There are arrows displayed on the LCD, which
show the direction(s), to which the knob can be moved. All TG related
parameters are maintained in the class CMiniDexed now.
* uimenu: Make the tables const
* uimenu: Add sub-menu "Edit Voice"
Menu items can be re-sorted, if necessary.
* uimenu: Add "Reverb" sub-menu
* Map reverb float parameters to range 0 .. 99
* minidexed: Add global (non-TG) parameters
* minidexed: Protect reverb module with spin lock
3 years ago
|
|
|
|
|
|
|
class CMiniDexed;
|
|
|
|
class CUserInterface;
|
|
|
|
|
|
|
|
class CUIMenu
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
static const unsigned MaxMenuDepth = 5;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum TMenuEvent
|
|
|
|
{
|
|
|
|
MenuEventUpdate,
|
|
|
|
MenuEventSelect,
|
|
|
|
MenuEventBack,
|
|
|
|
MenuEventHome,
|
|
|
|
MenuEventStepDown,
|
|
|
|
MenuEventStepUp,
|
|
|
|
MenuEventPressAndStepDown,
|
|
|
|
MenuEventPressAndStepUp,
|
Support hierarchic menus (#61)
* Support hierarchic menus
This introduces a new menu engine implemented in the class CUIMenu,
which can be configured with C-tables. This should make it easier to
extend the menus, without modifying the code too much. The UI provides
a main menu, which selects the TG to be edited and a TG sub-menu, which
presents the already known TG parameters (voice bank, voice, volume,
pan, detune and channel). A sub-menu is entered with single click and
left with double click. There are arrows displayed on the LCD, which
show the direction(s), to which the knob can be moved. All TG related
parameters are maintained in the class CMiniDexed now.
* uimenu: Make the tables const
* uimenu: Add sub-menu "Edit Voice"
Menu items can be re-sorted, if necessary.
* uimenu: Add "Reverb" sub-menu
* Map reverb float parameters to range 0 .. 99
* minidexed: Add global (non-TG) parameters
* minidexed: Protect reverb module with spin lock
3 years ago
|
|
|
MenuEventUnknown
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
CUIMenu (CUserInterface *pUI, CMiniDexed *pMiniDexed);
|
|
|
|
|
|
|
|
void EventHandler (TMenuEvent Event);
|
|
|
|
|
|
|
|
private:
|
|
|
|
typedef void TMenuHandler (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
|
|
|
|
struct TMenuItem
|
|
|
|
{
|
|
|
|
const char *Name;
|
|
|
|
TMenuHandler *Handler;
|
|
|
|
const TMenuItem *MenuItem;
|
|
|
|
unsigned Parameter;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::string TToString (int nValue);
|
|
|
|
|
|
|
|
struct TParameter
|
|
|
|
{
|
|
|
|
int Minimum;
|
|
|
|
int Maximum;
|
|
|
|
int Increment;
|
|
|
|
TToString *ToString;
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void MenuHandler (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
static void EditGlobalParameter (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
static void EditVoiceBankNumber (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
static void EditProgramNumber (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
static void EditTGParameter (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
static void EditVoiceParameter (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
static void EditOPParameter (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
static void SavePerformance (CUIMenu *pUIMenu, TMenuEvent Event);
|
|
|
|
static void EditTGParameter2 (CUIMenu *pUIMenu, TMenuEvent Event);
|
Support hierarchic menus (#61)
* Support hierarchic menus
This introduces a new menu engine implemented in the class CUIMenu,
which can be configured with C-tables. This should make it easier to
extend the menus, without modifying the code too much. The UI provides
a main menu, which selects the TG to be edited and a TG sub-menu, which
presents the already known TG parameters (voice bank, voice, volume,
pan, detune and channel). A sub-menu is entered with single click and
left with double click. There are arrows displayed on the LCD, which
show the direction(s), to which the knob can be moved. All TG related
parameters are maintained in the class CMiniDexed now.
* uimenu: Make the tables const
* uimenu: Add sub-menu "Edit Voice"
Menu items can be re-sorted, if necessary.
* uimenu: Add "Reverb" sub-menu
* Map reverb float parameters to range 0 .. 99
* minidexed: Add global (non-TG) parameters
* minidexed: Protect reverb module with spin lock
3 years ago
|
|
|
|
|
|
|
static std::string GetGlobalValueString (unsigned nParameter, int nValue);
|
|
|
|
static std::string GetTGValueString (unsigned nTGParameter, int nValue);
|
|
|
|
static std::string GetVoiceValueString (unsigned nVoiceParameter, int nValue);
|
|
|
|
static std::string GetOPValueString (unsigned nOPParameter, int nValue);
|
|
|
|
|
|
|
|
static std::string ToVolume (int nValue);
|
|
|
|
static std::string ToPan (int nValue);
|
|
|
|
static std::string ToMIDIChannel (int nValue);
|
|
|
|
|
|
|
|
static std::string ToAlgorithm (int nValue);
|
|
|
|
static std::string ToOnOff (int nValue);
|
|
|
|
static std::string ToLFOWaveform (int nValue);
|
|
|
|
static std::string ToTransposeNote (int nValue);
|
|
|
|
static std::string ToBreakpointNote (int nValue);
|
|
|
|
static std::string ToKeyboardCurve (int nValue);
|
|
|
|
static std::string ToOscillatorMode (int nValue);
|
|
|
|
static std::string ToOscillatorDetune (int nValue);
|
|
|
|
static std::string ToPortaMode (int nValue);
|
|
|
|
static std::string ToPortaGlissando (int nValue);
|
Support hierarchic menus (#61)
* Support hierarchic menus
This introduces a new menu engine implemented in the class CUIMenu,
which can be configured with C-tables. This should make it easier to
extend the menus, without modifying the code too much. The UI provides
a main menu, which selects the TG to be edited and a TG sub-menu, which
presents the already known TG parameters (voice bank, voice, volume,
pan, detune and channel). A sub-menu is entered with single click and
left with double click. There are arrows displayed on the LCD, which
show the direction(s), to which the knob can be moved. All TG related
parameters are maintained in the class CMiniDexed now.
* uimenu: Make the tables const
* uimenu: Add sub-menu "Edit Voice"
Menu items can be re-sorted, if necessary.
* uimenu: Add "Reverb" sub-menu
* Map reverb float parameters to range 0 .. 99
* minidexed: Add global (non-TG) parameters
* minidexed: Protect reverb module with spin lock
3 years ago
|
|
|
|
|
|
|
void TGShortcutHandler (TMenuEvent Event);
|
|
|
|
void OPShortcutHandler (TMenuEvent Event);
|
|
|
|
|
|
|
|
static void TimerHandler (TKernelTimerHandle hTimer, void *pParam, void *pContext);
|
|
|
|
|
Support hierarchic menus (#61)
* Support hierarchic menus
This introduces a new menu engine implemented in the class CUIMenu,
which can be configured with C-tables. This should make it easier to
extend the menus, without modifying the code too much. The UI provides
a main menu, which selects the TG to be edited and a TG sub-menu, which
presents the already known TG parameters (voice bank, voice, volume,
pan, detune and channel). A sub-menu is entered with single click and
left with double click. There are arrows displayed on the LCD, which
show the direction(s), to which the knob can be moved. All TG related
parameters are maintained in the class CMiniDexed now.
* uimenu: Make the tables const
* uimenu: Add sub-menu "Edit Voice"
Menu items can be re-sorted, if necessary.
* uimenu: Add "Reverb" sub-menu
* Map reverb float parameters to range 0 .. 99
* minidexed: Add global (non-TG) parameters
* minidexed: Protect reverb module with spin lock
3 years ago
|
|
|
private:
|
|
|
|
CUserInterface *m_pUI;
|
|
|
|
CMiniDexed *m_pMiniDexed;
|
|
|
|
|
|
|
|
const TMenuItem *m_pParentMenu;
|
|
|
|
const TMenuItem *m_pCurrentMenu;
|
|
|
|
unsigned m_nCurrentMenuItem;
|
|
|
|
unsigned m_nCurrentSelection;
|
|
|
|
unsigned m_nCurrentParameter;
|
|
|
|
|
|
|
|
const TMenuItem *m_MenuStackParent[MaxMenuDepth];
|
|
|
|
const TMenuItem *m_MenuStackMenu[MaxMenuDepth];
|
|
|
|
unsigned m_nMenuStackItem[MaxMenuDepth];
|
|
|
|
unsigned m_nMenuStackSelection[MaxMenuDepth];
|
|
|
|
unsigned m_nMenuStackParameter[MaxMenuDepth];
|
|
|
|
unsigned m_nCurrentMenuDepth;
|
|
|
|
|
|
|
|
static const TMenuItem s_MenuRoot[];
|
|
|
|
static const TMenuItem s_MainMenu[];
|
|
|
|
static const TMenuItem s_TGMenu[];
|
|
|
|
static const TMenuItem s_EffectsMenu[];
|
Support hierarchic menus (#61)
* Support hierarchic menus
This introduces a new menu engine implemented in the class CUIMenu,
which can be configured with C-tables. This should make it easier to
extend the menus, without modifying the code too much. The UI provides
a main menu, which selects the TG to be edited and a TG sub-menu, which
presents the already known TG parameters (voice bank, voice, volume,
pan, detune and channel). A sub-menu is entered with single click and
left with double click. There are arrows displayed on the LCD, which
show the direction(s), to which the knob can be moved. All TG related
parameters are maintained in the class CMiniDexed now.
* uimenu: Make the tables const
* uimenu: Add sub-menu "Edit Voice"
Menu items can be re-sorted, if necessary.
* uimenu: Add "Reverb" sub-menu
* Map reverb float parameters to range 0 .. 99
* minidexed: Add global (non-TG) parameters
* minidexed: Protect reverb module with spin lock
3 years ago
|
|
|
static const TMenuItem s_ReverbMenu[];
|
|
|
|
static const TMenuItem s_EditVoiceMenu[];
|
|
|
|
static const TMenuItem s_OperatorMenu[];
|
|
|
|
static const TMenuItem s_SaveMenu[];
|
|
|
|
static const TMenuItem s_EditPitchBenderMenu[];
|
|
|
|
static const TMenuItem s_EditPortamentoMenu[];
|
|
|
|
|
Support hierarchic menus (#61)
* Support hierarchic menus
This introduces a new menu engine implemented in the class CUIMenu,
which can be configured with C-tables. This should make it easier to
extend the menus, without modifying the code too much. The UI provides
a main menu, which selects the TG to be edited and a TG sub-menu, which
presents the already known TG parameters (voice bank, voice, volume,
pan, detune and channel). A sub-menu is entered with single click and
left with double click. There are arrows displayed on the LCD, which
show the direction(s), to which the knob can be moved. All TG related
parameters are maintained in the class CMiniDexed now.
* uimenu: Make the tables const
* uimenu: Add sub-menu "Edit Voice"
Menu items can be re-sorted, if necessary.
* uimenu: Add "Reverb" sub-menu
* Map reverb float parameters to range 0 .. 99
* minidexed: Add global (non-TG) parameters
* minidexed: Protect reverb module with spin lock
3 years ago
|
|
|
static const TParameter s_GlobalParameter[];
|
|
|
|
static const TParameter s_TGParameter[];
|
|
|
|
static const TParameter s_VoiceParameter[];
|
|
|
|
static const TParameter s_OPParameter[];
|
|
|
|
|
|
|
|
static const char s_NoteName[100][4];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|