diff --git a/src/effect_base.h b/src/effect_base.h index eb234b7..69a885b 100644 --- a/src/effect_base.h +++ b/src/effect_base.h @@ -27,6 +27,13 @@ public: virtual unsigned getId(); + /** + * Set default parameters for the FX when is used as Send FX. + */ + virtual void initializeSendFX() + { + } + virtual void setParameter(unsigned param, unsigned value) { } diff --git a/src/effect_delay.cpp b/src/effect_delay.cpp index 90db731..9d51eec 100644 --- a/src/effect_delay.cpp +++ b/src/effect_delay.cpp @@ -40,6 +40,11 @@ unsigned AudioEffectDelay::getId() return EFFECT_DELAY; } +void AudioEffectDelay::initializeSendFX() +{ + this->setParameter(AudioEffectDelay::Param::MIX, 100); +} + void AudioEffectDelay::setParameter(unsigned param, unsigned value) { switch (param) diff --git a/src/effect_delay.h b/src/effect_delay.h index 1d2d514..63d3e5c 100644 --- a/src/effect_delay.h +++ b/src/effect_delay.h @@ -32,6 +32,8 @@ public: virtual ~AudioEffectDelay(); virtual unsigned getId(); + + virtual void initializeSendFX(); virtual void setParameter(unsigned param, unsigned value); virtual unsigned getParameter(unsigned param); protected: diff --git a/src/effect_talreverb3.cpp b/src/effect_talreverb3.cpp index 49c25ac..aa16922 100644 --- a/src/effect_talreverb3.cpp +++ b/src/effect_talreverb3.cpp @@ -30,6 +30,12 @@ AudioEffectTalReverb3::~AudioEffectTalReverb3() delete this->engine; } +void AudioEffectTalReverb3::initializeSendFX() +{ + this->setParameter(AudioEffectTalReverb3::Param::DRY, 0); + this->setParameter(AudioEffectTalReverb3::Param::WET, 50); +} + void AudioEffectTalReverb3::setParameter(unsigned param, unsigned value) { diff --git a/src/effect_talreverb3.h b/src/effect_talreverb3.h index 63f7799..1c81f2b 100644 --- a/src/effect_talreverb3.h +++ b/src/effect_talreverb3.h @@ -38,6 +38,7 @@ public: return EFFECT_TALREVERB3; } + virtual void initializeSendFX(); virtual void setParameter(unsigned param, unsigned value); virtual unsigned getParameter(unsigned param); protected: diff --git a/src/minidexed.cpp b/src/minidexed.cpp index fc4db58..db2d024 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -172,6 +172,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, // END setup tgmixer // BEGIN setup reverb + m_SendFX = new AudioEffectNone(pConfig->GetSampleRate()); reverb_send_mixer = new AudioStereoMixer(pConfig->GetChunkSize()/2); reverb = new AudioEffectPlateReverb(pConfig->GetSampleRate()); SetParameter (ParameterReverbEnable, 1); @@ -181,6 +182,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, SetParameter (ParameterReverbLowPass, 30); SetParameter (ParameterReverbDiffusion, 65); SetParameter (ParameterReverbLevel, 99); + SetParameter (ParameterSendFXType, 0); // END setup reverb SetParameter (ParameterCompressorEnable, 1); @@ -609,6 +611,17 @@ void CMiniDexed::setInsertFXType (unsigned nType, unsigned nTG) m_UI.ParameterChanged (); } +void CMiniDexed::setSendFXType (unsigned nType) +{ + m_SendFXSpinLock.Acquire(); + delete m_SendFX; + m_SendFX = newAudioEffect(nType, m_pConfig->GetSampleRate()); + m_SendFX->initializeSendFX(); + m_SendFXSpinLock.Release(); + + m_UI.ParameterChanged (); +} + void CMiniDexed::SetReverbSend (unsigned nReverbSend, unsigned nTG) { nReverbSend=constrain((int)nReverbSend,0,99); @@ -830,6 +843,10 @@ void CMiniDexed::SetParameter (TParameter Parameter, int nValue) } break; + case ParameterSendFXType: + setSendFXType(nValue); + break; + case ParameterReverbEnable: nValue=constrain((int)nValue,0,1); m_ReverbSpinLock.Acquire (); @@ -1015,11 +1032,23 @@ void CMiniDexed::SetTGFXParameter (unsigned Parameter, int nValue, unsigned nTG, int CMiniDexed::GetTGFXParameter (unsigned Parameter, unsigned nTG, unsigned nFXType) { assert (nTG < CConfig::ToneGenerators); - assert (m_InsertFX[nTG]->getId() == nFXType); + assert (m_InsertFX[nTG]->getId() == nFXType); return m_InsertFX[nTG]->getParameter(Parameter); } +void CMiniDexed::SetSendFXParameter (unsigned Parameter, int nValue, unsigned nFXType) { + assert (m_SendFX->getId() == nFXType); + + m_SendFX->setParameter(Parameter, nValue); +} + +int CMiniDexed::GetSendFXParameter (unsigned Parameter, unsigned nFXType) { + assert (m_SendFX->getId() == nFXType); + + return m_SendFX->getParameter(Parameter); +} + void CMiniDexed::SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigned nOP, unsigned nTG) { assert (nTG < CConfig::ToneGenerators); @@ -1207,10 +1236,12 @@ void CMiniDexed::ProcessSound (void) arm_fill_f32(0.0f, ReverbSendBuffer[indexR], nFrames); arm_fill_f32(0.0f, ReverbSendBuffer[indexL], nFrames); + m_SendFXSpinLock.Acquire (); m_ReverbSpinLock.Acquire (); reverb_send_mixer->getMix(ReverbSendBuffer[indexL], ReverbSendBuffer[indexR]); - reverb->doReverb(ReverbSendBuffer[indexL],ReverbSendBuffer[indexR],ReverbBuffer[indexL], ReverbBuffer[indexR],nFrames); + //reverb->doReverb(ReverbSendBuffer[indexL],ReverbSendBuffer[indexR],ReverbBuffer[indexL], ReverbBuffer[indexR],nFrames); + m_SendFX->process(ReverbSendBuffer[indexL], ReverbSendBuffer[indexR], ReverbBuffer[indexL], ReverbBuffer[indexR], nFrames); // scale down and add left reverb buffer by reverb level arm_scale_f32(ReverbBuffer[indexL], reverb->get_level(), ReverbBuffer[indexL], nFrames); @@ -1220,6 +1251,7 @@ void CMiniDexed::ProcessSound (void) arm_add_f32(SampleBuffer[indexR], ReverbBuffer[indexR], SampleBuffer[indexR], nFrames); m_ReverbSpinLock.Release (); + m_SendFXSpinLock.Release (); } // END adding reverb diff --git a/src/minidexed.h b/src/minidexed.h index b11f094..5254c48 100644 --- a/src/minidexed.h +++ b/src/minidexed.h @@ -96,6 +96,7 @@ public: void setAftertouch (uint8_t value, unsigned nTG); void setInsertFXType (unsigned nType, unsigned nTG); + void setSendFXType (unsigned nType); void SetReverbSend (unsigned nReverbSend, unsigned nTG); // 0 .. 127 @@ -151,6 +152,7 @@ public: enum TParameter { ParameterCompressorEnable, + ParameterSendFXType, ParameterReverbEnable, ParameterReverbSize, ParameterReverbHighDamp, @@ -223,6 +225,9 @@ public: void SetTGFXParameter (unsigned Parameter, int nValue, unsigned nTG, unsigned nFXType); int GetTGFXParameter (unsigned Parameter, unsigned nTG, unsigned nFXType); + void SetSendFXParameter (unsigned Parameter, int nValue, unsigned nFXType); + int GetSendFXParameter (unsigned Parameter, unsigned nFXType); + // access (global or OP-related) parameter of the active voice of a TG static const unsigned NoOP = 6; // for global parameters void SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigned nOP, unsigned nTG); @@ -333,8 +338,10 @@ private: AudioEffectPlateReverb* reverb; AudioStereoMixer* tg_mixer; AudioStereoMixer* reverb_send_mixer; - + AudioEffect* m_SendFX; + CSpinLock* m_InsertFXSpinLock[CConfig::ToneGenerators]; + CSpinLock m_SendFXSpinLock; CSpinLock m_ReverbSpinLock; bool m_bSavePerformance; diff --git a/src/uimenu.cpp b/src/uimenu.cpp index 8e11d78..c34a94a 100644 --- a/src/uimenu.cpp +++ b/src/uimenu.cpp @@ -82,6 +82,7 @@ const CUIMenu::TMenuItem CUIMenu::s_TGMenu[] = const CUIMenu::TMenuItem CUIMenu::s_EffectsMenu[] = { {"Compress", EditGlobalParameter, 0, CMiniDexed::ParameterCompressorEnable}, + {"Send FX", MenuHandlerSendFX}, #ifdef ARM_ALLOW_MULTI_CORE {"Reverb", MenuHandler, s_ReverbMenu}, #endif @@ -121,6 +122,13 @@ const CUIMenu::TMenuItem CUIMenu::s_ModulationMenuParameters[] = {0} }; +const CUIMenu::TMenuItem CUIMenu::s_SendFXMenu[] = +{ + {"Type:", EditGlobalParameter, 0, CMiniDexed::ParameterSendFXType}, + {"Edit:", EditSendFX}, + {0} +}; + #ifdef ARM_ALLOW_MULTI_CORE const CUIMenu::TMenuItem CUIMenu::s_ReverbMenu[] = @@ -144,13 +152,13 @@ const CUIMenu::TMenuItem CUIMenu::s_InsertFX[] = {0} }; -const CUIMenu::TMenuItem CUIMenu::s_FXNone[] = +CUIMenu::TMenuItem CUIMenu::s_FXNone[] = { {"None"}, {0} }; -const CUIMenu::TMenuItem CUIMenu::s_FXChorus[] = +CUIMenu::TMenuItem CUIMenu::s_FXChorus[] = { {"Bypass", EditTGFXParameter, 0, AudioEffectChorus::Param::BYPASS}, {"Chorus I", EditTGFXParameter, 0, AudioEffectChorus::Param::CHORUS_I_ENABLE}, @@ -160,7 +168,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXChorus[] = {0} }; -const CUIMenu::TMenuItem CUIMenu::s_FXDelay[] = +CUIMenu::TMenuItem CUIMenu::s_FXDelay[] = { {"Bypass", EditTGFXParameter, 0, AudioEffectDelay::Param::BYPASS}, {"Time L", EditTGFXParameter, 0, AudioEffectDelay::Param::TIME_L}, @@ -172,7 +180,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXDelay[] = {0} }; -const CUIMenu::TMenuItem CUIMenu::s_FXLPFilter[] = +CUIMenu::TMenuItem CUIMenu::s_FXLPFilter[] = { {"Bypass", EditTGFXParameter, 0, AudioEffectLPF::Param::BYPASS}, {"Cutoff", EditTGFXParameter, 0, AudioEffectLPF::Param::CUTOFF}, @@ -180,7 +188,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXLPFilter[] = {0} }; -const CUIMenu::TMenuItem CUIMenu::s_FXDS1[] = +CUIMenu::TMenuItem CUIMenu::s_FXDS1[] = { {"Bypass", EditTGFXParameter, 0, AudioEffectDS1::Param::BYPASS}, {"Dist", EditTGFXParameter, 0, AudioEffectDS1::Param::DIST}, @@ -189,7 +197,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXDS1[] = {0} }; -const CUIMenu::TMenuItem CUIMenu::s_FXBigMuff[] = +CUIMenu::TMenuItem CUIMenu::s_FXBigMuff[] = { {"Bypass", EditTGFXParameter, 0, AudioEffectBigMuff::Param::BYPASS}, {"Sustain", EditTGFXParameter, 0, AudioEffectBigMuff::Param::SUSTAIN}, @@ -198,7 +206,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXBigMuff[] = {0} }; -const CUIMenu::TMenuItem CUIMenu::s_FXTalReverb3[] = +CUIMenu::TMenuItem CUIMenu::s_FXTalReverb3[] = { {"Bypass", EditTGFXParameter, 0, AudioEffectTalReverb3::Param::BYPASS}, {"Dry", EditTGFXParameter, 0, AudioEffectTalReverb3::Param::DRY}, @@ -284,6 +292,7 @@ const CUIMenu::TMenuItem CUIMenu::s_SaveMenu[] = const CUIMenu::TParameter CUIMenu::s_GlobalParameter[CMiniDexed::ParameterUnknown] = { {0, 1, 1, ToOnOff}, // ParameterCompessorEnable + {0, 6, 1, ToFXType}, // ParameterSendFXType {0, 1, 1, ToOnOff}, // ParameterReverbEnable {0, 99, 1}, // ParameterReverbSize {0, 99, 1}, // ParameterReverbHighDamp @@ -714,6 +723,87 @@ void CUIMenu::MenuHandlerInsertFX (CUIMenu *pUIMenu, TMenuEvent Event) } } +void CUIMenu::MenuHandlerSendFX (CUIMenu *pUIMenu, TMenuEvent Event) +{ + // Setup menu when it's open + if (!pUIMenu->m_pCurrentMenu) + { + pUIMenu->m_pCurrentMenu = s_SendFXMenu; + } + + switch (Event) + { + case MenuEventUpdate: + break; + + case MenuEventSelect: // push menu + 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_nCurrentMenuDepth++; + + pUIMenu->m_pParentMenu = pUIMenu->m_pCurrentMenu; + pUIMenu->m_nCurrentParameter = + pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Parameter; + pUIMenu->m_pCurrentMenu = + pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].MenuItem; + pUIMenu->m_nCurrentMenuItem = pUIMenu->m_nCurrentSelection; + pUIMenu->m_nCurrentSelection = 0; + break; + + case MenuEventStepDown: + if (pUIMenu->m_nCurrentSelection > 0) + { + pUIMenu->m_nCurrentSelection--; + } + break; + + case MenuEventStepUp: + ++pUIMenu->m_nCurrentSelection; + if (!pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Name) // more entries? + { + pUIMenu->m_nCurrentSelection--; + } + break; + + case MenuEventPressAndStepDown: + case MenuEventPressAndStepUp: + pUIMenu->TGShortcutHandler (Event); + return; + + default: + return; + } + + if (pUIMenu->m_pCurrentMenu) // if this is another menu? + { + // Get current FX type + int fxType = pUIMenu->m_pMiniDexed->GetParameter(CMiniDexed::ParameterSendFXType); + + // Create Paramter with type label + std::string value; + value.append(pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Name); + value.append(getFXTypeName(fxType)); + + pUIMenu->m_pUI->DisplayWrite ( + pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name, + "", + value.c_str(), + pUIMenu->m_nCurrentSelection > 0, + !!pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection+1].Name); + } + else + { + pUIMenu->EventHandler (MenuEventUpdate); // no, update parameter display + } +} + void CUIMenu::EditGlobalParameter (CUIMenu *pUIMenu, TMenuEvent Event) { CMiniDexed::TParameter Param = (CMiniDexed::TParameter) pUIMenu->m_nCurrentParameter; @@ -985,30 +1075,7 @@ void CUIMenu::EditInsertFX (CUIMenu *pUIMenu, TMenuEvent Event) unsigned nTG = pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth-2]; int fxType = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TGParameterInsertFXType, nTG); - switch (fxType) - { - case EFFECT_CHORUS: - pUIMenu->m_pCurrentMenu = s_FXChorus; - break; - case EFFECT_DELAY: - pUIMenu->m_pCurrentMenu = s_FXDelay; - break; - case EFFECT_LPF: - pUIMenu->m_pCurrentMenu = s_FXLPFilter; - break; - case EFFECT_DS1: - pUIMenu->m_pCurrentMenu = s_FXDS1; - break; - case EFFECT_BIGMUFF: - pUIMenu->m_pCurrentMenu = s_FXBigMuff; - break; - case EFFECT_TALREVERB3: - pUIMenu->m_pCurrentMenu = s_FXTalReverb3; - break; - default: - pUIMenu->m_pCurrentMenu = s_FXNone; - break; - } + pUIMenu->m_pCurrentMenu = getInsertFXMenuItem(fxType); switch (Event) { @@ -1060,9 +1127,6 @@ void CUIMenu::EditInsertFX (CUIMenu *pUIMenu, TMenuEvent Event) string TG ("TG"); TG += to_string (nTG+1); - // Get current FX type - int fxType = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TGParameterInsertFXType, nTG); - pUIMenu->m_pUI->DisplayWrite ( TG.c_str (), getFXTypeName(fxType).c_str(), @@ -1086,30 +1150,7 @@ void CUIMenu::EditTGFXParameter (CUIMenu *pUIMenu, TMenuEvent Event) // Get Param unsigned nParam = pUIMenu->m_nCurrentParameter; - TParameter pParam; - switch (nFXType) - { - case EFFECT_CHORUS: - pParam = s_TGFXChorusParam[nParam]; - break; - case EFFECT_DELAY: - pParam = s_TGFXDelayParam[nParam]; - break; - case EFFECT_LPF: - pParam = s_TGFXLPFParam[nParam]; - break; - case EFFECT_DS1: - pParam = s_TGFXDS1Param[nParam]; - break; - case EFFECT_BIGMUFF: - pParam = s_TGFXBigMuffParam[nParam]; - break; - case EFFECT_TALREVERB3: - pParam = s_TGFXTalReverb3Param[nParam]; - break; - default: - return; - } + TParameter pParam = getFXParameter(nFXType, nParam); const TParameter &rParam = pParam; int nValue = pUIMenu->m_pMiniDexed->GetTGFXParameter (nParam, nTG, nFXType); @@ -1168,6 +1209,130 @@ void CUIMenu::EditTGFXParameter (CUIMenu *pUIMenu, TMenuEvent Event) nValue > rParam.Minimum, nValue < rParam.Maximum); } +void CUIMenu::EditSendFX (CUIMenu *pUIMenu, TMenuEvent Event) +{ + int nFXType = pUIMenu->m_pMiniDexed->GetParameter(CMiniDexed::ParameterSendFXType); + pUIMenu->m_pCurrentMenu = getSendFXMenuItem(nFXType); + + switch (Event) + { + case MenuEventUpdate: + break; + + case MenuEventSelect: // push menu + 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_nCurrentMenuDepth++; + + pUIMenu->m_pParentMenu = pUIMenu->m_pCurrentMenu; + pUIMenu->m_nCurrentParameter = + pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Parameter; + pUIMenu->m_pCurrentMenu = + pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].MenuItem; + pUIMenu->m_nCurrentMenuItem = pUIMenu->m_nCurrentSelection; + pUIMenu->m_nCurrentSelection = 0; + break; + + case MenuEventStepDown: + if (pUIMenu->m_nCurrentSelection > 0) + { + pUIMenu->m_nCurrentSelection--; + } + break; + + case MenuEventStepUp: + ++pUIMenu->m_nCurrentSelection; + if (!pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Name) // more entries? + { + pUIMenu->m_nCurrentSelection--; + } + break; + + default: + return; + } + + if (pUIMenu->m_pCurrentMenu) // if this is another menu? + { + pUIMenu->m_pUI->DisplayWrite ( + getFXTypeName(nFXType).c_str(), + "", + pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Name, + pUIMenu->m_nCurrentSelection > 0, + !!pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection+1].Name); + } + else + { + pUIMenu->EventHandler (MenuEventUpdate); // no, update parameter display + } +} + +void CUIMenu::EditSendFXParameter (CUIMenu *pUIMenu, TMenuEvent Event) +{ + // Get FX type + int nFXType = pUIMenu->m_pMiniDexed->GetParameter(CMiniDexed::ParameterSendFXType); + + // Get Param + unsigned nParam = pUIMenu->m_nCurrentParameter; + TParameter pParam = getFXParameter(nFXType, nParam); + const TParameter &rParam = pParam; + + int nValue = pUIMenu->m_pMiniDexed->GetSendFXParameter (nParam, nFXType); + + switch (Event) + { + case MenuEventUpdate: + break; + + case MenuEventStepDown: + nValue -= rParam.Increment; + if (nValue < rParam.Minimum) + { + nValue = rParam.Minimum; + } + pUIMenu->m_pMiniDexed->SetSendFXParameter (nParam, nValue, nFXType); + break; + + case MenuEventStepUp: + nValue += rParam.Increment; + if (nValue > rParam.Maximum) + { + nValue = rParam.Maximum; + } + pUIMenu->m_pMiniDexed->SetSendFXParameter (nParam, nValue, nFXType); + break; + + default: + return; + } + + // Get value again after change + nValue = pUIMenu->m_pMiniDexed->GetSendFXParameter (nParam, nFXType); + CUIMenu::TToString *pToString = rParam.ToString; + string Value; + if (pToString) + { + Value = (*pToString) (nValue); + } + else + { + Value = to_string (nValue); + } + + pUIMenu->m_pUI->DisplayWrite ( + 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]; @@ -2267,4 +2432,86 @@ void CUIMenu::EditTGParameterModulation (CUIMenu *pUIMenu, TMenuEvent Event) } +CUIMenu::TMenuItem* CUIMenu::getFXMenuItem(unsigned type) +{ + CUIMenu::TMenuItem* menu; + switch (type) + { + case EFFECT_CHORUS: + menu = s_FXChorus; + break; + case EFFECT_DELAY: + menu = s_FXDelay; + break; + case EFFECT_LPF: + menu = s_FXLPFilter; + break; + case EFFECT_DS1: + menu = s_FXDS1; + break; + case EFFECT_BIGMUFF: + menu = s_FXBigMuff; + break; + case EFFECT_TALREVERB3: + menu = s_FXTalReverb3; + break; + case EFFECT_NONE: + default: + menu = s_FXNone; + break; + } + return menu; +} +CUIMenu::TMenuItem* CUIMenu::getInsertFXMenuItem(unsigned type) +{ + CUIMenu::TMenuItem* menu = getFXMenuItem(type); + + for (size_t i = 0; i < sizeof(menu); i++) + { + menu[i].Handler = EditTGFXParameter; + } + + return menu; +} + +CUIMenu::TMenuItem* CUIMenu::getSendFXMenuItem(unsigned type) +{ + CUIMenu::TMenuItem* menu = getFXMenuItem(type); + + for (size_t i = 0; i < sizeof(menu); i++) + { + menu[i].Handler = EditSendFXParameter; + } + + return menu; +} + +CUIMenu::TParameter CUIMenu::getFXParameter(unsigned type, unsigned nParam) +{ + TParameter pParam; + switch (type) + { + case EFFECT_CHORUS: + pParam = s_TGFXChorusParam[nParam]; + break; + case EFFECT_DELAY: + pParam = s_TGFXDelayParam[nParam]; + break; + case EFFECT_LPF: + pParam = s_TGFXLPFParam[nParam]; + break; + case EFFECT_DS1: + pParam = s_TGFXDS1Param[nParam]; + break; + case EFFECT_BIGMUFF: + pParam = s_TGFXBigMuffParam[nParam]; + break; + case EFFECT_TALREVERB3: + pParam = s_TGFXTalReverb3Param[nParam]; + break; + default: + break; + } + return pParam; +} diff --git a/src/uimenu.h b/src/uimenu.h index 7fcc647..530b332 100644 --- a/src/uimenu.h +++ b/src/uimenu.h @@ -93,10 +93,19 @@ private: static void SavePerformanceNewFile (CUIMenu *pUIMenu, TMenuEvent Event); static void EditPerformanceBankNumber (CUIMenu *pUIMenu, TMenuEvent Event); + static CUIMenu::TMenuItem* getFXMenuItem(unsigned type); + static CUIMenu::TParameter getFXParameter(unsigned type, unsigned param); + static void MenuHandlerInsertFX (CUIMenu *pUIMenu, TMenuEvent Event); static void EditInsertFX (CUIMenu *pUIMenu, TMenuEvent Event); static void EditTGFXParameter (CUIMenu *pUIMenu, TMenuEvent Event); - + static CUIMenu::TMenuItem* getInsertFXMenuItem(unsigned type); + + static void MenuHandlerSendFX (CUIMenu *pUIMenu, TMenuEvent Event); + static void EditSendFX (CUIMenu *pUIMenu, TMenuEvent Event); + static void EditSendFXParameter (CUIMenu *pUIMenu, TMenuEvent Event); + static CUIMenu::TMenuItem* getSendFXMenuItem(unsigned type); + static std::string GetGlobalValueString (unsigned nParameter, int nValue); static std::string GetTGValueString (unsigned nTGParameter, int nValue); static std::string GetVoiceValueString (unsigned nVoiceParameter, int nValue); @@ -151,15 +160,18 @@ private: static const TMenuItem s_MainMenu[]; static const TMenuItem s_TGMenu[]; static const TMenuItem s_EffectsMenu[]; + static const TMenuItem s_SendFXMenu[]; static const TMenuItem s_ReverbMenu[]; static const TMenuItem s_InsertFX[]; - static const TMenuItem s_FXNone[]; - static const TMenuItem s_FXChorus[]; - static const TMenuItem s_FXDelay[]; - static const TMenuItem s_FXLPFilter[]; - static const TMenuItem s_FXDS1[]; - static const TMenuItem s_FXBigMuff[]; - static const TMenuItem s_FXTalReverb3[]; + + static TMenuItem s_FXNone[]; + static TMenuItem s_FXChorus[]; + static TMenuItem s_FXDelay[]; + static TMenuItem s_FXLPFilter[]; + static TMenuItem s_FXDS1[]; + static TMenuItem s_FXBigMuff[]; + static TMenuItem s_FXTalReverb3[]; + static const TMenuItem s_EditVoiceMenu[]; static const TMenuItem s_OperatorMenu[]; static const TMenuItem s_SaveMenu[];