replaygain: add reset button to pre-amp dialog

Add a button to reset the pre-amp to it's default setting.

This way, you don't have to specifically seek to the 0 dB value in the
dialog in order to reset it.
This commit is contained in:
Alexander Capehart 2023-01-01 12:28:23 -07:00
parent 1f5594fb33
commit 80e85bfffa
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
5 changed files with 10 additions and 8 deletions

View file

@ -9,6 +9,7 @@
- Formalized whitespace handling - Formalized whitespace handling
- Value lists are now properly localized - Value lists are now properly localized
- Queue no longer primarily shows previous songs when opened - Queue no longer primarily shows previous songs when opened
- Added reset button to ReplayGain pre-amp configuration dialog
#### What's Changed #### What's Changed
- R128 Gain tags are now only used when playing OPUS files - R128 Gain tags are now only used when playing OPUS files

View file

@ -24,7 +24,7 @@ import com.google.android.exoplayer2.metadata.vorbis.VorbisComment
import org.oxycblt.auxio.music.parsing.correctWhitespace import org.oxycblt.auxio.music.parsing.correctWhitespace
/** /**
* Processing wrapper for [Metadata] that allows access to more organized metadata. * Processing wrapper for [Metadata] that allows access to more organized music tags.
* @param metadata The [Metadata] to wrap. * @param metadata The [Metadata] to wrap.
* @author Alexander Capehart (OxygenCobalt) * @author Alexander Capehart (OxygenCobalt)
*/ */
@ -40,9 +40,6 @@ class Tags(metadata: Metadata) {
get() = _vorbis get() = _vorbis
init { init {
// ExoPlayer only exposes ID3v2 and Vorbis metadata, which constitutes the vast majority
// of audio formats. Load both of these types of tags into separate maps, letting the
// "source of truth" be the last of a particular tag in a file.
for (i in 0 until metadata.length()) { for (i in 0 until metadata.length()) {
when (val tag = metadata[i]) { when (val tag = metadata[i]) {
is TextInformationFrame -> { is TextInformationFrame -> {

View file

@ -514,8 +514,7 @@ class Indexer private constructor() {
* system to load audio. * system to load audio.
*/ */
val PERMISSION_READ_AUDIO = val PERMISSION_READ_AUDIO =
// TODO: Move elsewhere. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
// READ_EXTERNAL_STORAGE was superseded by READ_MEDIA_AUDIO in Android 13 // READ_EXTERNAL_STORAGE was superseded by READ_MEDIA_AUDIO in Android 13
Manifest.permission.READ_MEDIA_AUDIO Manifest.permission.READ_MEDIA_AUDIO
} else { } else {

View file

@ -42,6 +42,9 @@ class PreAmpCustomizeDialog : ViewBindingDialogFragment<DialogPreAmpBinding>() {
Settings(requireContext()).replayGainPreAmp = Settings(requireContext()).replayGainPreAmp =
ReplayGainPreAmp(binding.withTagsSlider.value, binding.withoutTagsSlider.value) ReplayGainPreAmp(binding.withTagsSlider.value, binding.withoutTagsSlider.value)
} }
.setNeutralButton(R.string.lbl_reset) { _, _ ->
Settings(requireContext()).replayGainPreAmp = ReplayGainPreAmp(0f, 0f)
}
.setNegativeButton(R.string.lbl_cancel, null) .setNegativeButton(R.string.lbl_cancel, null)
} }

View file

@ -125,10 +125,12 @@
<string name="lbl_ok">OK</string> <string name="lbl_ok">OK</string>
<string name="lbl_cancel">Cancel</string> <string name="lbl_cancel">Cancel</string>
<!-- As in to save a setting -->
<string name="lbl_save">Save</string>
<!-- as in to reset to a default setting -->
<string name="lbl_reset">Reset</string>
<!-- As in to add a new folder in the "Music folders" setting --> <!-- As in to add a new folder in the "Music folders" setting -->
<string name="lbl_add">Add</string> <string name="lbl_add">Add</string>
<!-- As in to save the "Music folders" setting -->
<string name="lbl_save">Save</string>
<!-- Referring to playback state --> <!-- Referring to playback state -->
<string name="lbl_state_saved">State saved</string> <string name="lbl_state_saved">State saved</string>