WIP: Added Send FX

pull/764/head
jnonis 7 months ago
parent 17105a9c42
commit 7c2638cd7f
  1. 7
      src/effect_base.h
  2. 5
      src/effect_delay.cpp
  3. 2
      src/effect_delay.h
  4. 6
      src/effect_talreverb3.cpp
  5. 1
      src/effect_talreverb3.h
  6. 36
      src/minidexed.cpp
  7. 9
      src/minidexed.h
  8. 363
      src/uimenu.cpp
  9. 28
      src/uimenu.h

@ -27,6 +27,13 @@ public:
virtual unsigned getId(); 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) virtual void setParameter(unsigned param, unsigned value)
{ {
} }

@ -40,6 +40,11 @@ unsigned AudioEffectDelay::getId()
return EFFECT_DELAY; return EFFECT_DELAY;
} }
void AudioEffectDelay::initializeSendFX()
{
this->setParameter(AudioEffectDelay::Param::MIX, 100);
}
void AudioEffectDelay::setParameter(unsigned param, unsigned value) void AudioEffectDelay::setParameter(unsigned param, unsigned value)
{ {
switch (param) switch (param)

@ -32,6 +32,8 @@ public:
virtual ~AudioEffectDelay(); virtual ~AudioEffectDelay();
virtual unsigned getId(); virtual unsigned getId();
virtual void initializeSendFX();
virtual void setParameter(unsigned param, unsigned value); virtual void setParameter(unsigned param, unsigned value);
virtual unsigned getParameter(unsigned param); virtual unsigned getParameter(unsigned param);
protected: protected:

@ -30,6 +30,12 @@ AudioEffectTalReverb3::~AudioEffectTalReverb3()
delete this->engine; 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) void AudioEffectTalReverb3::setParameter(unsigned param, unsigned value)
{ {

@ -38,6 +38,7 @@ public:
return EFFECT_TALREVERB3; return EFFECT_TALREVERB3;
} }
virtual void initializeSendFX();
virtual void setParameter(unsigned param, unsigned value); virtual void setParameter(unsigned param, unsigned value);
virtual unsigned getParameter(unsigned param); virtual unsigned getParameter(unsigned param);
protected: protected:

@ -172,6 +172,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
// END setup tgmixer // END setup tgmixer
// BEGIN setup reverb // BEGIN setup reverb
m_SendFX = new AudioEffectNone(pConfig->GetSampleRate());
reverb_send_mixer = new AudioStereoMixer<CConfig::ToneGenerators>(pConfig->GetChunkSize()/2); reverb_send_mixer = new AudioStereoMixer<CConfig::ToneGenerators>(pConfig->GetChunkSize()/2);
reverb = new AudioEffectPlateReverb(pConfig->GetSampleRate()); reverb = new AudioEffectPlateReverb(pConfig->GetSampleRate());
SetParameter (ParameterReverbEnable, 1); SetParameter (ParameterReverbEnable, 1);
@ -181,6 +182,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
SetParameter (ParameterReverbLowPass, 30); SetParameter (ParameterReverbLowPass, 30);
SetParameter (ParameterReverbDiffusion, 65); SetParameter (ParameterReverbDiffusion, 65);
SetParameter (ParameterReverbLevel, 99); SetParameter (ParameterReverbLevel, 99);
SetParameter (ParameterSendFXType, 0);
// END setup reverb // END setup reverb
SetParameter (ParameterCompressorEnable, 1); SetParameter (ParameterCompressorEnable, 1);
@ -609,6 +611,17 @@ void CMiniDexed::setInsertFXType (unsigned nType, unsigned nTG)
m_UI.ParameterChanged (); 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) void CMiniDexed::SetReverbSend (unsigned nReverbSend, unsigned nTG)
{ {
nReverbSend=constrain((int)nReverbSend,0,99); nReverbSend=constrain((int)nReverbSend,0,99);
@ -830,6 +843,10 @@ void CMiniDexed::SetParameter (TParameter Parameter, int nValue)
} }
break; break;
case ParameterSendFXType:
setSendFXType(nValue);
break;
case ParameterReverbEnable: case ParameterReverbEnable:
nValue=constrain((int)nValue,0,1); nValue=constrain((int)nValue,0,1);
m_ReverbSpinLock.Acquire (); 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) { int CMiniDexed::GetTGFXParameter (unsigned Parameter, unsigned nTG, unsigned nFXType) {
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);
assert (m_InsertFX[nTG]->getId() == nFXType); assert (m_InsertFX[nTG]->getId() == nFXType);
return m_InsertFX[nTG]->getParameter(Parameter); 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) void CMiniDexed::SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigned nOP, unsigned nTG)
{ {
assert (nTG < CConfig::ToneGenerators); 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[indexR], nFrames);
arm_fill_f32(0.0f, ReverbSendBuffer[indexL], nFrames); arm_fill_f32(0.0f, ReverbSendBuffer[indexL], nFrames);
m_SendFXSpinLock.Acquire ();
m_ReverbSpinLock.Acquire (); m_ReverbSpinLock.Acquire ();
reverb_send_mixer->getMix(ReverbSendBuffer[indexL], ReverbSendBuffer[indexR]); 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 // scale down and add left reverb buffer by reverb level
arm_scale_f32(ReverbBuffer[indexL], reverb->get_level(), ReverbBuffer[indexL], nFrames); 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); arm_add_f32(SampleBuffer[indexR], ReverbBuffer[indexR], SampleBuffer[indexR], nFrames);
m_ReverbSpinLock.Release (); m_ReverbSpinLock.Release ();
m_SendFXSpinLock.Release ();
} }
// END adding reverb // END adding reverb

@ -96,6 +96,7 @@ public:
void setAftertouch (uint8_t value, unsigned nTG); void setAftertouch (uint8_t value, unsigned nTG);
void setInsertFXType (unsigned nType, unsigned nTG); void setInsertFXType (unsigned nType, unsigned nTG);
void setSendFXType (unsigned nType);
void SetReverbSend (unsigned nReverbSend, unsigned nTG); // 0 .. 127 void SetReverbSend (unsigned nReverbSend, unsigned nTG); // 0 .. 127
@ -151,6 +152,7 @@ public:
enum TParameter enum TParameter
{ {
ParameterCompressorEnable, ParameterCompressorEnable,
ParameterSendFXType,
ParameterReverbEnable, ParameterReverbEnable,
ParameterReverbSize, ParameterReverbSize,
ParameterReverbHighDamp, ParameterReverbHighDamp,
@ -223,6 +225,9 @@ public:
void SetTGFXParameter (unsigned Parameter, int nValue, unsigned nTG, unsigned nFXType); void SetTGFXParameter (unsigned Parameter, int nValue, unsigned nTG, unsigned nFXType);
int GetTGFXParameter (unsigned Parameter, 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 // access (global or OP-related) parameter of the active voice of a TG
static const unsigned NoOP = 6; // for global parameters static const unsigned NoOP = 6; // for global parameters
void SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigned nOP, unsigned nTG); void SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigned nOP, unsigned nTG);
@ -333,8 +338,10 @@ private:
AudioEffectPlateReverb* reverb; AudioEffectPlateReverb* reverb;
AudioStereoMixer<CConfig::ToneGenerators>* tg_mixer; AudioStereoMixer<CConfig::ToneGenerators>* tg_mixer;
AudioStereoMixer<CConfig::ToneGenerators>* reverb_send_mixer; AudioStereoMixer<CConfig::ToneGenerators>* reverb_send_mixer;
AudioEffect* m_SendFX;
CSpinLock* m_InsertFXSpinLock[CConfig::ToneGenerators]; CSpinLock* m_InsertFXSpinLock[CConfig::ToneGenerators];
CSpinLock m_SendFXSpinLock;
CSpinLock m_ReverbSpinLock; CSpinLock m_ReverbSpinLock;
bool m_bSavePerformance; bool m_bSavePerformance;

@ -82,6 +82,7 @@ const CUIMenu::TMenuItem CUIMenu::s_TGMenu[] =
const CUIMenu::TMenuItem CUIMenu::s_EffectsMenu[] = const CUIMenu::TMenuItem CUIMenu::s_EffectsMenu[] =
{ {
{"Compress", EditGlobalParameter, 0, CMiniDexed::ParameterCompressorEnable}, {"Compress", EditGlobalParameter, 0, CMiniDexed::ParameterCompressorEnable},
{"Send FX", MenuHandlerSendFX},
#ifdef ARM_ALLOW_MULTI_CORE #ifdef ARM_ALLOW_MULTI_CORE
{"Reverb", MenuHandler, s_ReverbMenu}, {"Reverb", MenuHandler, s_ReverbMenu},
#endif #endif
@ -121,6 +122,13 @@ const CUIMenu::TMenuItem CUIMenu::s_ModulationMenuParameters[] =
{0} {0}
}; };
const CUIMenu::TMenuItem CUIMenu::s_SendFXMenu[] =
{
{"Type:", EditGlobalParameter, 0, CMiniDexed::ParameterSendFXType},
{"Edit:", EditSendFX},
{0}
};
#ifdef ARM_ALLOW_MULTI_CORE #ifdef ARM_ALLOW_MULTI_CORE
const CUIMenu::TMenuItem CUIMenu::s_ReverbMenu[] = const CUIMenu::TMenuItem CUIMenu::s_ReverbMenu[] =
@ -144,13 +152,13 @@ const CUIMenu::TMenuItem CUIMenu::s_InsertFX[] =
{0} {0}
}; };
const CUIMenu::TMenuItem CUIMenu::s_FXNone[] = CUIMenu::TMenuItem CUIMenu::s_FXNone[] =
{ {
{"None"}, {"None"},
{0} {0}
}; };
const CUIMenu::TMenuItem CUIMenu::s_FXChorus[] = CUIMenu::TMenuItem CUIMenu::s_FXChorus[] =
{ {
{"Bypass", EditTGFXParameter, 0, AudioEffectChorus::Param::BYPASS}, {"Bypass", EditTGFXParameter, 0, AudioEffectChorus::Param::BYPASS},
{"Chorus I", EditTGFXParameter, 0, AudioEffectChorus::Param::CHORUS_I_ENABLE}, {"Chorus I", EditTGFXParameter, 0, AudioEffectChorus::Param::CHORUS_I_ENABLE},
@ -160,7 +168,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXChorus[] =
{0} {0}
}; };
const CUIMenu::TMenuItem CUIMenu::s_FXDelay[] = CUIMenu::TMenuItem CUIMenu::s_FXDelay[] =
{ {
{"Bypass", EditTGFXParameter, 0, AudioEffectDelay::Param::BYPASS}, {"Bypass", EditTGFXParameter, 0, AudioEffectDelay::Param::BYPASS},
{"Time L", EditTGFXParameter, 0, AudioEffectDelay::Param::TIME_L}, {"Time L", EditTGFXParameter, 0, AudioEffectDelay::Param::TIME_L},
@ -172,7 +180,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXDelay[] =
{0} {0}
}; };
const CUIMenu::TMenuItem CUIMenu::s_FXLPFilter[] = CUIMenu::TMenuItem CUIMenu::s_FXLPFilter[] =
{ {
{"Bypass", EditTGFXParameter, 0, AudioEffectLPF::Param::BYPASS}, {"Bypass", EditTGFXParameter, 0, AudioEffectLPF::Param::BYPASS},
{"Cutoff", EditTGFXParameter, 0, AudioEffectLPF::Param::CUTOFF}, {"Cutoff", EditTGFXParameter, 0, AudioEffectLPF::Param::CUTOFF},
@ -180,7 +188,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXLPFilter[] =
{0} {0}
}; };
const CUIMenu::TMenuItem CUIMenu::s_FXDS1[] = CUIMenu::TMenuItem CUIMenu::s_FXDS1[] =
{ {
{"Bypass", EditTGFXParameter, 0, AudioEffectDS1::Param::BYPASS}, {"Bypass", EditTGFXParameter, 0, AudioEffectDS1::Param::BYPASS},
{"Dist", EditTGFXParameter, 0, AudioEffectDS1::Param::DIST}, {"Dist", EditTGFXParameter, 0, AudioEffectDS1::Param::DIST},
@ -189,7 +197,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXDS1[] =
{0} {0}
}; };
const CUIMenu::TMenuItem CUIMenu::s_FXBigMuff[] = CUIMenu::TMenuItem CUIMenu::s_FXBigMuff[] =
{ {
{"Bypass", EditTGFXParameter, 0, AudioEffectBigMuff::Param::BYPASS}, {"Bypass", EditTGFXParameter, 0, AudioEffectBigMuff::Param::BYPASS},
{"Sustain", EditTGFXParameter, 0, AudioEffectBigMuff::Param::SUSTAIN}, {"Sustain", EditTGFXParameter, 0, AudioEffectBigMuff::Param::SUSTAIN},
@ -198,7 +206,7 @@ const CUIMenu::TMenuItem CUIMenu::s_FXBigMuff[] =
{0} {0}
}; };
const CUIMenu::TMenuItem CUIMenu::s_FXTalReverb3[] = CUIMenu::TMenuItem CUIMenu::s_FXTalReverb3[] =
{ {
{"Bypass", EditTGFXParameter, 0, AudioEffectTalReverb3::Param::BYPASS}, {"Bypass", EditTGFXParameter, 0, AudioEffectTalReverb3::Param::BYPASS},
{"Dry", EditTGFXParameter, 0, AudioEffectTalReverb3::Param::DRY}, {"Dry", EditTGFXParameter, 0, AudioEffectTalReverb3::Param::DRY},
@ -284,6 +292,7 @@ const CUIMenu::TMenuItem CUIMenu::s_SaveMenu[] =
const CUIMenu::TParameter CUIMenu::s_GlobalParameter[CMiniDexed::ParameterUnknown] = const CUIMenu::TParameter CUIMenu::s_GlobalParameter[CMiniDexed::ParameterUnknown] =
{ {
{0, 1, 1, ToOnOff}, // ParameterCompessorEnable {0, 1, 1, ToOnOff}, // ParameterCompessorEnable
{0, 6, 1, ToFXType}, // ParameterSendFXType
{0, 1, 1, ToOnOff}, // ParameterReverbEnable {0, 1, 1, ToOnOff}, // ParameterReverbEnable
{0, 99, 1}, // ParameterReverbSize {0, 99, 1}, // ParameterReverbSize
{0, 99, 1}, // ParameterReverbHighDamp {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) void CUIMenu::EditGlobalParameter (CUIMenu *pUIMenu, TMenuEvent Event)
{ {
CMiniDexed::TParameter Param = (CMiniDexed::TParameter) pUIMenu->m_nCurrentParameter; 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]; unsigned nTG = pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth-2];
int fxType = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TGParameterInsertFXType, nTG); int fxType = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TGParameterInsertFXType, nTG);
switch (fxType) pUIMenu->m_pCurrentMenu = getInsertFXMenuItem(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;
}
switch (Event) switch (Event)
{ {
@ -1060,9 +1127,6 @@ void CUIMenu::EditInsertFX (CUIMenu *pUIMenu, TMenuEvent Event)
string TG ("TG"); string TG ("TG");
TG += to_string (nTG+1); TG += to_string (nTG+1);
// Get current FX type
int fxType = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TGParameterInsertFXType, nTG);
pUIMenu->m_pUI->DisplayWrite ( pUIMenu->m_pUI->DisplayWrite (
TG.c_str (), TG.c_str (),
getFXTypeName(fxType).c_str(), getFXTypeName(fxType).c_str(),
@ -1086,30 +1150,7 @@ void CUIMenu::EditTGFXParameter (CUIMenu *pUIMenu, TMenuEvent Event)
// Get Param // Get Param
unsigned nParam = pUIMenu->m_nCurrentParameter; unsigned nParam = pUIMenu->m_nCurrentParameter;
TParameter pParam; TParameter pParam = getFXParameter(nFXType, nParam);
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;
}
const TParameter &rParam = pParam; const TParameter &rParam = pParam;
int nValue = pUIMenu->m_pMiniDexed->GetTGFXParameter (nParam, nTG, nFXType); 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); 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) void CUIMenu::EditVoiceParameter (CUIMenu *pUIMenu, TMenuEvent Event)
{ {
unsigned nTG = pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth-2]; 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;
}

@ -93,10 +93,19 @@ private:
static void SavePerformanceNewFile (CUIMenu *pUIMenu, TMenuEvent Event); static void SavePerformanceNewFile (CUIMenu *pUIMenu, TMenuEvent Event);
static void EditPerformanceBankNumber (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 MenuHandlerInsertFX (CUIMenu *pUIMenu, TMenuEvent Event);
static void EditInsertFX (CUIMenu *pUIMenu, TMenuEvent Event); static void EditInsertFX (CUIMenu *pUIMenu, TMenuEvent Event);
static void EditTGFXParameter (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 GetGlobalValueString (unsigned nParameter, int nValue);
static std::string GetTGValueString (unsigned nTGParameter, int nValue); static std::string GetTGValueString (unsigned nTGParameter, int nValue);
static std::string GetVoiceValueString (unsigned nVoiceParameter, int nValue); static std::string GetVoiceValueString (unsigned nVoiceParameter, int nValue);
@ -151,15 +160,18 @@ private:
static const TMenuItem s_MainMenu[]; static const TMenuItem s_MainMenu[];
static const TMenuItem s_TGMenu[]; static const TMenuItem s_TGMenu[];
static const TMenuItem s_EffectsMenu[]; static const TMenuItem s_EffectsMenu[];
static const TMenuItem s_SendFXMenu[];
static const TMenuItem s_ReverbMenu[]; static const TMenuItem s_ReverbMenu[];
static const TMenuItem s_InsertFX[]; static const TMenuItem s_InsertFX[];
static const TMenuItem s_FXNone[];
static const TMenuItem s_FXChorus[]; static TMenuItem s_FXNone[];
static const TMenuItem s_FXDelay[]; static TMenuItem s_FXChorus[];
static const TMenuItem s_FXLPFilter[]; static TMenuItem s_FXDelay[];
static const TMenuItem s_FXDS1[]; static TMenuItem s_FXLPFilter[];
static const TMenuItem s_FXBigMuff[]; static TMenuItem s_FXDS1[];
static const TMenuItem s_FXTalReverb3[]; static TMenuItem s_FXBigMuff[];
static TMenuItem s_FXTalReverb3[];
static const TMenuItem s_EditVoiceMenu[]; static const TMenuItem s_EditVoiceMenu[];
static const TMenuItem s_OperatorMenu[]; static const TMenuItem s_OperatorMenu[];
static const TMenuItem s_SaveMenu[]; static const TMenuItem s_SaveMenu[];

Loading…
Cancel
Save