aboutsummaryrefslogtreecommitdiffstats
path: root/src/ReplayGainInfo.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-25 19:05:49 +0200
committerMax Kellermann <max@duempel.org>2013-10-25 19:12:46 +0200
commitd6e28c42e5c2bdab73d3553b21a09fa28dabd037 (patch)
tree6b7e43d0b777b3be149c86e853debef3cbd49826 /src/ReplayGainInfo.cxx
parent6d475c40de567d778fa6f96c379687a8bf83f82b (diff)
downloadmpd-d6e28c42e5c2bdab73d3553b21a09fa28dabd037.tar.gz
mpd-d6e28c42e5c2bdab73d3553b21a09fa28dabd037.tar.xz
mpd-d6e28c42e5c2bdab73d3553b21a09fa28dabd037.zip
ReplayGainInfo: refactor to a class
Diffstat (limited to 'src/ReplayGainInfo.cxx')
-rw-r--r--src/ReplayGainInfo.cxx18
1 files changed, 9 insertions, 9 deletions
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];
}