1
0
Fork 0

Fix GR overlay clamping

Just the min/max isn't enough when the entire band is out of range.
This commit is contained in:
Robbert van der Helm 2023-03-21 17:14:53 +01:00
parent 9f5d1dcf57
commit a4cac4b750

View file

@ -267,8 +267,13 @@ fn draw_gain_reduction(
let gr_start_ln_frequency = bin_frequency(bin_idx as f32 - 0.5).ln();
let gr_end_ln_frequency = bin_frequency(bin_idx as f32 + 0.5).ln();
let t_start = ((gr_start_ln_frequency - LN_40_HZ) / LN_FREQ_RANGE).max(0.0);
let t_end = ((gr_end_ln_frequency - LN_40_HZ) / LN_FREQ_RANGE).min(1.0);
let t_start = (gr_start_ln_frequency - LN_40_HZ) / LN_FREQ_RANGE;
let t_end = (gr_end_ln_frequency - LN_40_HZ) / LN_FREQ_RANGE;
if t_end < 0.0 || t_start > 1.0 {
continue;
}
let (t_start, t_end) = (t_start.max(0.0), t_end.min(1.0));
// For the bar's height we'll draw 0 dB of gain reduction as a flat line (except we
// don't actually draw 0 dBs of GR because it looks glitchy, but that's besides the