Skip to content

Commit

Permalink
playback: re-add replaygain off mode
Browse files Browse the repository at this point in the history
It was honestly foolish for me to recommend retagging.

Resolves #746.
  • Loading branch information
OxygenCobalt committed Apr 4, 2024
1 parent 6e05ef3 commit 124fe18
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/org/oxycblt/auxio/IntegerTable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,14 @@
</integer-array>

<string-array name="entries_replay_gain">
<item>@string/set_replay_gain_mode_off</item>
<item>@string/set_replay_gain_mode_track</item>
<item>@string/set_replay_gain_mode_album</item>
<item>@string/set_replay_gain_mode_dynamic</item>
</string-array>

<integer-array name="values_replay_gain">
<item>@integer/replay_gain_off</item>
<item>@integer/replay_gain_track</item>
<item>@integer/replay_gain_album</item>
<item>@integer/replay_gain_dynamic</item>
Expand All @@ -161,6 +163,7 @@
<integer name="play_song_from_genre">0xA122</integer>
<integer name="play_song_by_itself">0xA124</integer>

<integer name="replay_gain_off">0xA110</integer>
<integer name="replay_gain_track">0xA111</integer>
<integer name="replay_gain_album">0xA112</integer>
<integer name="replay_gain_dynamic">0xA113</integer>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@
<string name="set_repeat_pause_desc">Pause when a song repeats</string>
<string name="set_remember_pause">Remember pause</string>
<string name="set_remember_pause_desc">Remain playing/paused when skipping or editing queue</string>
<string name="set_replay_gain">ReplayGain</string>
<string name="set_replay_gain">Volume normalization</string>
<string name="set_replay_gain_mode">ReplayGain strategy</string>
<string name="set_replay_gain_mode_off">Off</string>
<string name="set_replay_gain_mode_track">Prefer track</string>
<string name="set_replay_gain_mode_album">Prefer album</string>
<string name="set_replay_gain_mode_dynamic">Prefer album if one is playing</string>
Expand Down

0 comments on commit 124fe18

Please sign in to comment.