Skip to content

Commit

Permalink
Add TGParameterEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
soyersoyer committed Jan 14, 2025
1 parent f654855 commit 98e9815
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/mididevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,9 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
bool bSystemCCChecked = false;
for (unsigned nTG = 0; nTG < m_pConfig->GetToneGenerators() && !bSystemCCHandled; nTG++)
{
if (m_pSynthesizer->GetTGParameter (CMiniDexed::TGParameterEnabled, nTG) == 0)
continue;

if (ucStatus == MIDI_SYSTEM_EXCLUSIVE_BEGIN)
{
// MIDI SYSEX per MIDI channel
Expand Down
15 changes: 15 additions & 0 deletions src/minidexed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,

m_nReverbSend[i] = 0;

m_bEnabled[i] = 1;

// Active the required number of active TGs
if (i<m_nToneGenerators)
{
Expand Down Expand Up @@ -1033,6 +1035,7 @@ void CMiniDexed::SetTGParameter (TTGParameter Parameter, int nValue, unsigned nT
case TGParameterPortamentoGlissando: setPortamentoGlissando (nValue, nTG); break;
case TGParameterPortamentoTime: setPortamentoTime (nValue, nTG); break;
case TGParameterMonoMode: setMonoMode (nValue , nTG); break;
case TGParameterEnabled: setEnabled (nValue, nTG); break;

case TGParameterMWRange: setModController(0, 0, nValue, nTG); break;
case TGParameterMWPitch: setModController(0, 1, nValue, nTG); break;
Expand Down Expand Up @@ -1090,6 +1093,7 @@ int CMiniDexed::GetTGParameter (TTGParameter Parameter, unsigned nTG)
case TGParameterPortamentoGlissando: return m_nPortamentoGlissando[nTG];
case TGParameterPortamentoTime: return m_nPortamentoTime[nTG];
case TGParameterMonoMode: return m_bMonoMode[nTG] ? 1 : 0;
case TGParameterEnabled: return m_bEnabled[nTG] ? 1 : 0;

case TGParameterMWRange: return getModController(0, 0, nTG);
case TGParameterMWPitch: return getModController(0, 1, nTG);
Expand Down Expand Up @@ -1519,6 +1523,17 @@ void CMiniDexed::setMonoMode(uint8_t mono, uint8_t nTG)
m_UI.ParameterChanged ();
}

void CMiniDexed::setEnabled (uint8_t enabled, uint8_t nTG)
{
assert (nTG < CConfig::AllToneGenerators);
if (nTG >= m_nToneGenerators) return; // Not an active TG
assert (m_pTG[nTG]);

m_bEnabled[nTG] = enabled != 0;

m_UI.ParameterChanged ();
}

void CMiniDexed::setPitchbendRange(uint8_t range, uint8_t nTG)
{
range = constrain (range, 0, 12);
Expand Down
8 changes: 6 additions & 2 deletions src/minidexed.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class CMiniDexed
void SetReverbSend (unsigned nReverbSend, unsigned nTG); // 0 .. 127

void setMonoMode(uint8_t mono, uint8_t nTG);
void setEnabled(uint8_t enabled, uint8_t nTG);
void setPitchbendRange(uint8_t range, uint8_t nTG);
void setPitchbendStep(uint8_t step, uint8_t nTG);
void setPortamentoMode(uint8_t mode, uint8_t nTG);
Expand Down Expand Up @@ -191,7 +192,9 @@ class CMiniDexed
TGParameterPortamentoGlissando,
TGParameterPortamentoTime,
TGParameterMonoMode,


TGParameterEnabled,

TGParameterMWRange,
TGParameterMWPitch,
TGParameterMWAmplitude,
Expand Down Expand Up @@ -274,7 +277,8 @@ class CMiniDexed
unsigned m_nPortamentoGlissando[CConfig::AllToneGenerators];
unsigned m_nPortamentoTime[CConfig::AllToneGenerators];
bool m_bMonoMode[CConfig::AllToneGenerators];

bool m_bEnabled[CConfig::AllToneGenerators];

unsigned m_nModulationWheelRange[CConfig::AllToneGenerators];
unsigned m_nModulationWheelTarget[CConfig::AllToneGenerators];
unsigned m_nFootControlRange[CConfig::AllToneGenerators];
Expand Down
2 changes: 2 additions & 0 deletions src/uimenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const CUIMenu::TMenuItem CUIMenu::s_TGMenu[] =
{"Pitch Bend", MenuHandler, s_EditPitchBendMenu},
{"Portamento", MenuHandler, s_EditPortamentoMenu},
{"Poly/Mono", EditTGParameter, 0, CMiniDexed::TGParameterMonoMode},
{"Enabled", EditTGParameter, 0, CMiniDexed::TGParameterEnabled},
{"Modulation", MenuHandler, s_ModulationMenu},
{"Channel", EditTGParameter, 0, CMiniDexed::TGParameterMIDIChannel},
{"Edit Voice", MenuHandler, s_EditVoiceMenu},
Expand Down Expand Up @@ -248,6 +249,7 @@ const CUIMenu::TParameter CUIMenu::s_TGParameter[CMiniDexed::TGParameterUnknown]
{0, 1, 1, ToPortaGlissando}, // TGParameterPortamentoGlissando
{0, 99, 1}, // TGParameterPortamentoTime
{0, 1, 1, ToPolyMono}, // TGParameterMonoMode
{0, 1, 1, ToOnOff}, // TGParameterEnabled
{0, 99, 1}, //MW Range
{0, 1, 1, ToOnOff}, //MW Pitch
{0, 1, 1, ToOnOff}, //MW Amp
Expand Down

0 comments on commit 98e9815

Please sign in to comment.