diff options
author | Max Kellermann <max@musicpd.org> | 2016-11-24 16:52:31 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-11-24 17:34:57 +0100 |
commit | 1261327fa61fbf01adaab639bb012dae58ddab1a (patch) | |
tree | cded186fbde9eacef7ee8e931b25115de6995dd2 /src/ReplayGainInfo.hxx | |
parent | 09c3cc58e4bd7ce32f3c7368339f8fc537a0dbdf (diff) |
ReplayGainInfo: implement fallback in Get()
Eliminates Complete().
Diffstat (limited to 'src/ReplayGainInfo.hxx')
-rw-r--r-- | src/ReplayGainInfo.hxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ReplayGainInfo.hxx b/src/ReplayGainInfo.hxx index baa041bf7..432171b3f 100644 --- a/src/ReplayGainInfo.hxx +++ b/src/ReplayGainInfo.hxx @@ -57,19 +57,19 @@ struct ReplayGainInfo { } const ReplayGainTuple &Get(ReplayGainMode mode) const { - return tuples[mode]; + return mode == REPLAY_GAIN_ALBUM + ? (tuples[REPLAY_GAIN_ALBUM].IsDefined() + ? tuples[REPLAY_GAIN_ALBUM] + : tuples[REPLAY_GAIN_TRACK]) + : (tuples[REPLAY_GAIN_TRACK].IsDefined() + ? tuples[REPLAY_GAIN_TRACK] + : tuples[REPLAY_GAIN_ALBUM]); } void Clear() { tuples[REPLAY_GAIN_ALBUM].Clear(); tuples[REPLAY_GAIN_TRACK].Clear(); } - - /** - * Attempt to auto-complete missing data. In particular, if - * album information is missing, track gain is used. - */ - void Complete(); }; #endif |