From 9a1b8d765ba6a31af3bc4e86f7cff819955396e9 Mon Sep 17 00:00:00 2001 From: Krzysztof Foltman Date: Thu, 13 Feb 2014 00:13:34 +0000 Subject: [PATCH] Saturator: example use of seamless bypass --- src/calf/modules_dist.h | 3 ++- src/modules_dist.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calf/modules_dist.h b/src/calf/modules_dist.h index 0aee6bc..7975e27 100644 --- a/src/calf/modules_dist.h +++ b/src/calf/modules_dist.h @@ -24,7 +24,7 @@ #include #include #include "biquad.h" -#include "inertia.h" +#include "bypass.h" #include "audio_fx.h" #include "giface.h" #include "metadata.h" @@ -45,6 +45,7 @@ private: dsp::biquad_d2 lp[2][4], hp[2][4]; dsp::biquad_d2 p[2]; dsp::tap_distortion dist[2]; + dsp::bypass bypass; vumeters meters; public: uint32_t srate; diff --git a/src/modules_dist.cpp b/src/modules_dist.cpp index 017a48f..0d3feb3 100644 --- a/src/modules_dist.cpp +++ b/src/modules_dist.cpp @@ -124,9 +124,9 @@ void saturator_audio_module::set_sample_rate(uint32_t sr) uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, uint32_t inputs_mask, uint32_t outputs_mask) { - bool bypass = *params[param_bypass] > 0.5f; + bool bypassed = bypass.update(*params[param_bypass] > 0.5f, numsamples); numsamples += offset; - if(bypass) { + if(bypassed) { // everything bypassed while(offset < numsamples) { if(in_count > 1 && out_count > 1) { @@ -145,6 +145,7 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u ++offset; } } else { + uint32_t orig_offset = offset; // process while(offset < numsamples) { // cycle through samples @@ -240,6 +241,7 @@ uint32_t saturator_audio_module::process(uint32_t offset, uint32_t numsamples, u hp[1][3].sanitize(); p[0].sanitize(); p[1].sanitize(); + bypass.crossfade(ins, outs, 2, orig_offset, numsamples); } meters.fall(numsamples); return outputs_mask; -- 2.11.4.GIT