Merge pull request #722 from OxygenCobalt/dev

Version 3.4.1
This commit is contained in:
Alexander Capehart 2024-02-24 15:08:32 -07:00 committed by GitHub
commit ddc321893d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 56 additions and 35 deletions

View file

@ -1,5 +1,12 @@
# Changelog # Changelog
## 3.4.1
#### What's Fixed
- R128 adjustments are now adjusted to -18 LUFS to be consistent with MP3
- Fixed double application of opus base gain
- Fixed playback state not restoring
## 3.4.0 ## 3.4.0
#### What's New #### What's New

View file

@ -2,8 +2,8 @@
<h1 align="center"><b>Auxio</b></h1> <h1 align="center"><b>Auxio</b></h1>
<h4 align="center">A simple, rational music player for android.</h4> <h4 align="center">A simple, rational music player for android.</h4>
<p align="center"> <p align="center">
<a href="https://github.com/oxygencobalt/Auxio/releases/tag/v3.4.0"> <a href="https://github.com/oxygencobalt/Auxio/releases/tag/v3.4.1">
<img alt="Latest Version" src="https://img.shields.io/static/v1?label=tag&message=v3.4.0&color=64B5F6&style=flat"> <img alt="Latest Version" src="https://img.shields.io/static/v1?label=tag&message=v3.4.1&color=64B5F6&style=flat">
</a> </a>
<a href="https://github.com/oxygencobalt/Auxio/releases/"> <a href="https://github.com/oxygencobalt/Auxio/releases/">
<img alt="Releases" src="https://img.shields.io/github/downloads/OxygenCobalt/Auxio/total.svg?color=4B95DE&style=flat"> <img alt="Releases" src="https://img.shields.io/github/downloads/OxygenCobalt/Auxio/total.svg?color=4B95DE&style=flat">

View file

@ -21,8 +21,8 @@ android {
defaultConfig { defaultConfig {
applicationId namespace applicationId namespace
versionName "3.4.0" versionName "3.4.1"
versionCode 41 versionCode 42
minSdk 24 minSdk 24
targetSdk 34 targetSdk 34

View file

@ -222,13 +222,12 @@ class HomeFragment :
collect(detailModel.toShow.flow, ::handleShow) collect(detailModel.toShow.flow, ::handleShow)
} }
override fun onStart() { override fun onResume() {
super.onStart() super.onResume()
// Stock bottom sheet overlay won't work with our nested UI setup, have to replicate // Stock bottom sheet overlay won't work with our nested UI setup, have to replicate
// it ourselves. // it ourselves.
requireBinding().root.rootView.apply { requireBinding().root.rootView.apply {
post {
findViewById<View>(R.id.main_scrim).setOnTouchListener { _, event -> findViewById<View>(R.id.main_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event) handleSpeedDialBoundaryTouch(event)
} }
@ -237,7 +236,6 @@ class HomeFragment :
} }
} }
} }
}
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
val transition = enterTransition val transition = enterTransition

View file

@ -32,7 +32,7 @@ import org.oxycblt.auxio.music.info.Date
import org.oxycblt.auxio.music.metadata.correctWhitespace import org.oxycblt.auxio.music.metadata.correctWhitespace
import org.oxycblt.auxio.music.metadata.splitEscaped import org.oxycblt.auxio.music.metadata.splitEscaped
@Database(entities = [CachedSong::class], version = 38, exportSchema = false) @Database(entities = [CachedSong::class], version = 42, exportSchema = false)
abstract class CacheDatabase : RoomDatabase() { abstract class CacheDatabase : RoomDatabase() {
abstract fun cachedSongsDao(): CachedSongsDao abstract fun cachedSongsDao(): CachedSongsDao
} }

View file

@ -20,7 +20,6 @@ package org.oxycblt.auxio.music.metadata
import androidx.core.text.isDigitsOnly import androidx.core.text.isDigitsOnly
import androidx.media3.common.MediaItem import androidx.media3.common.MediaItem
import androidx.media3.common.MimeTypes
import androidx.media3.exoplayer.MetadataRetriever import androidx.media3.exoplayer.MetadataRetriever
import androidx.media3.exoplayer.source.MediaSource import androidx.media3.exoplayer.source.MediaSource
import androidx.media3.exoplayer.source.TrackGroupArray import androidx.media3.exoplayer.source.TrackGroupArray
@ -99,22 +98,26 @@ private class TagWorkerImpl(
populateWithId3v2(textTags.id3v2) populateWithId3v2(textTags.id3v2)
populateWithVorbis(textTags.vorbis) populateWithVorbis(textTags.vorbis)
// If this metadata is of a vorbis file, we actually need to extract it's base gain // OPUS base gain interpretation code: This is likely not needed, as the media player
// and divide it by 256 to get the gain in decibels. // should be using the base gain already. Uncomment if that's not the case.
if (format.sampleMimeType == MimeTypes.AUDIO_OPUS && // if (format.sampleMimeType == MimeTypes.AUDIO_OPUS
format.initializationData.isNotEmpty() && // && format.initializationData.isNotEmpty()
format.initializationData[0].size >= 18) { // && format.initializationData[0].size >= 18) {
val header = format.initializationData[0] // val header = format.initializationData[0]
val gain = (((header[16]).toInt() and 0xFF) or ((header[17].toInt() shl 8))) / 256f // val gain =
logD("Obtained opus base gain: $gain dB") // (((header[16]).toInt() and 0xFF) or ((header[17].toInt() shl 8)))
if (gain != 0f) { // .R128ToLUFS18()
logD("Applying opus base gain") // logD("Obtained opus base gain: $gain dB")
rawSong.replayGainTrackAdjustment = // if (gain != 0f) {
(rawSong.replayGainTrackAdjustment ?: 0f) + gain // logD("Applying opus base gain")
rawSong.replayGainAlbumAdjustment = // rawSong.replayGainTrackAdjustment =
(rawSong.replayGainAlbumAdjustment ?: 0f) + gain // (rawSong.replayGainTrackAdjustment ?: 0f) + gain
} // rawSong.replayGainAlbumAdjustment =
} // (rawSong.replayGainAlbumAdjustment ?: 0f) + gain
// } else {
// logD("Ignoring opus base gain")
// }
// }
} else { } else {
logD("No metadata could be extracted for ${rawSong.name}") logD("No metadata could be extracted for ${rawSong.name}")
} }
@ -317,14 +320,24 @@ private class TagWorkerImpl(
// the base adjustment intrinsic to the format to create the normalized adjustment. This is // the base adjustment intrinsic to the format to create the normalized adjustment. This is
// normally the only tag used for opus files, but some software still writes replay gain // normally the only tag used for opus files, but some software still writes replay gain
// tags anyway. // tags anyway.
(comments["r128_track_gain"]?.parseReplayGainAdjustment()?.div(256) (comments["r128_track_gain"]?.parseR128Adjustment()
?: comments["replaygain_track_gain"]?.parseReplayGainAdjustment()) ?: comments["replaygain_track_gain"]?.parseReplayGainAdjustment())
?.let { rawSong.replayGainTrackAdjustment = it } ?.let { rawSong.replayGainTrackAdjustment = it }
(comments["r128_album_gain"]?.parseReplayGainAdjustment()?.div(256) (comments["r128_album_gain"]?.parseR128Adjustment()
?: comments["replaygain_album_gain"]?.parseReplayGainAdjustment()) ?: comments["replaygain_album_gain"]?.parseReplayGainAdjustment())
?.let { rawSong.replayGainAlbumAdjustment = it } ?.let { rawSong.replayGainAlbumAdjustment = it }
} }
private fun List<String>.parseR128Adjustment() =
first()
.replace(REPLAYGAIN_ADJUSTMENT_FILTER_REGEX, "")
.toFloatOrNull()
?.nonZeroOrNull()
?.run {
// Convert to fixed-point and adjust to LUFS 18 to match the ReplayGain scale
this / 256f + 5
}
/** /**
* Parse a ReplayGain adjustment into a float value. * Parse a ReplayGain adjustment into a float value.
* *

View file

@ -418,12 +418,12 @@ class PlaybackStateManagerImpl @Inject constructor() : PlaybackStateManager {
} }
this.stateHolder = stateHolder this.stateHolder = stateHolder
if (isInitialized && stateMirror.index > -1) { if (isInitialized && currentSong != null) {
stateHolder.applySavedState(stateMirror.parent, stateMirror.rawQueue, null) stateHolder.applySavedState(stateMirror.parent, stateMirror.rawQueue, null)
stateHolder.seekTo(stateMirror.progression.calculateElapsedPositionMs()) stateHolder.seekTo(stateMirror.progression.calculateElapsedPositionMs())
stateHolder.playing(false) stateHolder.playing(false)
pendingDeferredPlayback?.let(stateHolder::handleDeferred)
} }
pendingDeferredPlayback?.let(stateHolder::handleDeferred)
} }
@Synchronized @Synchronized

View file

@ -0,0 +1,3 @@
Auxio 3.4.0 adds gapless playback and new widget designs, alongside a variety of fixes.
This release fixes critical issues with ReplayGain and playback persistence.
For more information, see https://github.com/OxygenCobalt/Auxio/releases/tag/v3.4.1