mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
feat: stub tek_mixer, tek_plugin, tek_sampler
This commit is contained in:
parent
e2789d6728
commit
b7d7864792
11 changed files with 98 additions and 77 deletions
|
|
@ -7,3 +7,10 @@ version = "0.1.0"
|
||||||
tek_core = { path = "../tek_core" }
|
tek_core = { path = "../tek_core" }
|
||||||
tek_jack = { path = "../tek_jack" }
|
tek_jack = { path = "../tek_jack" }
|
||||||
tek_chain = { path = "../tek_chain" }
|
tek_chain = { path = "../tek_chain" }
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "tek_mixer"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
|
||||||
6
crates/tek_mixer/src/main.rs
Normal file
6
crates/tek_mixer/src/main.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
//! Multi-track mixer
|
||||||
|
include!("lib.rs");
|
||||||
|
pub fn main () -> Usually<()> {
|
||||||
|
tek_core::run(Arc::new(RwLock::new(crate::Mixer::new("")?)))?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,7 @@ pub struct Mixer {
|
||||||
pub selected_column: usize,
|
pub selected_column: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
//render!(Mixer = crate::view::mixer::render);
|
render!(Mixer |self, buf, area| Ok(area));
|
||||||
handle!(Mixer = handle_mixer);
|
handle!(Mixer = handle_mixer);
|
||||||
process!(Mixer = process);
|
process!(Mixer = process);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,3 +11,10 @@ winit = { version = "0.30.4", features = [ "x11" ] }
|
||||||
suil-rs = { path = "../suil" }
|
suil-rs = { path = "../suil" }
|
||||||
vst = "0.4.0"
|
vst = "0.4.0"
|
||||||
#vst3 = "0.1.0"
|
#vst3 = "0.1.0"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "tek_plugin"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
//! Plugin (currently LV2 only; TODO other formats)
|
|
||||||
|
|
||||||
pub(crate) use tek_core::*;
|
pub(crate) use tek_core::*;
|
||||||
pub(crate) use tek_core::ratatui::prelude::*;
|
pub(crate) use tek_core::ratatui::prelude::*;
|
||||||
pub(crate) use tek_core::crossterm::event::{KeyCode, KeyModifiers};
|
pub(crate) use tek_core::crossterm::event::{KeyCode, KeyModifiers};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
//pub struct LV2PluginUI {
|
||||||
|
//write: (),
|
||||||
|
//controller: (),
|
||||||
|
//widget: (),
|
||||||
|
//features: (),
|
||||||
|
//transfer: (),
|
||||||
|
//}
|
||||||
6
crates/tek_plugin/src/main.rs
Normal file
6
crates/tek_plugin/src/main.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
//! Plugin host
|
||||||
|
include!("lib.rs");
|
||||||
|
pub fn main () -> Usually<()> {
|
||||||
|
tek_core::run(Arc::new(RwLock::new(crate::Plugin::new("")?)))?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
@ -1,69 +1,5 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
pub fn handle_plugin (state: &mut Plugin, event: &AppEvent) -> Usually<bool> {
|
|
||||||
handle_keymap(state, event, KEYMAP_PLUGIN)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Key bindings for plugin device.
|
|
||||||
pub const KEYMAP_PLUGIN: &'static [KeyBinding<Plugin>] = keymap!(Plugin {
|
|
||||||
[Up, NONE, "/plugin/cursor_up", "move cursor up", |s: &mut Plugin|{
|
|
||||||
s.selected = s.selected.saturating_sub(1);
|
|
||||||
Ok(true)
|
|
||||||
}],
|
|
||||||
[Down, NONE, "/plugin/cursor_down", "move cursor down", |s: &mut Plugin|{
|
|
||||||
s.selected = (s.selected + 1).min(match &s.plugin {
|
|
||||||
Some(PluginKind::LV2(LV2Plugin { port_list, .. })) => port_list.len() - 1,
|
|
||||||
_ => unimplemented!()
|
|
||||||
});
|
|
||||||
Ok(true)
|
|
||||||
}],
|
|
||||||
[PageUp, NONE, "/plugin/cursor_page_up", "move cursor up", |s: &mut Plugin|{
|
|
||||||
s.selected = s.selected.saturating_sub(8);
|
|
||||||
Ok(true)
|
|
||||||
}],
|
|
||||||
[PageDown, NONE, "/plugin/cursor_page_down", "move cursor down", |s: &mut Plugin|{
|
|
||||||
s.selected = (s.selected + 10).min(match &s.plugin {
|
|
||||||
Some(PluginKind::LV2(LV2Plugin { port_list, .. })) => port_list.len() - 1,
|
|
||||||
_ => unimplemented!()
|
|
||||||
});
|
|
||||||
Ok(true)
|
|
||||||
}],
|
|
||||||
[Char(','), NONE, "/plugin/decrement", "decrement value", |s: &mut Plugin|{
|
|
||||||
match s.plugin.as_mut() {
|
|
||||||
Some(PluginKind::LV2(LV2Plugin { port_list, ref mut instance, .. })) => {
|
|
||||||
let index = port_list[s.selected].index;
|
|
||||||
if let Some(value) = instance.control_input(index) {
|
|
||||||
instance.set_control_input(index, value - 0.01);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
Ok(true)
|
|
||||||
}],
|
|
||||||
[Char('.'), NONE, "/plugin/decrement", "increment value", |s: &mut Plugin|{
|
|
||||||
match s.plugin.as_mut() {
|
|
||||||
Some(PluginKind::LV2(LV2Plugin { port_list, ref mut instance, .. })) => {
|
|
||||||
let index = port_list[s.selected].index;
|
|
||||||
if let Some(value) = instance.control_input(index) {
|
|
||||||
instance.set_control_input(index, value + 0.01);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
Ok(true)
|
|
||||||
}],
|
|
||||||
[Char('g'), NONE, "/plugin/gui_toggle", "toggle plugin UI", |s: &mut Plugin|{
|
|
||||||
match s.plugin {
|
|
||||||
Some(PluginKind::LV2(ref mut plugin)) => {
|
|
||||||
plugin.ui_thread = Some(run_lv2_ui(LV2PluginUI::new()?)?);
|
|
||||||
},
|
|
||||||
Some(_) => unreachable!(),
|
|
||||||
None => {}
|
|
||||||
}
|
|
||||||
Ok(true)
|
|
||||||
}],
|
|
||||||
});
|
|
||||||
|
|
||||||
/// A plugin device.
|
/// A plugin device.
|
||||||
pub struct Plugin {
|
pub struct Plugin {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
@ -74,7 +10,7 @@ pub struct Plugin {
|
||||||
pub ports: JackPorts,
|
pub ports: JackPorts,
|
||||||
}
|
}
|
||||||
render!(Plugin = render_plugin);
|
render!(Plugin = render_plugin);
|
||||||
handle!(Plugin = handle_plugin);
|
handle!(Plugin |self, e| handle_keymap(self, e, KEYMAP_PLUGIN));
|
||||||
process!(Plugin = Plugin::process);
|
process!(Plugin = Plugin::process);
|
||||||
|
|
||||||
/// Supported plugin formats.
|
/// Supported plugin formats.
|
||||||
|
|
@ -202,10 +138,62 @@ fn draw_header (state: &Plugin, buf: &mut Buffer, x: u16, y: u16, w: u16) -> Usu
|
||||||
Ok(Rect { x, y, width: w, height: 1 })
|
Ok(Rect { x, y, width: w, height: 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
//pub struct LV2PluginUI {
|
/// Key bindings for plugin device.
|
||||||
//write: (),
|
pub const KEYMAP_PLUGIN: &'static [KeyBinding<Plugin>] = keymap!(Plugin {
|
||||||
//controller: (),
|
[Up, NONE, "/plugin/cursor_up", "move cursor up", |s: &mut Plugin|{
|
||||||
//widget: (),
|
s.selected = s.selected.saturating_sub(1);
|
||||||
//features: (),
|
Ok(true)
|
||||||
//transfer: (),
|
}],
|
||||||
//}
|
[Down, NONE, "/plugin/cursor_down", "move cursor down", |s: &mut Plugin|{
|
||||||
|
s.selected = (s.selected + 1).min(match &s.plugin {
|
||||||
|
Some(PluginKind::LV2(LV2Plugin { port_list, .. })) => port_list.len() - 1,
|
||||||
|
_ => unimplemented!()
|
||||||
|
});
|
||||||
|
Ok(true)
|
||||||
|
}],
|
||||||
|
[PageUp, NONE, "/plugin/cursor_page_up", "move cursor up", |s: &mut Plugin|{
|
||||||
|
s.selected = s.selected.saturating_sub(8);
|
||||||
|
Ok(true)
|
||||||
|
}],
|
||||||
|
[PageDown, NONE, "/plugin/cursor_page_down", "move cursor down", |s: &mut Plugin|{
|
||||||
|
s.selected = (s.selected + 10).min(match &s.plugin {
|
||||||
|
Some(PluginKind::LV2(LV2Plugin { port_list, .. })) => port_list.len() - 1,
|
||||||
|
_ => unimplemented!()
|
||||||
|
});
|
||||||
|
Ok(true)
|
||||||
|
}],
|
||||||
|
[Char(','), NONE, "/plugin/decrement", "decrement value", |s: &mut Plugin|{
|
||||||
|
match s.plugin.as_mut() {
|
||||||
|
Some(PluginKind::LV2(LV2Plugin { port_list, ref mut instance, .. })) => {
|
||||||
|
let index = port_list[s.selected].index;
|
||||||
|
if let Some(value) = instance.control_input(index) {
|
||||||
|
instance.set_control_input(index, value - 0.01);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
Ok(true)
|
||||||
|
}],
|
||||||
|
[Char('.'), NONE, "/plugin/decrement", "increment value", |s: &mut Plugin|{
|
||||||
|
match s.plugin.as_mut() {
|
||||||
|
Some(PluginKind::LV2(LV2Plugin { port_list, ref mut instance, .. })) => {
|
||||||
|
let index = port_list[s.selected].index;
|
||||||
|
if let Some(value) = instance.control_input(index) {
|
||||||
|
instance.set_control_input(index, value + 0.01);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
Ok(true)
|
||||||
|
}],
|
||||||
|
[Char('g'), NONE, "/plugin/gui_toggle", "toggle plugin UI", |s: &mut Plugin|{
|
||||||
|
match s.plugin {
|
||||||
|
Some(PluginKind::LV2(ref mut plugin)) => {
|
||||||
|
plugin.ui_thread = Some(run_lv2_ui(LV2PluginUI::new()?)?);
|
||||||
|
},
|
||||||
|
Some(_) => unreachable!(),
|
||||||
|
None => {}
|
||||||
|
}
|
||||||
|
Ok(true)
|
||||||
|
}],
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//! Phrase editor.
|
//! Sample player
|
||||||
include!("lib.rs");
|
include!("lib.rs");
|
||||||
pub fn main () -> Usually<()> {
|
pub fn main () -> Usually<()> {
|
||||||
tek_core::run(Arc::new(RwLock::new(crate::Sampler::new("sampler", None)?)));
|
tek_core::run(Arc::new(RwLock::new(crate::Sampler::new("", None)?)))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue