diff options
author | Thom Johansen <thomj@rockbox.org> | 2007-02-27 17:55:38 +0000 |
---|---|---|
committer | Thom Johansen <thomj@rockbox.org> | 2007-02-27 17:55:38 +0000 |
commit | 92e6bcbe17d56d9acb50c52edc8f55233156ae8f (patch) | |
tree | dd8cf11499ecee213c91cf097c8514f8472badd1 | |
parent | 9636c1b61eb93897bffd4db96ddc9678c6aff245 (diff) |
Fix old bug where applying a crossfeed direct gain of 0 dB would result in negative gain.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12508 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/dsp.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/apps/dsp.c b/apps/dsp.c index cca94ae075..70f1ff46c4 100644 --- a/apps/dsp.c +++ b/apps/dsp.c @@ -769,6 +769,9 @@ void dsp_set_crossfeed(bool enable) void dsp_set_crossfeed_direct_gain(int gain) { crossfeed_data.gain = get_replaygain_int(gain * -10) << 7; + /* If gain is negative, the calculation overflowed and we need to clamp */ + if (crossfeed_data.gain < 0) + crossfeed_data.gain = 0x7fffffff; } void dsp_set_crossfeed_cross_params(long lf_gain, long hf_gain, long cutoff) |