From d6e28c42e5c2bdab73d3553b21a09fa28dabd037 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 25 Oct 2013 19:05:49 +0200 Subject: ReplayGainInfo: refactor to a class --- src/ReplayGainInfo.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/ReplayGainInfo.cxx') diff --git a/src/ReplayGainInfo.cxx b/src/ReplayGainInfo.cxx index 6ad9d269e..7ee788e04 100644 --- a/src/ReplayGainInfo.cxx +++ b/src/ReplayGainInfo.cxx @@ -21,18 +21,19 @@ #include "ReplayGainInfo.hxx" float -replay_gain_tuple_scale(const ReplayGainTuple *tuple, float preamp, float missing_preamp, bool peak_limit) +ReplayGainTuple::CalculateScale(float preamp, float missing_preamp, + bool peak_limit) const { float scale; - if (replay_gain_tuple_defined(tuple)) { - scale = pow(10.0, tuple->gain / 20.0); + if (IsDefined()) { + scale = pow(10.0, gain / 20.0); scale *= preamp; if (scale > 15.0) scale = 15.0; - if (peak_limit && scale * tuple->peak > 1.0) - scale = 1.0 / tuple->peak; + if (peak_limit && scale * peak > 1.0) + scale = 1.0 / peak; } else scale = missing_preamp; @@ -40,9 +41,8 @@ replay_gain_tuple_scale(const ReplayGainTuple *tuple, float preamp, float missin } void -replay_gain_info_complete(ReplayGainInfo &info) +ReplayGainInfo::Complete() { - if (!replay_gain_tuple_defined(&info.tuples[REPLAY_GAIN_ALBUM])) - info.tuples[REPLAY_GAIN_ALBUM] = - info.tuples[REPLAY_GAIN_TRACK]; + if (!tuples[REPLAY_GAIN_ALBUM].IsDefined()) + tuples[REPLAY_GAIN_ALBUM] = tuples[REPLAY_GAIN_TRACK]; } -- cgit v1.2.3