feat: run stub tek_sequencer

This commit is contained in:
🪞👃🪞 2024-08-06 18:05:05 +03:00
parent b8a67b8adc
commit 09abc4cd95
12 changed files with 78 additions and 56 deletions

View file

@ -8,3 +8,10 @@ tek_core = { path = "../tek_core" }
tek_jack = { path = "../tek_jack" }
symphonia = { version = "0.5.4", features = [ "all" ] }
wavers = "1.4.3"
[lib]
path = "src/lib.rs"
[[bin]]
name = "tek_sampler"
path = "src/main.rs"

View file

@ -1,4 +1,4 @@
//! Sampler (currently 16bit WAVs at system rate; TODO convert/resample)
// Sampler (currently 16bit WAVs at system rate; TODO convert/resample)
pub(crate) use tek_core::*;
pub(crate) use tek_core::ratatui::prelude::*;

View file

@ -0,0 +1,6 @@
//! Phrase editor.
include!("lib.rs");
pub fn main () -> Usually<()> {
tek_core::run(Arc::new(RwLock::new(crate::Sampler::new("sampler", None)?)));
Ok(())
}

View file

@ -14,6 +14,8 @@ pub struct Sampler {
pub output_gain: f32
}
process!(Sampler = Sampler::process);
handle!(Sampler |self, event| handle_keymap(self, event, KEYMAP_SAMPLER));
render!(Sampler |self, buf, area| {
let Rect { x, y, height, .. } = area;
let style = Style::default().gray();
@ -56,8 +58,6 @@ fn draw_sample (
Ok(label1.len() + label2.len() + 4)
}
handle!(Sampler |self, event| handle_keymap(self, event, KEYMAP_SAMPLER));
/// Key bindings for sampler device.
pub const KEYMAP_SAMPLER: &'static [KeyBinding<Sampler>] = keymap!(Sampler {
[Up, NONE, "/sampler/cursor/up", "move cursor up", |state: &mut Sampler| {
@ -98,7 +98,6 @@ pub const KEYMAP_SAMPLER: &'static [KeyBinding<Sampler>] = keymap!(Sampler {
}],
});
process!(Sampler = Sampler::process);
impl Sampler {
pub fn new (name: &str, mapped: Option<BTreeMap<u7, Arc<RwLock<Sample>>>>) -> Usually<JackDevice> {