Fix R128_*_GAIN values of 0 being incorrectly ignored
Remove nonZeroOrNull() from parseR128Adjustment() to allow raw R128 values of 0 to be properly converted to +5.0 dB adjustment. A value of 0 in R128_TRACK_GAIN or R128_ALBUM_GAIN means the file is already at -23 LUFS and should result in a +5 dB adjustment after conversion. Added tests for R128_TRACK_GAIN and R128_ALBUM_GAIN with zero values. Co-authored-by: OxygenCobalt <65370175+OxygenCobalt@users.noreply.github.com>
This commit is contained in:
co-authored by
OxygenCobalt
parent
ecb5892443
commit
2cab2f7e77
@@ -267,7 +267,7 @@ internal fun Metadata.replayGainAlbumAdjustment() =
|
||||
?: id3v2["TXXX:REPLAYGAIN_ALBUM_GAIN"]?.parseReplayGainAdjustment())
|
||||
|
||||
private fun List<String>.parseR128Adjustment() =
|
||||
first().replace(REPLAYGAIN_ADJUSTMENT_FILTER_REGEX, "").toFloatOrNull()?.nonZeroOrNull()?.run {
|
||||
first().replace(REPLAYGAIN_ADJUSTMENT_FILTER_REGEX, "").toFloatOrNull()?.run {
|
||||
// Convert to fixed-point and adjust to LUFS 18 to match the ReplayGain scale
|
||||
this / 256f + 5
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user