Use linear fades for loop-range cross-fades
The cross-over point of an exponential fade occurs further towards start of the fade. This increases consistency of cross-fades moving the cross-over point to the center of the fade. Also looped material is likely correlated in which a linear fade is more appropriate.
This commit is contained in:
parent
c08298e6d8
commit
751db481a6
@ -181,7 +181,7 @@ protected:
|
||||
Declicker ();
|
||||
~Declicker ();
|
||||
|
||||
void alloc (samplecnt_t sr, bool fadein);
|
||||
void alloc (samplecnt_t sr, bool fadein, bool linear);
|
||||
|
||||
void run (Sample* buf, samplepos_t start, samplepos_t end);
|
||||
void reset (samplepos_t start, samplepos_t end, bool fadein, samplecnt_t sr);
|
||||
|
@ -1643,11 +1643,27 @@ DiskReader::Declicker::~Declicker ()
|
||||
}
|
||||
|
||||
void
|
||||
DiskReader::Declicker::alloc (samplecnt_t sr, bool fadein)
|
||||
DiskReader::Declicker::alloc (samplecnt_t sr, bool fadein, bool linear)
|
||||
{
|
||||
delete[] vec;
|
||||
vec = new Sample[loop_fade_length];
|
||||
|
||||
if (linear) {
|
||||
if (fadein) {
|
||||
for (samplecnt_t n = 0; n < loop_fade_length; ++n) {
|
||||
vec[n] = n / (float) loop_fade_length;
|
||||
}
|
||||
} else {
|
||||
for (samplecnt_t n = 0; n < loop_fade_length; ++n) {
|
||||
vec[n] = 1.f - n / (float) loop_fade_length;
|
||||
}
|
||||
}
|
||||
fade_length = loop_fade_length - 1;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Exponential fade */
|
||||
|
||||
const float a = 390.f / sr; // ~ 1/100Hz for 40dB
|
||||
|
||||
/* build a psuedo-exponential (linear-volume) shape for the fade */
|
||||
@ -1884,8 +1900,8 @@ void
|
||||
DiskReader::alloc_loop_declick (samplecnt_t sr)
|
||||
{
|
||||
loop_fade_length = lrintf (ceil (-log (GAIN_COEFF_DELTA / 2.) / (390. / sr)));
|
||||
loop_declick_in.alloc (sr, true);
|
||||
loop_declick_out.alloc (sr, false);
|
||||
loop_declick_in.alloc (sr, true, Config->get_loop_fade_choice () == XFadeLoop);
|
||||
loop_declick_out.alloc (sr, false, Config->get_loop_fade_choice () == XFadeLoop);
|
||||
}
|
||||
|
||||
#undef GAIN_COEFF_DELTA
|
||||
|
Loading…
Reference in New Issue
Block a user