diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-04 15:21:44 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-04 15:21:44 +0000 |
commit | d1766a1510b6092fa8ea0e644fdd1c1e508d9c4d (patch) | |
tree | 644a546ce4baf2b4618837d7bc9f774d0c9545ed /apps/replaygain.c | |
parent | f0132528fdc3a966e3d5efba0fb720faabca241b (diff) |
Rework parts of the replaygain code to be able to differentiate between 0.00 dB set intentionally and having no replaygain information at all. Bump codec api.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29679 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/replaygain.c')
-rw-r--r-- | apps/replaygain.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/apps/replaygain.c b/apps/replaygain.c index 7875e06e72..5eb745a5f1 100644 --- a/apps/replaygain.c +++ b/apps/replaygain.c @@ -118,7 +118,7 @@ static long fp_atof(const char* s, int precision) + (((int64_t) frac_part * int_one) / frac_max_int)); } -long convert_gain(long gain) +static long convert_gain(long gain) { /* Don't allow unreasonably low or high gain changes. * Our math code can't handle it properly anyway. :) */ @@ -171,13 +171,15 @@ void parse_replaygain(const char* key, const char* value, (strcasecmp(key, "rg_radio") == 0)) && !entry->track_gain) { - entry->track_gain = get_replaygain(value); + entry->track_level = get_replaygain(value); + entry->track_gain = convert_gain(entry->track_level); } else if (((strcasecmp(key, "replaygain_album_gain") == 0) || (strcasecmp(key, "rg_audiophile") == 0)) && !entry->album_gain) { - entry->album_gain = get_replaygain(value); + entry->album_level = get_replaygain(value); + entry->album_gain = convert_gain(entry->album_level); } else if (((strcasecmp(key, "replaygain_track_peak") == 0) || (strcasecmp(key, "rg_peak") == 0)) && @@ -207,12 +209,14 @@ void parse_replaygain_int(bool album, long gain, long peak, if (album) { - entry->album_gain = gain; - entry->album_peak = peak; + entry->album_level = gain; + entry->album_gain = convert_gain(gain); + entry->album_peak = peak; } else { - entry->track_gain = gain; - entry->track_peak = peak; + entry->track_level = gain; + entry->track_gain = convert_gain(gain); + entry->track_peak = peak; } } |