pull/883/merge
soyer 4 days ago committed by GitHub
commit aa498688f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 80
      src/effect_platervbstereo.cpp
  2. 7
      src/effect_platervbstereo.h
  3. 3
      src/minidexed.cpp

@ -156,52 +156,84 @@ AudioEffectPlateReverb::AudioEffectPlateReverb(float32_t samplerate)
reverb_level = 0.0f; reverb_level = 0.0f;
} }
// #define sat16(n, rshift) signed_saturate_rshift((n), 16, (rshift)) void AudioEffectPlateReverb::cleanup(void)
void AudioEffectPlateReverb::doReverb(const float32_t* inblockL, const float32_t* inblockR, float32_t* rvbblockL, float32_t* rvbblockR, uint16_t len)
{ {
float32_t input, acc, temp1, temp2;
uint16_t temp16;
float32_t rv_time;
// for LFOs:
int16_t lfo1_out_sin, lfo1_out_cos, lfo2_out_sin, lfo2_out_cos;
int32_t y0, y1;
int64_t y;
uint32_t idx;
static bool cleanup_done = false;
// handle bypass, 1st call will clean the buffers to avoid continuing the previous reverb tail
if (bypass)
{
if (!cleanup_done)
{
memset(in_allp1_bufL, 0, sizeof(in_allp1_bufL)); memset(in_allp1_bufL, 0, sizeof(in_allp1_bufL));
memset(in_allp2_bufL, 0, sizeof(in_allp2_bufL)); memset(in_allp2_bufL, 0, sizeof(in_allp2_bufL));
memset(in_allp3_bufL, 0, sizeof(in_allp3_bufL)); memset(in_allp3_bufL, 0, sizeof(in_allp3_bufL));
memset(in_allp4_bufL, 0, sizeof(in_allp4_bufL)); memset(in_allp4_bufL, 0, sizeof(in_allp4_bufL));
in_allp1_idxL = 0;
in_allp2_idxL = 0;
in_allp3_idxL = 0;
in_allp4_idxL = 0;
memset(in_allp1_bufR, 0, sizeof(in_allp1_bufR)); memset(in_allp1_bufR, 0, sizeof(in_allp1_bufR));
memset(in_allp2_bufR, 0, sizeof(in_allp2_bufR)); memset(in_allp2_bufR, 0, sizeof(in_allp2_bufR));
memset(in_allp3_bufR, 0, sizeof(in_allp3_bufR)); memset(in_allp3_bufR, 0, sizeof(in_allp3_bufR));
memset(in_allp4_bufR, 0, sizeof(in_allp4_bufR)); memset(in_allp4_bufR, 0, sizeof(in_allp4_bufR));
in_allp1_idxR = 0;
in_allp2_idxR = 0;
in_allp3_idxR = 0;
in_allp4_idxR = 0;
memset(lp_allp1_buf, 0, sizeof(lp_allp1_buf)); memset(lp_allp1_buf, 0, sizeof(lp_allp1_buf));
memset(lp_allp2_buf, 0, sizeof(lp_allp2_buf)); memset(lp_allp2_buf, 0, sizeof(lp_allp2_buf));
memset(lp_allp3_buf, 0, sizeof(lp_allp3_buf)); memset(lp_allp3_buf, 0, sizeof(lp_allp3_buf));
memset(lp_allp4_buf, 0, sizeof(lp_allp4_buf)); memset(lp_allp4_buf, 0, sizeof(lp_allp4_buf));
lp_allp1_idx = 0;
lp_allp2_idx = 0;
lp_allp3_idx = 0;
lp_allp4_idx = 0;
lp_allp_out = 0.0f;
memset(lp_dly1_buf, 0, sizeof(lp_dly1_buf)); memset(lp_dly1_buf, 0, sizeof(lp_dly1_buf));
memset(lp_dly2_buf, 0, sizeof(lp_dly2_buf)); memset(lp_dly2_buf, 0, sizeof(lp_dly2_buf));
memset(lp_dly3_buf, 0, sizeof(lp_dly3_buf)); memset(lp_dly3_buf, 0, sizeof(lp_dly3_buf));
memset(lp_dly4_buf, 0, sizeof(lp_dly4_buf)); memset(lp_dly4_buf, 0, sizeof(lp_dly4_buf));
lp_dly1_idx = 0;
lp_dly2_idx = 0;
lp_dly3_idx = 0;
lp_dly4_idx = 0;
cleanup_done = true; lpf1 = 0.0f;
} lpf2 = 0.0f;
lpf3 = 0.0f;
lpf4 = 0.0f;
return; hpf1 = 0.0f;
} hpf2 = 0.0f;
cleanup_done = false; hpf3 = 0.0f;
hpf4 = 0.0f;
master_lowpass_l = 0.0f;
master_lowpass_r = 0.0f;
lfo1_phase_acc = 0;
lfo2_phase_acc = 0;
}
// #define sat16(n, rshift) signed_saturate_rshift((n), 16, (rshift))
void AudioEffectPlateReverb::doReverb(const float32_t* inblockL, const float32_t* inblockR, float32_t* rvbblockL, float32_t* rvbblockR, uint16_t len)
{
float32_t input, acc, temp1, temp2;
uint16_t temp16;
float32_t rv_time;
// for LFOs:
int16_t lfo1_out_sin, lfo1_out_cos, lfo2_out_sin, lfo2_out_cos;
int32_t y0, y1;
int64_t y;
uint32_t idx;
rv_time = rv_time_k; rv_time = rv_time_k;
if (need_cleanup)
{
cleanup();
need_cleanup = false;
}
for (uint16_t i=0; i < len; i++) for (uint16_t i=0; i < len; i++)
{ {
// do the LFOs // do the LFOs

@ -105,12 +105,11 @@ public:
} }
float32_t get_size(void) {return rv_time_k;} float32_t get_size(void) {return rv_time_k;}
bool get_bypass(void) {return bypass;}
void set_bypass(bool state) {bypass = state;};
void tgl_bypass(void) {bypass ^=1;}
float32_t get_level(void) {return reverb_level;} float32_t get_level(void) {return reverb_level;}
void set_need_cleanup(void) {need_cleanup = true;};
void cleanup(void);
private: private:
bool bypass = false; bool need_cleanup = false;
float32_t reverb_level; float32_t reverb_level;
float32_t input_attn; float32_t input_attn;

@ -1014,7 +1014,8 @@ void CMiniDexed::SetParameter (TParameter Parameter, int nValue)
case ParameterReverbEnable: case ParameterReverbEnable:
nValue=constrain((int)nValue,0,1); nValue=constrain((int)nValue,0,1);
m_ReverbSpinLock.Acquire (); m_ReverbSpinLock.Acquire ();
reverb->set_bypass (!nValue); if (nValue)
reverb->set_need_cleanup ();
m_ReverbSpinLock.Release (); m_ReverbSpinLock.Release ();
break; break;

Loading…
Cancel
Save