diff options
author | Daniel Seuthe <daniel+mpd@seuthe.org> | 2010-05-30 17:05:43 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-05-30 17:06:08 +0200 |
commit | e8310211e216a1de0b4e856496633966d106b831 (patch) | |
tree | a117c252f846b944a73a85f3f8c3299f0e7eb594 /src/replay_gain_info.c | |
parent | 3709b9aa11328c50dff9f7742ce8b5ef967d5d4d (diff) | |
download | mpd-e8310211e216a1de0b4e856496633966d106b831.tar.gz mpd-e8310211e216a1de0b4e856496633966d106b831.tar.xz mpd-e8310211e216a1de0b4e856496633966d106b831.zip |
filter/replay_gain: added option "replaygain_limit"
Diffstat (limited to 'src/replay_gain_info.c')
-rw-r--r-- | src/replay_gain_info.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/replay_gain_info.c b/src/replay_gain_info.c index 9ab5b05fa..66f46def2 100644 --- a/src/replay_gain_info.c +++ b/src/replay_gain_info.c @@ -21,17 +21,23 @@ #include "replay_gain_info.h" float -replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp) +replay_gain_tuple_scale(const struct replay_gain_tuple *tuple, float preamp, float missing_preamp, bool peak_limit) { float scale; - scale = pow(10.0, tuple->gain / 20.0); - scale *= preamp; - if (scale > 15.0) - scale = 15.0; + if (replay_gain_tuple_defined(tuple)) + { + scale = pow(10.0, tuple->gain / 20.0); + scale *= preamp; + if (scale > 15.0) + scale = 15.0; - if (scale * tuple->peak > 1.0) - scale = 1.0 / tuple->peak; + if (peak_limit) + if (scale * tuple->peak > 1.0) + scale = 1.0 / tuple->peak; + } else { + scale = missing_preamp; + } return scale; } |