From 5d771231233cef5e62f177dde2c8f0d02cc0e346 Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Thu, 22 Dec 2016 16:19:35 +0000 Subject: [PATCH] Ok, now simpler and better avoiding of clippin and distortion. --- src/dexed.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dexed.cpp b/src/dexed.cpp index 331ef30..d8993dc 100644 --- a/src/dexed.cpp +++ b/src/dexed.cpp @@ -161,7 +161,7 @@ void Dexed::set_params(void) } if(fx.uiGain!=f_gain) { - fx.uiGain=f_gain*0.8; + fx.uiGain=f_gain; refreshVoice=true; } @@ -430,7 +430,8 @@ void Dexed::GetSamples(uint32_t n_samples, float* buffer) for (uint32_t j=0; j < N; ++j) { #ifndef NON_DEXED_CLIP int32_t val = audiobuf.get()[j]; - val = val >> 4; + //val = val >> 4; + val = val >> 5; int32_t clip_val = val < -(1 << 24) ? 0x8000 : val >= (1 << 24) ? 0x7fff : val >> 9; float f = static_cast(clip_val)/0x8000; #else