diff options
author | 2010-05-26 21:40:28 -0700 | |
---|---|---|
committer | 2010-05-27 20:00:11 +0200 | |
commit | a91cc5615297f805245d1473e5e58a32f4990b3b (patch) | |
tree | 1c96e875b8e0d352f0977b89e9a4286f0bd20f44 | |
parent | e68ebdc183812edc60e5a3ccac833ab5789e85bc (diff) |
fix for inconsistent use of replaygain_xxxxx_gain field and incorrect handling of replaygain peak scale option
-rw-r--r-- | playlist.c | 4 | ||||
-rw-r--r-- | plugins/gtkui/trkproperties.c | 4 | ||||
-rw-r--r-- | streamer.c | 32 |
3 files changed, 20 insertions, 20 deletions
@@ -819,13 +819,13 @@ pl_process_cue_track (playItem_t *after, const char *fname, playItem_t **prev, c pl_add_meta (it, "year", date); } if (replaygain_album_gain[0]) { - it->replaygain_album_gain = db_to_amp (atof (replaygain_album_gain)); + it->replaygain_album_gain = atof (replaygain_album_gain); } if (replaygain_album_peak[0]) { it->replaygain_album_peak = atof (replaygain_album_peak); } if (replaygain_track_gain[0]) { - it->replaygain_track_gain = db_to_amp (atof (replaygain_track_gain)); + it->replaygain_track_gain = atof (replaygain_track_gain); } if (replaygain_track_peak[0]) { it->replaygain_track_peak = atof (replaygain_track_peak); diff --git a/plugins/gtkui/trkproperties.c b/plugins/gtkui/trkproperties.c index 80e343d6..3dca1718 100644 --- a/plugins/gtkui/trkproperties.c +++ b/plugins/gtkui/trkproperties.c @@ -176,14 +176,14 @@ trkproperties_fill_metadata (void) { gtk_list_store_set (propstore, &iter, 0, "Embedded Cuesheet", 1, (deadbeef->pl_get_item_flags (track) & DDB_HAS_EMBEDDED_CUESHEET) ? "Yes" : "No", -1); gtk_list_store_append (propstore, &iter); - snprintf (temp, sizeof (temp), "%0.2f dB", amp_to_db (track->replaygain_album_gain)); + snprintf (temp, sizeof (temp), "%0.2f dB", track->replaygain_album_gain); gtk_list_store_set (propstore, &iter, 0, "REPLAYGAIN_ALBUM_GAIN", 1, temp, -1); gtk_list_store_append (propstore, &iter); snprintf (temp, sizeof (temp), "%0.6f", track->replaygain_album_peak); gtk_list_store_set (propstore, &iter, 0, "REPLAYGAIN_ALBUM_PEAK", 1, temp, -1); gtk_list_store_append (propstore, &iter); - snprintf (temp, sizeof (temp), "%0.2f dB", amp_to_db (track->replaygain_track_gain)); + snprintf (temp, sizeof (temp), "%0.2f dB", track->replaygain_track_gain); gtk_list_store_set (propstore, &iter, 0, "REPLAYGAIN_TRACK_GAIN", 1, temp, -1); gtk_list_store_append (propstore, &iter); snprintf (temp, sizeof (temp), "%0.6f", track->replaygain_track_peak); @@ -1140,22 +1140,22 @@ apply_replay_gain_int16 (playItem_t *it, char *bytes, int size) { if (it->replaygain_track_gain == 0) { return; } + vol = db_to_amp (streaming_track->replaygain_track_gain) * 1000; if (conf_replaygain_scale && replaygain_scale) { - vol = db_to_amp (streaming_track->replaygain_track_gain)/streaming_track->replaygain_track_peak * 1000; - } - else { - vol = db_to_amp (streaming_track->replaygain_track_gain) * 1000; + if (vol * streaming_track->replaygain_track_peak > 1000) { + vol = 1000 / streaming_track->replaygain_track_peak; + } } } else if (conf_replaygain_mode == 2) { if (it->replaygain_album_gain == 0) { return; } + vol = db_to_amp (streaming_track->replaygain_album_gain) * 1000; if (conf_replaygain_scale && replaygain_scale) { - vol = db_to_amp (streaming_track->replaygain_album_gain)/streaming_track->replaygain_album_peak * 1000; - } - else { - vol = db_to_amp (streaming_track->replaygain_album_gain) * 1000; + if (vol * streaming_track->replaygain_album_peak > 1000) { + vol = 1000 / streaming_track->replaygain_album_peak; + } } } int16_t *s = (int16_t*)bytes; @@ -1182,22 +1182,22 @@ apply_replay_gain_float32 (playItem_t *it, char *bytes, int size) { if (it->replaygain_track_gain == 0) { return; } + vol = db_to_amp (it->replaygain_track_gain); if (conf_replaygain_scale && replaygain_scale) { - vol = db_to_amp (it->replaygain_track_gain)/it->replaygain_track_peak; - } - else { - vol = db_to_amp (it->replaygain_track_gain); + if (vol * it->replaygain_track_peak > 1.f) { + vol = 1.f / it->replaygain_track_peak; + } } } else if (conf_replaygain_mode == 2) { if (it->replaygain_album_gain == 0) { return; } + vol = db_to_amp (it->replaygain_album_gain); if (conf_replaygain_scale && replaygain_scale) { - vol = db_to_amp (it->replaygain_album_gain)/it->replaygain_album_peak; - } - else { - vol = db_to_amp (it->replaygain_album_gain); + if (vol * it->replaygain_album_peak > 1.f) { + vol = 1.f / it->replaygain_album_peak; + } } } float *s = (float*)bytes; |