diff --git a/crates/tek/src/groovebox.rs b/crates/tek/src/groovebox.rs index 8dd04d17..439c57d2 100644 --- a/crates/tek/src/groovebox.rs +++ b/crates/tek/src/groovebox.rs @@ -77,7 +77,7 @@ render!(|self:GrooveboxTui|{ PhraseSelector::next_phrase(&self.player), ]))), row!([ - Tui::split_n(false, 5, + Tui::split_n(false, 9, col!([ row!(|add|{ if let Some(sample) = &self.sampler.mapped[note_pt] { @@ -88,7 +88,7 @@ render!(|self:GrooveboxTui|{ }), lay!([ Outer(Style::default().fg(TuiTheme::g(128))), - Fill::w(Fixed::h(4, if let Some((_, sample)) = &self.sampler.recording { + Fill::w(Fixed::h(8, if let Some((_, sample)) = &self.sampler.recording { SampleViewer(Some(sample.clone())) } else if let Some(sample) = &self.sampler.mapped[note_pt] { SampleViewer(Some(sample.clone())) diff --git a/crates/tek/src/sampler/sample_viewer.rs b/crates/tek/src/sampler/sample_viewer.rs index 3ad94263..6f860746 100644 --- a/crates/tek/src/sampler/sample_viewer.rs +++ b/crates/tek/src/sampler/sample_viewer.rs @@ -18,18 +18,16 @@ render!(|self: SampleViewer|render(|to|{ let step = length / width as f64; let mut t = start; while t < end { - points.push((t as f64, 0.)); - points.push((t as f64, 1.)); - points.push((t as f64, 0.5)); - points.push((t as f64, 0.25)); - points.push((t as f64, 0.125)); - points.push((t as f64, 0.0625)); - points.push((t as f64, 0.03125)); + let chunk = &sample.channels[0][t as usize..((t + step) as usize).min(sample.end)]; + let total: f32 = chunk.iter().map(|x|x.abs()).sum(); + let count = chunk.len() as f32; + let meter = 10. * (total / count).log10(); + points.push((t as f64, meter as f64)); t += step; } ( [sample.start as f64, sample.end as f64], - [0., 1.], + [-40., 0.], points.as_slice() ) } else {