playback: re-add replaygain off mode

It was honestly foolish for me to recommend retagging.

Resolves #746.
This commit is contained in:
Alexander Capehart
2024-04-07 23:25:53 -06:00
parent dc51c84c54
commit da07be26f4
5 changed files with 14 additions and 2 deletions
@@ -102,7 +102,7 @@ object IntegerTable {
/** Sort.Mode.ByDateAdded */
const val SORT_BY_DATE_ADDED = 0xA118
/** ReplayGainMode.Off (No longer used but still reserved) */
// const val REPLAY_GAIN_MODE_OFF = 0xA110
const val REPLAY_GAIN_MODE_OFF = 0xA110
/** ReplayGainMode.Track */
const val REPLAY_GAIN_MODE_TRACK = 0xA111
/** ReplayGainMode.Album */
@@ -29,6 +29,8 @@ import org.oxycblt.auxio.R
* @author Alexander Capehart (OxygenCobalt)
*/
enum class ReplayGainMode {
/** Do not apply any ReplayGain adjustments. */
OFF,
/** Apply the track gain, falling back to the album gain if the track gain is not found. */
TRACK,
/** Apply the album gain, falling back to the track gain if the album gain is not found. */
@@ -45,6 +47,7 @@ enum class ReplayGainMode {
*/
fun fromIntCode(intCode: Int) =
when (intCode) {
IntegerTable.REPLAY_GAIN_MODE_OFF -> OFF
IntegerTable.REPLAY_GAIN_MODE_TRACK -> TRACK
IntegerTable.REPLAY_GAIN_MODE_ALBUM -> ALBUM
IntegerTable.REPLAY_GAIN_MODE_DYNAMIC -> DYNAMIC
@@ -119,6 +119,11 @@ constructor(
// ReplayGain is configurable, so determine what to do based off of the mode.
val resolvedAdjustment =
when (playbackSettings.replayGainMode) {
// User wants no adjustment.
ReplayGainMode.OFF -> {
logD("ReplayGain is off")
null
}
// User wants track gain to be preferred. Default to album gain only if
// there is no track gain.
ReplayGainMode.TRACK -> {