--------------------------------------------------------------------- audacious-3.9/src/libaudcore/audio.h ### BEFORE ### struct ReplayGainInfo { float track_gain; /* dB */ float track_peak; /* 0-1 */ float album_gain; /* dB */ float album_peak; /* 0-1 */ }; ### AFTER ### struct ReplayGainInfo { float track_gain; /* dB */ float track_peak; /* 0-1 */ float album_gain; /* dB */ float album_peak; /* 0-1 */ int track_gain_is_set; /* true or false */ int album_gain_is_set; /* true or false */ }; --------------------------------------------------------------------- audacious-3.9/src/libaudcore/tuple.cc ### BEFORE ### EXPORT ReplayGainInfo Tuple::get_replay_gain () const { ReplayGainInfo gain {}; […] return gain; } ### AFTER ### EXPORT ReplayGainInfo Tuple::get_replay_gain () const { ReplayGainInfo gain {}; […] gain.album_gain_is_set = (data->is_set (AlbumGain)) ? 1 : 0; gain.track_gain_is_set = (data->is_set (TrackGain)) ? 1 : 0; return gain; } --------------------------------------------------------------------- audacious-3.9/src/libaudcore/output.cc ### BEFORE ### static bool s_gain; /* replay gain info set */ ### AFTER ### // line removed ### BEFORE ### static void apply_replay_gain (Index & data) { if (! aud_get_bool (0, "enable_replay_gain")) return; float factor = powf (10, aud_get_double (0, "replay_gain_preamp") / 20); if (s_gain) { float peak; auto mode = (ReplayGainMode) aud_get_int (0, "replay_gain_mode"); if ((mode == ReplayGainMode::Album) || (mode == ReplayGainMode::Automatic && (! aud_get_bool (0, "shuffle") || aud_get_bool (0, "album_shuffle")))) { factor *= powf (10, gain_info.album_gain / 20); peak = gain_info.album_peak; } else { factor *= powf (10, gain_info.track_gain / 20); peak = gain_info.track_peak; } if (aud_get_bool (0, "enable_clipping_prevention") && peak * factor > 1) factor = 1 / peak; } else factor *= powf (10, aud_get_double (0, "default_gain") / 20); if (factor < 0.99 || factor > 1.01) audio_amplify (data.begin (), 1, data.len (), & factor); } ### AFTER ### static void apply_replay_gain (Index & data) { if (! aud_get_bool (0, "enable_replay_gain")) return; float factor = powf (10, aud_get_double (0, "replay_gain_preamp") / 20); float peak; auto mode = (ReplayGainMode) aud_get_int (0, "replay_gain_mode"); if ( ((mode == ReplayGainMode::Album) || (mode == ReplayGainMode::Automatic && (! aud_get_bool (0, "shuffle") || aud_get_bool (0, "album_shuffle")))) && (gain_info.album_gain_is_set)) { factor *= powf (10, gain_info.album_gain / 20); peak = gain_info.album_peak; if (aud_get_bool (0, "enable_clipping_prevention") && peak * factor > 1) factor = 1 / peak; } else { if (gain_info.track_gain_is_set) { factor *= powf (10, gain_info.track_gain / 20); peak = gain_info.track_peak; if (aud_get_bool (0, "enable_clipping_prevention") && peak * factor > 1) factor = 1 / peak; } else factor *= powf (10, aud_get_double (0, "default_gain") / 20); } if (factor < 0.99 || factor > 1.01) audio_amplify (data.begin (), 1, data.len (), & factor); } ### BEFORE ### s_gain = s_paused = s_flushed = false; ### AFTER ### s_paused = s_flushed = false; ### BEFORE ### s_gain = true; ### AFTER ### // line removed --------------------------------------------------------------------- src/vorbis/vorbis.cc ### BEFORE ### static bool update_replay_gain (OggVorbis_File * vf, ReplayGainInfo * rg_info) { const char *rg_gain, *rg_peak; vorbis_comment * comment = ov_comment (vf, -1); if (! comment) return false; rg_gain = vorbis_comment_query(comment, "REPLAYGAIN_ALBUM_GAIN", 0); if (!rg_gain) rg_gain = vorbis_comment_query(comment, "RG_AUDIOPHILE", 0); /* Old */ rg_info->album_gain = (rg_gain != nullptr) ? str_to_double (rg_gain) : 0.0; AUDDBG ("Album gain: %s (%f)\n", rg_gain, rg_info->album_gain); rg_gain = vorbis_comment_query(comment, "REPLAYGAIN_TRACK_GAIN", 0); if (!rg_gain) rg_gain = vorbis_comment_query(comment, "RG_RADIO", 0); /* Old */ rg_info->track_gain = (rg_gain != nullptr) ? str_to_double (rg_gain) : 0.0; AUDDBG ("Track gain: %s (%f)\n", rg_gain, rg_info->track_gain); rg_peak = vorbis_comment_query(comment, "REPLAYGAIN_ALBUM_PEAK", 0); rg_info->album_peak = rg_peak != nullptr ? str_to_double (rg_peak) : 0.0; AUDDBG ("Album peak: %s (%f)\n", rg_peak, rg_info->album_peak); rg_peak = vorbis_comment_query(comment, "REPLAYGAIN_TRACK_PEAK", 0); if (!rg_peak) rg_peak = vorbis_comment_query(comment, "RG_PEAK", 0); /* Old */ rg_info->track_peak = rg_peak != nullptr ? str_to_double (rg_peak) : 0.0; AUDDBG ("Track peak: %s (%f)\n", rg_peak, rg_info->track_peak); return true; } ### AFTER ### static bool update_replay_gain (OggVorbis_File * vf, ReplayGainInfo * rg_info) { const char *rg_gain, *rg_peak; vorbis_comment * comment = ov_comment (vf, -1); if (! comment) return false; rg_gain = vorbis_comment_query(comment, "REPLAYGAIN_ALBUM_GAIN", 0); if (!rg_gain) rg_gain = vorbis_comment_query(comment, "RG_AUDIOPHILE", 0); /* Old */ rg_info->album_gain = (rg_gain != nullptr) ? str_to_double (rg_gain) : 0.0; AUDDBG ("Album gain: %s (%f)\n", rg_gain, rg_info->album_gain); rg_info->album_gain_is_set = (rg_gain != nullptr) ? 1 : 0; rg_gain = vorbis_comment_query(comment, "REPLAYGAIN_TRACK_GAIN", 0); if (!rg_gain) rg_gain = vorbis_comment_query(comment, "RG_RADIO", 0); /* Old */ rg_info->track_gain = (rg_gain != nullptr) ? str_to_double (rg_gain) : 0.0; AUDDBG ("Track gain: %s (%f)\n", rg_gain, rg_info->track_gain); rg_info->track_gain_is_set = (rg_gain != nullptr) ? 1 : 0; rg_peak = vorbis_comment_query(comment, "REPLAYGAIN_ALBUM_PEAK", 0); rg_info->album_peak = rg_peak != nullptr ? str_to_double (rg_peak) : 0.0; AUDDBG ("Album peak: %s (%f)\n", rg_peak, rg_info->album_peak); rg_peak = vorbis_comment_query(comment, "REPLAYGAIN_TRACK_PEAK", 0); if (!rg_peak) rg_peak = vorbis_comment_query(comment, "RG_PEAK", 0); /* Old */ rg_info->track_peak = rg_peak != nullptr ? str_to_double (rg_peak) : 0.0; AUDDBG ("Track peak: %s (%f)\n", rg_peak, rg_info->track_peak); return true; } ---------------------------------------------------------------------