diff options
author | Tim Phipps <mpd@phipps-hutton.freeserve.co.uk> | 2010-05-08 00:19:44 -0700 |
---|---|---|
committer | Avuton Olrich <avuton@gmail.com> | 2010-05-08 00:19:44 -0700 |
commit | 0ac5b6e613777bab093d1dbca1f3d6c80c48ca52 (patch) | |
tree | 167dbcd9c66cb60baf6ea61b0d501fdca4c71e98 /src/decoder_api.c | |
parent | eb5208c4f9e642c45b305f338c224cb65075840b (diff) | |
download | mpd-0ac5b6e613777bab093d1dbca1f3d6c80c48ca52.tar.gz mpd-0ac5b6e613777bab093d1dbca1f3d6c80c48ca52.tar.xz mpd-0ac5b6e613777bab093d1dbca1f3d6c80c48ca52.zip |
mixramp: Adjust MixRamp threshold to account for ReplayGain.
Diffstat (limited to 'src/decoder_api.c')
-rw-r--r-- | src/decoder_api.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/decoder_api.c b/src/decoder_api.c index 948ccb567..a951b07cf 100644 --- a/src/decoder_api.c +++ b/src/decoder_api.c @@ -27,6 +27,7 @@ #include "buffer.h" #include "pipe.h" #include "chunk.h" +#include "replay_gain_config.h" #include <glib.h> @@ -403,10 +404,11 @@ decoder_tag(G_GNUC_UNUSED struct decoder *decoder, struct input_stream *is, return cmd; } -void +float decoder_replay_gain(struct decoder *decoder, const struct replay_gain_info *replay_gain_info) { + float return_db = 0; assert(decoder != NULL); if (replay_gain_info != NULL) { @@ -414,6 +416,13 @@ decoder_replay_gain(struct decoder *decoder, if (++serial == 0) serial = 1; + if (REPLAY_GAIN_OFF != replay_gain_mode) { + return_db = 20.0 * log10f( + replay_gain_tuple_scale( + &replay_gain_info->tuples[replay_gain_mode], + replay_gain_preamp)); + } + decoder->replay_gain_info = *replay_gain_info; decoder->replay_gain_serial = serial; @@ -426,16 +435,19 @@ decoder_replay_gain(struct decoder *decoder, } } else decoder->replay_gain_serial = 0; + + return return_db; } void -decoder_mixramp(struct decoder *decoder, +decoder_mixramp(struct decoder *decoder, float replay_gain_db, char *mixramp_start, char *mixramp_end) { assert(decoder != NULL); struct decoder_control *dc = decoder->dc; assert(dc != NULL); + dc->replay_gain_db = replay_gain_db; dc_mixramp_start(dc, mixramp_start); dc_mixramp_end(dc, mixramp_end); } |