summaryrefslogtreecommitdiff
path: root/libs/ardour/audioregion.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-05-29 16:59:04 +0200
committerRobin Gareus <robin@gareus.org>2014-05-29 16:59:04 +0200
commit7953df93bfec2df8bb0a8568a9dacbd00235aac4 (patch)
tree7ea7497518d7f39076f62e000ef2764ca28bc25d /libs/ardour/audioregion.cc
parent2d82446f596b30ae6ffcf464fb63aa6e44e43355 (diff)
Symmetric x-fade, use equivalent of -6dB per step for 7 steps.
Diffstat (limited to 'libs/ardour/audioregion.cc')
-rw-r--r--libs/ardour/audioregion.cc8
1 files changed, 2 insertions, 6 deletions
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);