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
## 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
#### What's New

View file

@ -2,8 +2,8 @@
<h1 align="center"><b>Auxio</b></h1>
<h4 align="center">A simple, rational music player for android.</h4>
<p align="center">
<a href="https://github.com/oxygencobalt/Auxio/releases/tag/v3.4.0">
<img alt="Latest Version" src="https://img.shields.io/static/v1?label=tag&message=v3.4.0&color=64B5F6&style=flat">
<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.1&color=64B5F6&style=flat">
</a>
<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">

View file

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

View file

@ -222,19 +222,17 @@ class HomeFragment :
collect(detailModel.toShow.flow, ::handleShow)
}
override fun onStart() {
super.onStart()
override fun onResume() {
super.onResume()
// Stock bottom sheet overlay won't work with our nested UI setup, have to replicate
// it ourselves.
requireBinding().root.rootView.apply {
post {
findViewById<View>(R.id.main_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event)
}
findViewById<View>(R.id.sheet_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event)
}
findViewById<View>(R.id.main_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event)
}
findViewById<View>(R.id.sheet_scrim).setOnTouchListener { _, event ->
handleSpeedDialBoundaryTouch(event)
}
}
}

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.splitEscaped
@Database(entities = [CachedSong::class], version = 38, exportSchema = false)
@Database(entities = [CachedSong::class], version = 42, exportSchema = false)
abstract class CacheDatabase : RoomDatabase() {
abstract fun cachedSongsDao(): CachedSongsDao
}

View file

@ -20,7 +20,6 @@ package org.oxycblt.auxio.music.metadata
import androidx.core.text.isDigitsOnly
import androidx.media3.common.MediaItem
import androidx.media3.common.MimeTypes
import androidx.media3.exoplayer.MetadataRetriever
import androidx.media3.exoplayer.source.MediaSource
import androidx.media3.exoplayer.source.TrackGroupArray
@ -99,22 +98,26 @@ private class TagWorkerImpl(
populateWithId3v2(textTags.id3v2)
populateWithVorbis(textTags.vorbis)
// If this metadata is of a vorbis file, we actually need to extract it's base gain
// and divide it by 256 to get the gain in decibels.
if (format.sampleMimeType == MimeTypes.AUDIO_OPUS &&
format.initializationData.isNotEmpty() &&
format.initializationData[0].size >= 18) {
val header = format.initializationData[0]
val gain = (((header[16]).toInt() and 0xFF) or ((header[17].toInt() shl 8))) / 256f
logD("Obtained opus base gain: $gain dB")
if (gain != 0f) {
logD("Applying opus base gain")
rawSong.replayGainTrackAdjustment =
(rawSong.replayGainTrackAdjustment ?: 0f) + gain
rawSong.replayGainAlbumAdjustment =
(rawSong.replayGainAlbumAdjustment ?: 0f) + gain
}
}
// OPUS base gain interpretation code: This is likely not needed, as the media player
// should be using the base gain already. Uncomment if that's not the case.
// if (format.sampleMimeType == MimeTypes.AUDIO_OPUS
// && format.initializationData.isNotEmpty()
// && format.initializationData[0].size >= 18) {
// val header = format.initializationData[0]
// val gain =
// (((header[16]).toInt() and 0xFF) or ((header[17].toInt() shl 8)))
// .R128ToLUFS18()
// logD("Obtained opus base gain: $gain dB")
// if (gain != 0f) {
// logD("Applying opus base gain")
// rawSong.replayGainTrackAdjustment =
// (rawSong.replayGainTrackAdjustment ?: 0f) + gain
// rawSong.replayGainAlbumAdjustment =
// (rawSong.replayGainAlbumAdjustment ?: 0f) + gain
// } else {
// logD("Ignoring opus base gain")
// }
// }
} else {
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
// normally the only tag used for opus files, but some software still writes replay gain
// tags anyway.
(comments["r128_track_gain"]?.parseReplayGainAdjustment()?.div(256)
(comments["r128_track_gain"]?.parseR128Adjustment()
?: comments["replaygain_track_gain"]?.parseReplayGainAdjustment())
?.let { rawSong.replayGainTrackAdjustment = it }
(comments["r128_album_gain"]?.parseReplayGainAdjustment()?.div(256)
(comments["r128_album_gain"]?.parseR128Adjustment()
?: comments["replaygain_album_gain"]?.parseReplayGainAdjustment())
?.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.
*

View file

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