mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
move all port connections to constructors (port: impl AsRef<str>)
This commit is contained in:
parent
e8b97bed37
commit
6607491f16
9 changed files with 215 additions and 129 deletions
|
|
@ -37,15 +37,13 @@ pub struct GrooveboxCli {
|
|||
impl GrooveboxCli {
|
||||
fn run (&self) -> Usually<()> {
|
||||
Tui::run(JackConnection::new("tek_groovebox")?.activate_with(|jack|{
|
||||
let app = tek::GrooveboxTui::try_from(jack)?;
|
||||
jack.read().unwrap().client().connect_ports(&app.player.midi_outs[0], &app.sampler.midi_in)?;
|
||||
jack.connect_midi_from(&app.player.midi_ins[0], &self.midi_from)?;
|
||||
jack.connect_midi_from(&app.sampler.midi_in, &self.midi_from)?;
|
||||
jack.connect_midi_to(&app.player.midi_outs[0], &self.midi_to)?;
|
||||
jack.connect_audio_from(&app.sampler.audio_ins[0], &self.l_from)?;
|
||||
jack.connect_audio_from(&app.sampler.audio_ins[1], &self.r_from)?;
|
||||
jack.connect_audio_to(&app.sampler.audio_outs[0], &self.l_to)?;
|
||||
jack.connect_audio_to(&app.sampler.audio_outs[1], &self.r_to)?;
|
||||
let app = tek::GrooveboxTui::new(
|
||||
jack,
|
||||
&self.midi_from.as_slice(),
|
||||
&self.midi_to.as_slice(),
|
||||
&[&self.l_from.as_slice(), &self.r_from.as_slice()],
|
||||
&[&self.l_to.as_slice(), &self.r_to.as_slice()],
|
||||
)?;
|
||||
if self.sync_lead {
|
||||
jack.read().unwrap().client().register_timebase_callback(false, |mut state|{
|
||||
app.clock().playhead.update_from_sample(state.position.frame() as f64);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,41 @@ pub fn main () -> Usually<()> { SamplerCli::parse().run() }
|
|||
#[arg(short, long)] name: Option<String>,
|
||||
/// Path to plugin
|
||||
#[arg(short, long)] path: Option<String>,
|
||||
/// MIDI outs to connect to MIDI input
|
||||
#[arg(short='i', long)]
|
||||
midi_from: Vec<String>,
|
||||
/// Audio outs to connect to left input
|
||||
#[arg(short='l', long)]
|
||||
l_from: Vec<String>,
|
||||
/// Audio outs to connect to right input
|
||||
#[arg(short='r', long)]
|
||||
r_from: Vec<String>,
|
||||
/// Audio ins to connect from left output
|
||||
#[arg(short='L', long)]
|
||||
l_to: Vec<String>,
|
||||
/// Audio ins to connect from right output
|
||||
#[arg(short='R', long)]
|
||||
r_to: Vec<String>,
|
||||
}
|
||||
impl SamplerCli {
|
||||
fn run (&self) -> Usually<()> {
|
||||
Tui::run(JackConnection::new("tek_sampler")?.activate_with(|x|{
|
||||
let sampler = tek::SamplerTui::try_from(x)?;
|
||||
Ok(sampler)
|
||||
Tui::run(JackConnection::new("tek_sampler")?.activate_with(|jack|{
|
||||
Ok(tek::SamplerTui {
|
||||
cursor: (0, 0),
|
||||
editing: None,
|
||||
mode: None,
|
||||
size: Measure::new(),
|
||||
note_lo: 36.into(),
|
||||
note_pt: 36.into(),
|
||||
color: ItemPalette::from(Color::Rgb(64, 128, 32)),
|
||||
state: Sampler::new(
|
||||
jack,
|
||||
&"sampler",
|
||||
&self.midi_from.as_slice(),
|
||||
&[&self.l_from.as_slice(), &self.r_from.as_slice()],
|
||||
&[&self.l_to.as_slice(), &self.r_to.as_slice()],
|
||||
)?,
|
||||
})
|
||||
})?)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue