From be703315a733e5593c168aba94140b0b650e5732 Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Mon, 10 Feb 2014 05:30:41 +0100 Subject: [PATCH] Vocoder: auto levelling removed --- src/calf/modules_filter.h | 2 +- src/modules_filter.cpp | 27 ++------------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/src/calf/modules_filter.h b/src/calf/modules_filter.h index 18f4547..fb4a779 100644 --- a/src/calf/modules_filter.h +++ b/src/calf/modules_filter.h @@ -353,7 +353,7 @@ public: bool is_active; static const int maxorder = 8; dsp::biquad_d2 detector[2][maxorder][32], modulator[2][maxorder][32]; - double env_mods[2][32], env_carriers[2][32], env_mod[2], env_carrier[2], proc_coeff[2]; + double env_mods[2][32]; vumeters meters; analyzer _analyzer; double attack, release, fcoeff; diff --git a/src/modules_filter.cpp b/src/modules_filter.cpp index 26144f4..9b1a000 100644 --- a/src/modules_filter.cpp +++ b/src/modules_filter.cpp @@ -871,13 +871,8 @@ vocoder_audio_module::vocoder_audio_module() bands_old = -1; order = 0; order_old = -1; - proc_coeff[0] = 0; - proc_coeff[1] = 0; fcoeff = log10(20.f); memset(env_mods, 0, 32 * 2 * sizeof(double)); - memset(env_carriers, 0, 32 * 2 * sizeof(double)); - memset(env_mod, 0, 2 * sizeof(double)); - memset(env_carrier, 0, 2 * sizeof(double)); } void vocoder_audio_module::activate() @@ -958,8 +953,6 @@ uint32_t vocoder_audio_module::process(uint32_t offset, uint32_t numsamples, uin double outR = 0; double pL = 0; double pR = 0; - double ccL = 0; - double ccR = 0; // carrier with level double cL = ins[0][offset] * *params[param_carrier_in]; @@ -969,12 +962,6 @@ uint32_t vocoder_audio_module::process(uint32_t offset, uint32_t numsamples, uin double mL = ins[2][offset] * *params[param_mod_in]; double mR = ins[3][offset] * *params[param_mod_in]; - // advance envelopes - env_mod[0] = (fabs(mL) > env_mod[0] ? attack : release) * (env_mod[0] - fabs(mL)) + fabs(mL); - env_mod[1] = (fabs(mR) > env_mod[1] ? attack : release) * (env_mod[1] - fabs(mR)) + fabs(mR); - env_carrier[0] = (fabs(cL) > env_carrier[0] ? attack : release) * (env_carrier[0] - fabs(cL)) + fabs(cL); - env_carrier[1] = (fabs(cR) > env_carrier[1] ? attack : release) * (env_carrier[1] - fabs(cR)) + fabs(cR); - // noise generator double nL = (float)rand() / (float)RAND_MAX; double nR = (float)rand() / (float)RAND_MAX; @@ -1000,8 +987,8 @@ uint32_t vocoder_audio_module::process(uint32_t offset, uint32_t numsamples, uin cR_ = modulator[1][j][i].process(cR_); } // level by envelope with levelling - cL_ *= env_mods[0][i] * proc_coeff[0]; - cR_ *= env_mods[1][i] * proc_coeff[1]; + cL_ *= env_mods[0][i] * order * 4; + cR_ *= env_mods[1][i] * order * 4; // add band volume setting cL_ *= *params[param_volume0 + i * band_params]; @@ -1020,21 +1007,11 @@ uint32_t vocoder_audio_module::process(uint32_t offset, uint32_t numsamples, uin // add to outputs with proc level pL += cL_ * *params[param_proc]; pR += cR_ * *params[param_proc]; - - // calc proc_coeff - ccL += (env_carriers[0][i] * env_mods[0][i]); - ccR += (env_carriers[1][i] * env_mods[1][i]); } // advance envelopes env_mods[0][i] = (fabs(mL_) > env_mods[0][i] ? attack : release) * (env_mods[0][i] - fabs(mL_)) + fabs(mL_); env_mods[1][i] = (fabs(mR_) > env_mods[1][i] ? attack : release) * (env_mods[1][i] - fabs(mR_)) + fabs(mR_); - env_carriers[0][i] = (fabs(cL_) > env_carriers[0][i] ? attack : release) * (env_carriers[0][i] - fabs(cL_)) + fabs(cL_); - env_carriers[1][i] = (fabs(cR_) > env_carriers[1][i] ? attack : release) * (env_carriers[1][i] - fabs(cR_)) + fabs(cR_); - } - - proc_coeff[0] = ccL ? env_mod[0] * env_carrier[0] / ccL : 1; - proc_coeff[1] = ccR ? env_mod[1] * env_carrier[1] / ccR : 1; outL = pL; outR = pR; -- 2.11.4.GIT