ReplayGainInfo: don't use array in struct ReplayGainInfo

Declare two named elements.  An enum should not be used as an array
index, as this is error prone.
This commit is contained in:
Max Kellermann
2016-11-24 16:45:56 +01:00
parent 1261327fa6
commit 25e58df5e0
9 changed files with 29 additions and 34 deletions

View File

@@ -170,10 +170,10 @@ mpcdec_decode(DecoderClient &client, InputStream &is)
ReplayGainInfo rgi;
rgi.Clear();
rgi.tuples[REPLAY_GAIN_ALBUM].gain = MPC_OLD_GAIN_REF - (info.gain_album / 256.);
rgi.tuples[REPLAY_GAIN_ALBUM].peak = pow(10, info.peak_album / 256. / 20) / 32767;
rgi.tuples[REPLAY_GAIN_TRACK].gain = MPC_OLD_GAIN_REF - (info.gain_title / 256.);
rgi.tuples[REPLAY_GAIN_TRACK].peak = pow(10, info.peak_title / 256. / 20) / 32767;
rgi.album.gain = MPC_OLD_GAIN_REF - (info.gain_album / 256.);
rgi.album.peak = pow(10, info.peak_album / 256. / 20) / 32767;
rgi.track.gain = MPC_OLD_GAIN_REF - (info.gain_title / 256.);
rgi.track.peak = pow(10, info.peak_title / 256. / 20) / 32767;
client.SubmitReplayGain(&rgi);