Subsonic icon indicating copy to clipboard operation
Subsonic copied to clipboard

Fix replaygain selection logic

Open flyingOwl opened this issue 2 years ago • 0 comments

A non-zero album gain should be used when "singleAlbum" or no track gain is set. In all other cases the track gain should be used.

With the current logic, you could be stuck with a replaygain of 0 even if everything seems to be setup correctly:

singleAlbum = true / false
rg.album = 0.0
rg.track = -10.15

Because rg.album == 0 was evaluated as true, we jumped into the if-path. This also happened when singleAlbum = false ("Use Track Gain" in the settings).

This fix changes the replaygain selection to match the provided comment:

singleAlbum = true;  rg.album set;   rg.track set     -> rg.album
singleAlbum = false; rg.album set;   rg.track set     -> rg.track
singleAlbum = true;  rg.album unset; rg.track set     -> rg.track
singleAlbum = false; rg.album unset; rg.track set     -> rg.track
singleAlbum = true;  rg.album set;   rg.track unset   -> rg.album
singleAlbum = false; rg.album set;   rg.track unset   -> rg.album
singleAlbum = true;  rg.album unset; rg.track unset   -> 0.0
singleAlbum = false; rg.album unset; rg.track unset   -> 0.0

flyingOwl avatar Sep 22 '22 07:09 flyingOwl