FX Code clean up

pull/793/head
Javier Nonis 4 weeks ago
parent cc5acfbd50
commit 427b30baa7
  1. 81
      src/minidexed.cpp
  2. 9
      src/minidexed.h
  3. 23
      src/uimenu.cpp

@ -240,14 +240,6 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
// BEGIN setup reverb
SetParameter (ParameterSendFXType, AudioEffectPlateReverb::ID);
reverb_send_mixer = new AudioStereoMixer<CConfig::AllToneGenerators>(pConfig->GetChunkSize()/2);
reverb = new AudioEffectPlateReverb(pConfig->GetSampleRate());
SetParameter (ParameterReverbEnable, 1);
SetParameter (ParameterReverbSize, 70);
SetParameter (ParameterReverbHighDamp, 50);
SetParameter (ParameterReverbLowDamp, 50);
SetParameter (ParameterReverbLowPass, 30);
SetParameter (ParameterReverbDiffusion, 65);
SetParameter (ParameterReverbLevel, 99);
// END setup reverb
SetParameter (ParameterCompressorEnable, 1);
@ -1081,8 +1073,6 @@ void CMiniDexed::ControllersRefresh (unsigned nTG)
void CMiniDexed::SetParameter (TParameter Parameter, int nValue)
{
assert (reverb);
assert (Parameter < ParameterUnknown);
m_nParameter[Parameter] = nValue;
@ -1104,55 +1094,6 @@ void CMiniDexed::SetParameter (TParameter Parameter, int nValue)
setSendFXLevel(nValue);
break;
case ParameterReverbEnable:
nValue=constrain((int)nValue,0,1);
m_ReverbSpinLock.Acquire ();
reverb->setBypass (!nValue);
m_ReverbSpinLock.Release ();
break;
case ParameterReverbSize:
nValue=constrain((int)nValue,0,99);
m_ReverbSpinLock.Acquire ();
reverb->size (nValue / 99.0f);
m_ReverbSpinLock.Release ();
break;
case ParameterReverbHighDamp:
nValue=constrain((int)nValue,0,99);
m_ReverbSpinLock.Acquire ();
reverb->hidamp (nValue / 99.0f);
m_ReverbSpinLock.Release ();
break;
case ParameterReverbLowDamp:
nValue=constrain((int)nValue,0,99);
m_ReverbSpinLock.Acquire ();
reverb->lodamp (nValue / 99.0f);
m_ReverbSpinLock.Release ();
break;
case ParameterReverbLowPass:
nValue=constrain((int)nValue,0,99);
m_ReverbSpinLock.Acquire ();
reverb->lowpass (nValue / 99.0f);
m_ReverbSpinLock.Release ();
break;
case ParameterReverbDiffusion:
nValue=constrain((int)nValue,0,99);
m_ReverbSpinLock.Acquire ();
reverb->diffusion (nValue / 99.0f);
m_ReverbSpinLock.Release ();
break;
case ParameterReverbLevel:
nValue=constrain((int)nValue,0,99);
m_ReverbSpinLock.Acquire ();
reverb->level (nValue / 99.0f);
m_ReverbSpinLock.Release ();
break;
case ParameterPerformanceSelectChannel:
// Nothing more to do
break;
@ -1569,8 +1510,6 @@ void CMiniDexed::ProcessSound (void)
tg_mixer->getMix(SampleBuffer[indexL], SampleBuffer[indexR]);
// BEGIN adding reverb
if (m_nParameter[ParameterReverbEnable])
{
float32_t ReverbBuffer[2][nFrames];
float32_t ReverbSendBuffer[2][nFrames];
@ -1580,10 +1519,8 @@ void CMiniDexed::ProcessSound (void)
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);
m_SendFX->process(ReverbSendBuffer[indexL], ReverbSendBuffer[indexR], ReverbBuffer[indexL], ReverbBuffer[indexR], nFrames);
// scale down and add left reverb buffer by reverb level
@ -1593,9 +1530,7 @@ void CMiniDexed::ProcessSound (void)
arm_scale_f32(ReverbBuffer[indexR], m_SendFXLevel, ReverbBuffer[indexR], nFrames);
arm_add_f32(SampleBuffer[indexR], ReverbBuffer[indexR], SampleBuffer[indexR], nFrames);
m_ReverbSpinLock.Release ();
m_SendFXSpinLock.Release ();
}
// END adding reverb
// swap stereo channels if needed prior to writing back out
@ -1745,14 +1680,6 @@ bool CMiniDexed::DoSavePerformance (void)
pParams.shrink_to_fit();
m_PerformanceConfig.SetSendFXLevel (roundf(m_SendFXLevel * 100));
m_PerformanceConfig.SetReverbEnable (!!m_nParameter[ParameterReverbEnable]);
m_PerformanceConfig.SetReverbSize (m_nParameter[ParameterReverbSize]);
m_PerformanceConfig.SetReverbHighDamp (m_nParameter[ParameterReverbHighDamp]);
m_PerformanceConfig.SetReverbLowDamp (m_nParameter[ParameterReverbLowDamp]);
m_PerformanceConfig.SetReverbLowPass (m_nParameter[ParameterReverbLowPass]);
m_PerformanceConfig.SetReverbDiffusion (m_nParameter[ParameterReverbDiffusion]);
m_PerformanceConfig.SetReverbLevel (m_nParameter[ParameterReverbLevel]);
m_PerformanceConfig.SetTempo (m_nTempo);
if(m_bSaveAsDeault)
@ -2248,14 +2175,6 @@ void CMiniDexed::LoadPerformanceParameters(void)
pParams.shrink_to_fit();
SetParameter (ParameterSendFXLevel, m_PerformanceConfig.GetSendFXLevel ());
SetParameter (ParameterReverbEnable, m_PerformanceConfig.GetReverbEnable () ? 1 : 0);
SetParameter (ParameterReverbSize, m_PerformanceConfig.GetReverbSize ());
SetParameter (ParameterReverbHighDamp, m_PerformanceConfig.GetReverbHighDamp ());
SetParameter (ParameterReverbLowDamp, m_PerformanceConfig.GetReverbLowDamp ());
SetParameter (ParameterReverbLowPass, m_PerformanceConfig.GetReverbLowPass ());
SetParameter (ParameterReverbDiffusion, m_PerformanceConfig.GetReverbDiffusion ());
SetParameter (ParameterReverbLevel, m_PerformanceConfig.GetReverbLevel ());
SetParameter (ParameterTempo, m_PerformanceConfig.GetTempo ());
}

@ -166,13 +166,6 @@ public:
ParameterCompressorEnable,
ParameterSendFXType,
ParameterSendFXLevel,
ParameterReverbEnable,
ParameterReverbSize,
ParameterReverbHighDamp,
ParameterReverbLowDamp,
ParameterReverbLowPass,
ParameterReverbDiffusion,
ParameterReverbLevel,
ParameterPerformanceSelectChannel,
ParameterPerformanceBank,
ParameterTempo,
@ -349,7 +342,6 @@ private:
CPerformanceTimer m_GetChunkTimer;
bool m_bProfileEnabled;
AudioEffectPlateReverb* reverb;
AudioStereoMixer<CConfig::AllToneGenerators>* tg_mixer;
AudioStereoMixer<CConfig::AllToneGenerators>* reverb_send_mixer;
AudioEffect* m_SendFX = NULL;
@ -358,7 +350,6 @@ private:
CSpinLock* m_MidiArpSpinLock[CConfig::AllToneGenerators];
CSpinLock* m_InsertFXSpinLock[CConfig::AllToneGenerators];
CSpinLock m_SendFXSpinLock;
CSpinLock m_ReverbSpinLock;
bool m_bSavePerformance;
bool m_bSavePerformanceNewFile;

@ -142,22 +142,6 @@ const CUIMenu::TMenuItem CUIMenu::s_SendFXMenu[] =
{0}
};
#ifdef ARM_ALLOW_MULTI_CORE
const CUIMenu::TMenuItem CUIMenu::s_ReverbMenu[] =
{
{"Enable", EditGlobalParameter, 0, CMiniDexed::ParameterReverbEnable},
{"Size", EditGlobalParameter, 0, CMiniDexed::ParameterReverbSize},
{"High damp", EditGlobalParameter, 0, CMiniDexed::ParameterReverbHighDamp},
{"Low damp", EditGlobalParameter, 0, CMiniDexed::ParameterReverbLowDamp},
{"Low pass", EditGlobalParameter, 0, CMiniDexed::ParameterReverbLowPass},
{"Diffusion", EditGlobalParameter, 0, CMiniDexed::ParameterReverbDiffusion},
{"Level", EditGlobalParameter, 0, CMiniDexed::ParameterReverbLevel},
{0}
};
#endif
const CUIMenu::TMenuItem CUIMenu::s_InsertFX[] =
{
{"Type:", EditTGParameter2, 0, CMiniDexed::TGParameterInsertFXType},
@ -431,13 +415,6 @@ const CUIMenu::TParameter CUIMenu::s_GlobalParameter[CMiniDexed::ParameterUnknow
{0, 1, 1, ToOnOff}, // ParameterCompressorEnable
{0, AudioEffects::Types::UNKNOWN - 1, 1, ToFXType}, // ParameterSendFXType
{0, 100, 1}, // ParameterSendFXLevel
{0, 1, 1, ToOnOff}, // ParameterReverbEnable
{0, 99, 1}, // ParameterReverbSize
{0, 99, 1}, // ParameterReverbHighDamp
{0, 99, 1}, // ParameterReverbLowDamp
{0, 99, 1}, // ParameterReverbLowPass
{0, 99, 1}, // ParameterReverbDiffusion
{0, 99, 1}, // ParameterReverbLevel
{0, CMIDIDevice::ChannelUnknown-1, 1, ToMIDIChannel}, // ParameterPerformanceSelectChannel
{0, NUM_PERFORMANCE_BANKS, 1}, // ParameterPerformanceBank
{30, 250, 1} // ParameterTempo

Loading…
Cancel
Save