Skip to content

ReplayGain Regression - Fallback Behavior #3323

@Lasagnenator

Description

@Lasagnenator

Describe the bug
Commit 2c6fa6f incorrectly changed the ReplayGain fallback behavior. See src/replaygain.c for the specific part that matters.

For example:
A track lacking album gain will have settings->albumgain = db_to_amp((float)atof (trackgain)); but it won't be used because settings->has_album_gain = 1; was never run. If the ReplayGain source mode is set to Album, then the file is treated like there is no album gain.

To Reproduce
Steps to reproduce the behavior:

  1. Have a file with track gain and no album gain.
  2. Set ReplayGain source mode to "Album".
  3. Play the file.
  4. Track will play with "Preamp without RG info" value.

Expected behavior
ReplayGain should fallback to the album/track value if the other is missing as per #1856.

Desktop:
I don't think this matters but for completeness:

  • OS: Linux Mint 22.3 (Cinnamon)
  • Deadbeef Version 1.10.2. Problem introduced in 1.10.1 and exists in current git master here

Code snippet of problem:

    if (albumgain) {
        settings->has_album_gain = 1;
    }
    if (trackgain) {
        settings->has_track_gain = 1;
    }

    if (settings->processing_flags & DDB_RG_PROCESSING_GAIN) {
        if (albumgain) {
            settings->albumgain = db_to_amp((float)atof (albumgain));
        }
        else if (trackgain) {
            settings->albumgain = db_to_amp((float)atof (trackgain));
        }

        if (trackgain) {
            settings->trackgain = db_to_amp((float)atof (trackgain));
        }
        else if (albumgain) {
            settings->trackgain = db_to_amp((float)atof (albumgain));
        }
    }

Code snippet of previously working code:

    if (settings->processing_flags & DDB_RG_PROCESSING_GAIN) {
        if (albumgain) {
            settings->albumgain = db_to_amp((float)atof (albumgain));
            settings->has_album_gain = 1;
        }
        else if (trackgain) {
            settings->albumgain = db_to_amp((float)atof (trackgain));
            settings->has_album_gain = 1;
        }

        if (trackgain) {
            settings->trackgain = db_to_amp((float)atof (trackgain));
            settings->has_track_gain = 1;
        }
        else if (albumgain) {
            settings->trackgain = db_to_amp((float)atof (albumgain));
            settings->has_track_gain = 1;
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions