ReplayGainInfo: add static method Undefined()

This commit is contained in:
Max Kellermann 2019-09-13 19:46:39 +02:00
parent 5ef645df97
commit 496f88653d

View File

@ -38,6 +38,10 @@ struct ReplayGainTuple {
return gain > -100;
}
static constexpr ReplayGainTuple Undefined() noexcept {
return {-200.0f, 0.0f};
}
gcc_pure
float CalculateScale(const ReplayGainConfig &config) const noexcept;
};
@ -49,6 +53,13 @@ struct ReplayGainInfo {
return track.IsDefined() || album.IsDefined();
}
static constexpr ReplayGainInfo Undefined() noexcept {
return {
ReplayGainTuple::Undefined(),
ReplayGainTuple::Undefined(),
};
}
const ReplayGainTuple &Get(ReplayGainMode mode) const noexcept {
return mode == ReplayGainMode::ALBUM
? (album.IsDefined() ? album : track)