aboutsummaryrefslogtreecommitdiffstats
path: root/src/crossfade.c
diff options
context:
space:
mode:
authorTim Phipps <mpd@phipps-hutton.freeserve.co.uk>2010-05-08 00:19:44 -0700
committerAvuton Olrich <avuton@gmail.com>2010-05-08 00:19:44 -0700
commit0ac5b6e613777bab093d1dbca1f3d6c80c48ca52 (patch)
tree167dbcd9c66cb60baf6ea61b0d501fdca4c71e98 /src/crossfade.c
parenteb5208c4f9e642c45b305f338c224cb65075840b (diff)
downloadmpd-0ac5b6e613777bab093d1dbca1f3d6c80c48ca52.tar.gz
mpd-0ac5b6e613777bab093d1dbca1f3d6c80c48ca52.tar.xz
mpd-0ac5b6e613777bab093d1dbca1f3d6c80c48ca52.zip
mixramp: Adjust MixRamp threshold to account for ReplayGain.
Diffstat (limited to '')
-rw-r--r--src/crossfade.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/crossfade.c b/src/crossfade.c
index b494b64b6..fff179386 100644
--- a/src/crossfade.c
+++ b/src/crossfade.c
@@ -91,6 +91,7 @@ static float mixramp_interpolate(char *ramp_list, float required_db)
unsigned cross_fade_calc(float duration, float total_time,
float mixramp_db, float mixramp_delay,
+ float replay_gain_db, float replay_gain_prev_db,
char *mixramp_start, char *mixramp_prev_end,
const struct audio_format *af,
const struct audio_format *old_format,
@@ -113,10 +114,9 @@ unsigned cross_fade_calc(float duration, float total_time,
if (isnan(mixramp_delay) || !(mixramp_start) || !(mixramp_prev_end)) {
chunks = (chunks_f * duration + 0.5);
} else {
- /* Calculate mixramp overlap.
- * FIXME factor in ReplayGain for both songs. */
- mixramp_overlap = mixramp_interpolate(mixramp_start, mixramp_db)
- + mixramp_interpolate(mixramp_prev_end, mixramp_db);
+ /* Calculate mixramp overlap. */
+ mixramp_overlap = mixramp_interpolate(mixramp_start, mixramp_db - replay_gain_db)
+ + mixramp_interpolate(mixramp_prev_end, mixramp_db - replay_gain_prev_db);
if (!isnan(mixramp_overlap) && (mixramp_delay <= mixramp_overlap)) {
chunks = (chunks_f * (mixramp_overlap - mixramp_delay));
g_debug("will overlap %d chunks, %fs", chunks,