From 7953df93bfec2df8bb0a8568a9dacbd00235aac4 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 29 May 2014 16:59:04 +0200 Subject: Symmetric x-fade, use equivalent of -6dB per step for 7 steps. --- libs/ardour/audioregion.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'libs/ardour/audioregion.cc') diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc index dd198db3b4..a40168ea9f 100644 --- a/libs/ardour/audioregion.cc +++ b/libs/ardour/audioregion.cc @@ -1035,9 +1035,7 @@ AudioRegion::set_fade_in (FadeShape shape, framecnt_t len) for (int i = 2; i < num_steps; i++) { const double offset = 1.0 - breakpoint; float coeff = 1.0 - breakpoint; - for (int j = 0; j < i; j++) { - coeff *= 0.5; //6dB drop per step - } + coeff *= powf(0.5, (i-1) * 7.0 / (double)num_steps); // -6dB per step for 7 steps _fade_in->fast_simple_add (len * (breakpoint + (offset * (double)i / (double)num_steps)), coeff); } _fade_in->fast_simple_add (len, VERY_SMALL_SIGNAL); @@ -1116,9 +1114,7 @@ AudioRegion::set_fade_out (FadeShape shape, framecnt_t len) for (int i = 2; i < num_steps; i++) { const double offset = 1.0 - breakpoint; float coeff = 1.0 - breakpoint; - for (int j = 0; j < i; j++) { - coeff *= 0.5; // 6dB drop per step - } + coeff *= powf(0.5, (i-1) * 7.0 / (double)num_steps); // -6dB per step for 7 steps _fade_out->fast_simple_add (len * (breakpoint + (offset * (double)i / (double)num_steps)), coeff); } _fade_out->fast_simple_add (len, VERY_SMALL_SIGNAL); -- cgit v1.2.3