Clean up the GR overlay drawing
This commit is contained in:
parent
730757f8d7
commit
35864aa13c
1 changed files with 30 additions and 32 deletions
|
@ -254,9 +254,6 @@ fn draw_gain_reduction(
|
||||||
|
|
||||||
let bin_frequency = |bin_idx: f32| (bin_idx / analyzer_data.num_bins as f32) * nyquist_hz;
|
let bin_frequency = |bin_idx: f32| (bin_idx / analyzer_data.num_bins as f32) * nyquist_hz;
|
||||||
|
|
||||||
// TODO: This should be drawn as one mesh, or multiple meshes if there are empty gain reduction
|
|
||||||
// bars. The leftmost bin should be extended to the left of the analyzer, and the
|
|
||||||
// rightmost bin should be extended to the right.
|
|
||||||
let mut path = vg::Path::new();
|
let mut path = vg::Path::new();
|
||||||
for (bin_idx, gain_difference_db) in analyzer_data
|
for (bin_idx, gain_difference_db) in analyzer_data
|
||||||
.gain_difference_db
|
.gain_difference_db
|
||||||
|
@ -264,11 +261,13 @@ fn draw_gain_reduction(
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.take(analyzer_data.num_bins)
|
.take(analyzer_data.num_bins)
|
||||||
{
|
{
|
||||||
// TODO: Draw this as a single mesh instead, this doesn't work.
|
|
||||||
// Avoid drawing tiny slivers for low gain reduction values
|
// Avoid drawing tiny slivers for low gain reduction values
|
||||||
if gain_difference_db.abs() > 0.2 {
|
if gain_difference_db.abs() < 0.2 {
|
||||||
// The gain reduction bars are drawn width the width of the bin, centered on the
|
continue;
|
||||||
// bin's center frequency
|
}
|
||||||
|
|
||||||
|
// The gain reduction bars are drawn width the width of the bin, centered on the bin's
|
||||||
|
// center frequency
|
||||||
let gr_start_ln_frequency = bin_frequency(bin_idx as f32 - 0.5).ln();
|
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 gr_end_ln_frequency = bin_frequency(bin_idx as f32 + 0.5).ln();
|
||||||
|
|
||||||
|
@ -295,7 +294,6 @@ fn draw_gain_reduction(
|
||||||
path.line_to(bounds.x + (bounds.w * t_start), bounds.y + (bounds.h * t_y));
|
path.line_to(bounds.x + (bounds.w * t_start), bounds.y + (bounds.h * t_y));
|
||||||
path.close();
|
path.close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
canvas
|
canvas
|
||||||
.global_composite_blend_func(vg::BlendFactor::DstAlpha, vg::BlendFactor::OneMinusDstColor);
|
.global_composite_blend_func(vg::BlendFactor::DstAlpha, vg::BlendFactor::OneMinusDstColor);
|
||||||
|
|
Loading…
Add table
Reference in a new issue