detail: add replaygain values to song properties
This should allow for clearer debugging.
This commit is contained in:
parent
5c85001b0c
commit
2af90c2427
4 changed files with 26 additions and 7 deletions
|
@ -38,6 +38,7 @@ import org.oxycblt.auxio.music.info.Name
|
||||||
import org.oxycblt.auxio.music.metadata.AudioProperties
|
import org.oxycblt.auxio.music.metadata.AudioProperties
|
||||||
import org.oxycblt.auxio.music.resolveNames
|
import org.oxycblt.auxio.music.resolveNames
|
||||||
import org.oxycblt.auxio.playback.formatDurationMs
|
import org.oxycblt.auxio.playback.formatDurationMs
|
||||||
|
import org.oxycblt.auxio.playback.replaygain.formatDb
|
||||||
import org.oxycblt.auxio.ui.ViewBindingMaterialDialogFragment
|
import org.oxycblt.auxio.ui.ViewBindingMaterialDialogFragment
|
||||||
import org.oxycblt.auxio.util.collectImmediately
|
import org.oxycblt.auxio.util.collectImmediately
|
||||||
import org.oxycblt.auxio.util.concatLocalized
|
import org.oxycblt.auxio.util.concatLocalized
|
||||||
|
@ -118,6 +119,12 @@ class SongDetailDialog : ViewBindingMaterialDialogFragment<DialogSongDetailBindi
|
||||||
SongProperty(
|
SongProperty(
|
||||||
R.string.lbl_sample_rate, getString(R.string.fmt_sample_rate, it)))
|
R.string.lbl_sample_rate, getString(R.string.fmt_sample_rate, it)))
|
||||||
}
|
}
|
||||||
|
song.replayGainAdjustment.track?.let {
|
||||||
|
add(SongProperty(R.string.lbl_replaygain_track, it.formatDb(context)))
|
||||||
|
}
|
||||||
|
song.replayGainAdjustment.album?.let {
|
||||||
|
add(SongProperty(R.string.lbl_replaygain_album, it.formatDb(context)))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
UpdateInstructions.Replace(0))
|
UpdateInstructions.Replace(0))
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import android.widget.TextView
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.math.abs
|
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.databinding.DialogPreAmpBinding
|
import org.oxycblt.auxio.databinding.DialogPreAmpBinding
|
||||||
import org.oxycblt.auxio.playback.PlaybackSettings
|
import org.oxycblt.auxio.playback.PlaybackSettings
|
||||||
|
@ -85,11 +84,6 @@ class PreAmpCustomizeDialog : ViewBindingMaterialDialogFragment<DialogPreAmpBind
|
||||||
// It is more clear to prepend a +/- before the pre-amp value to make it easier to
|
// It is more clear to prepend a +/- before the pre-amp value to make it easier to
|
||||||
// gauge how much it may be increasing the volume, however android does not add +
|
// gauge how much it may be increasing the volume, however android does not add +
|
||||||
// to positive float values when formatting them in a string. Instead, add it ourselves.
|
// to positive float values when formatting them in a string. Instead, add it ourselves.
|
||||||
ticker.text =
|
ticker.text = valueDb.formatDb(requireContext())
|
||||||
if (valueDb >= 0) {
|
|
||||||
getString(R.string.fmt_db_pos, valueDb)
|
|
||||||
} else {
|
|
||||||
getString(R.string.fmt_db_neg, abs(valueDb))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
|
|
||||||
package org.oxycblt.auxio.playback.replaygain
|
package org.oxycblt.auxio.playback.replaygain
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import kotlin.math.abs
|
||||||
import org.oxycblt.auxio.IntegerTable
|
import org.oxycblt.auxio.IntegerTable
|
||||||
|
import org.oxycblt.auxio.R
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current ReplayGain configuration.
|
* The current ReplayGain configuration.
|
||||||
|
@ -67,3 +70,16 @@ data class ReplayGainAdjustment(val track: Float?, val album: Float?)
|
||||||
* @author Alexander Capehart (OxygenCobalt)
|
* @author Alexander Capehart (OxygenCobalt)
|
||||||
*/
|
*/
|
||||||
data class ReplayGainPreAmp(val with: Float, val without: Float)
|
data class ReplayGainPreAmp(val with: Float, val without: Float)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a decibel value in a human-readable format.
|
||||||
|
*
|
||||||
|
* @param context The context to resolve resources from.
|
||||||
|
* @return A formatted decibel value. Will be prefixed by a + or - sign.
|
||||||
|
*/
|
||||||
|
fun Float.formatDb(context: Context) =
|
||||||
|
if (this >= 0) {
|
||||||
|
context.getString(R.string.fmt_db_pos, this)
|
||||||
|
} else {
|
||||||
|
context.getString(R.string.fmt_db_neg, abs(this))
|
||||||
|
}
|
||||||
|
|
|
@ -146,6 +146,8 @@
|
||||||
<string name="lbl_size">Size</string>
|
<string name="lbl_size">Size</string>
|
||||||
<string name="lbl_bitrate">Bit rate</string>
|
<string name="lbl_bitrate">Bit rate</string>
|
||||||
<string name="lbl_sample_rate">Sample rate</string>
|
<string name="lbl_sample_rate">Sample rate</string>
|
||||||
|
<string name="lbl_replaygain_track">ReplayGain Track Adjustment</string>
|
||||||
|
<string name="lbl_replaygain_album">ReplayGain Album Adjustment</string>
|
||||||
|
|
||||||
<!-- Limit to 10 characters -->
|
<!-- Limit to 10 characters -->
|
||||||
<string name="lbl_shuffle_shortcut_short">Shuffle</string>
|
<string name="lbl_shuffle_shortcut_short">Shuffle</string>
|
||||||
|
|
Loading…
Reference in a new issue