From 496f88653d9166338d37fb94cc10cffd6af196d5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 13 Sep 2019 19:46:39 +0200 Subject: [PATCH] ReplayGainInfo: add static method Undefined() --- src/ReplayGainInfo.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ReplayGainInfo.hxx b/src/ReplayGainInfo.hxx index b2664abc3..685bfe9a0 100644 --- a/src/ReplayGainInfo.hxx +++ b/src/ReplayGainInfo.hxx @@ -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)