ReplayGainInfo: add method Get()

This commit is contained in:
Max Kellermann 2016-11-24 16:50:55 +01:00
parent 7ef31f84a7
commit 09c3cc58e4
3 changed files with 6 additions and 2 deletions

View File

@ -56,6 +56,10 @@ struct ReplayGainInfo {
tuples[REPLAY_GAIN_TRACK].IsDefined(); tuples[REPLAY_GAIN_TRACK].IsDefined();
} }
const ReplayGainTuple &Get(ReplayGainMode mode) const {
return tuples[mode];
}
void Clear() { void Clear() {
tuples[REPLAY_GAIN_ALBUM].Clear(); tuples[REPLAY_GAIN_ALBUM].Clear();
tuples[REPLAY_GAIN_TRACK].Clear(); tuples[REPLAY_GAIN_TRACK].Clear();

View File

@ -597,7 +597,7 @@ DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info)
if (rgm != REPLAY_GAIN_ALBUM) if (rgm != REPLAY_GAIN_ALBUM)
rgm = REPLAY_GAIN_TRACK; rgm = REPLAY_GAIN_TRACK;
const auto &tuple = new_replay_gain_info->tuples[rgm]; const auto &tuple = new_replay_gain_info->Get(rgm);
const auto scale = const auto scale =
tuple.CalculateScale(replay_gain_preamp, tuple.CalculateScale(replay_gain_preamp,
replay_gain_missing_preamp, replay_gain_missing_preamp,

View File

@ -140,7 +140,7 @@ ReplayGainFilter::Update()
{ {
unsigned volume = PCM_VOLUME_1; unsigned volume = PCM_VOLUME_1;
if (mode != REPLAY_GAIN_OFF) { if (mode != REPLAY_GAIN_OFF) {
const auto &tuple = info.tuples[mode]; const auto &tuple = info.Get(mode);
float scale = tuple.CalculateScale(replay_gain_preamp, float scale = tuple.CalculateScale(replay_gain_preamp,
replay_gain_missing_preamp, replay_gain_missing_preamp,
replay_gain_limit); replay_gain_limit);