diff --git a/src/control/sampler.rs b/src/control/sampler.rs index efac93e7..00d7bf0c 100644 --- a/src/control/sampler.rs +++ b/src/control/sampler.rs @@ -28,7 +28,7 @@ fn cursor_down (state: &mut Sampler) -> Usually { fn trigger (state: &mut Sampler) -> Usually { for (i, sample) in state.samples.values().enumerate() { if i == state.cursor.0 { - state.voices.push(sample.play(0)) + state.voices.push(sample.play(0, &100.into())) } } Ok(true) diff --git a/src/core/render.rs b/src/core/render.rs index d8c7aa3a..a5c99d5a 100644 --- a/src/core/render.rs +++ b/src/core/render.rs @@ -3,6 +3,21 @@ pub(crate) use ratatui::prelude::*; pub(crate) use ratatui::buffer::Cell; use ratatui::widgets::WidgetRef; +pub fn fill_bg (buf: &mut Buffer, area: Rect, color: Color) { + let Rect { x, y, width, height } = area; + for y in y..y+height { + if y >= buf.area.height { + break + } + for x in x..x+width { + if x >= buf.area.width { + break + } + buf.get_mut(x, y).set_bg(color); + } + } +} + pub trait Blit { // Render something to X, Y coordinates in a buffer, ignoring width/height. fn blit (&self, buf: &mut Buffer, x: u16, y: u16, style: Option