diff options
Diffstat (limited to '')
-rw-r--r-- | src/ReplayGainInfo.hxx | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/src/ReplayGainInfo.hxx b/src/ReplayGainInfo.hxx index 2b2d3d3db..8846a6ed3 100644 --- a/src/ReplayGainInfo.hxx +++ b/src/ReplayGainInfo.hxx @@ -21,6 +21,7 @@ #define MPD_REPLAY_GAIN_INFO_HXX #include "check.h" +#include "Compiler.h" #include <cmath> @@ -34,40 +35,35 @@ enum ReplayGainMode { struct ReplayGainTuple { float gain; float peak; -}; -struct ReplayGainInfo { - ReplayGainTuple tuples[2]; -}; + void Clear() { + gain = INFINITY; + peak = 0.0; + } -static inline void -replay_gain_tuple_init(ReplayGainTuple *tuple) -{ - tuple->gain = INFINITY; - tuple->peak = 0.0; -} + gcc_pure + bool IsDefined() const { + return !std::isinf(gain); + } -static inline void -replay_gain_info_init(struct ReplayGainInfo *info) -{ - replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_ALBUM]); - replay_gain_tuple_init(&info->tuples[REPLAY_GAIN_TRACK]); -} + gcc_pure + float CalculateScale(float preamp, float missing_preamp, + bool peak_limit) const; +}; -static inline bool -replay_gain_tuple_defined(const ReplayGainTuple *tuple) -{ - return !std::isinf(tuple->gain); -} +struct ReplayGainInfo { + ReplayGainTuple tuples[2]; -float -replay_gain_tuple_scale(const ReplayGainTuple *tuple, float preamp, float missing_preamp, bool peak_limit); + 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 -replay_gain_info_complete(ReplayGainInfo &info); + /** + * Attempt to auto-complete missing data. In particular, if + * album information is missing, track gain is used. + */ + void Complete(); +}; #endif |