diff --git a/src/dexedadapter.h b/src/dexedadapter.h index be04f42..573e80e 100644 --- a/src/dexedadapter.h +++ b/src/dexedadapter.h @@ -25,6 +25,8 @@ #include #include +#define DEXED_OP_ENABLE (DEXED_OP_OSC_DETUNE + 1) + // Some Dexed methods require to be guarded from being interrupted // by other Dexed calls. This is done herein. diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 0858c54..1361aa3 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -68,6 +68,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, m_nNoteShift[i] = 0; m_nReverbSend[i] = 0; + m_uchOPMask[i] = 0b111111; // All operators on m_pTG[i] = new CDexedAdapter (CConfig::MaxNotes, pConfig->GetSampleRate ()); assert (m_pTG[i]); @@ -676,6 +677,22 @@ void CMiniDexed::SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigne if (nOP < 6) { + if (uchOffset == DEXED_OP_ENABLE) + { + if (uchValue) + { + m_uchOPMask[nTG] |= 1 << nOP; + } + else + { + m_uchOPMask[nTG] &= ~(1 << nOP); + } + + m_pTG[nTG]->setOPAll (m_uchOPMask[nTG]); + + return; + } + nOP = 5 - nOP; // OPs are in reverse order } @@ -693,6 +710,11 @@ uint8_t CMiniDexed::GetVoiceParameter (uint8_t uchOffset, unsigned nOP, unsigned if (nOP < 6) { + if (uchOffset == DEXED_OP_ENABLE) + { + return !!(m_uchOPMask[nTG] & (1 << nOP)); + } + nOP = 5 - nOP; // OPs are in reverse order } diff --git a/src/minidexed.h b/src/minidexed.h index ade7ddb..9e54cf8 100644 --- a/src/minidexed.h +++ b/src/minidexed.h @@ -126,7 +126,8 @@ public: private: int16_t ApplyNoteLimits (int16_t pitch, unsigned nTG); // returns < 0 to ignore note - + uint8_t m_uchOPMask[CConfig::ToneGenerators]; + void ProcessSound (void); #ifdef ARM_ALLOW_MULTI_CORE diff --git a/src/uimenu.cpp b/src/uimenu.cpp index 3c0d219..51344d9 100644 --- a/src/uimenu.cpp +++ b/src/uimenu.cpp @@ -152,6 +152,7 @@ const CUIMenu::TMenuItem CUIMenu::s_OperatorMenu[] = {"Rate Scaling",EditOPParameter, 0, DEXED_OP_OSC_RATE_SCALE}, {"A Mod Sens.", EditOPParameter, 0, DEXED_OP_AMP_MOD_SENS}, {"K Vel. Sens.",EditOPParameter, 0, DEXED_OP_KEY_VEL_SENS}, + {"Enable", EditOPParameter, 0, DEXED_OP_ENABLE}, {0} }; @@ -235,7 +236,8 @@ const CUIMenu::TParameter CUIMenu::s_OPParameter[] = {0, 1, 1, ToOscillatorMode}, // DEXED_OP_OSC_MODE {0, 31, 1}, // DEXED_OP_FREQ_COARSE {0, 99, 1}, // DEXED_OP_FREQ_FINE - {0, 14, 1, ToOscillatorDetune} // DEXED_OP_OSC_DETUNE + {0, 14, 1, ToOscillatorDetune}, // DEXED_OP_OSC_DETUNE + {0, 1, 1, ToOnOff} // DEXED_OP_ENABLE }; const char CUIMenu::s_NoteName[100][4] =