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:
@@ -33,16 +33,16 @@ ParseReplayGainTagTemplate(ReplayGainInfo &info, const T t)
|
||||
const char *value;
|
||||
|
||||
if ((value = t["replaygain_track_gain"]) != nullptr) {
|
||||
info.tuples[REPLAY_GAIN_TRACK].gain = atof(value);
|
||||
info.track.gain = atof(value);
|
||||
return true;
|
||||
} else if ((value = t["replaygain_album_gain"]) != nullptr) {
|
||||
info.tuples[REPLAY_GAIN_ALBUM].gain = atof(value);
|
||||
info.album.gain = atof(value);
|
||||
return true;
|
||||
} else if ((value = t["replaygain_track_peak"]) != nullptr) {
|
||||
info.tuples[REPLAY_GAIN_TRACK].peak = atof(value);
|
||||
info.track.peak = atof(value);
|
||||
return true;
|
||||
} else if ((value = t["replaygain_album_peak"]) != nullptr) {
|
||||
info.tuples[REPLAY_GAIN_ALBUM].peak = atof(value);
|
||||
info.album.peak = atof(value);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
|
@@ -82,12 +82,12 @@ rva2_apply_data(ReplayGainInfo &rgi,
|
||||
float volume_adjustment = rva2_float_volume_adjustment(data);
|
||||
|
||||
if (strcmp((const char *)id, "album") == 0) {
|
||||
rgi.tuples[REPLAY_GAIN_ALBUM].gain = volume_adjustment;
|
||||
rgi.album.gain = volume_adjustment;
|
||||
} else if (strcmp((const char *)id, "track") == 0) {
|
||||
rgi.tuples[REPLAY_GAIN_TRACK].gain = volume_adjustment;
|
||||
rgi.track.gain = volume_adjustment;
|
||||
} else {
|
||||
rgi.tuples[REPLAY_GAIN_ALBUM].gain = volume_adjustment;
|
||||
rgi.tuples[REPLAY_GAIN_TRACK].gain = volume_adjustment;
|
||||
rgi.album.gain = volume_adjustment;
|
||||
rgi.track.gain = volume_adjustment;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user