mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 03:36:41 +01:00
57 lines
1.8 KiB
Rust
57 lines
1.8 KiB
Rust
#[allow(unused_imports)] use std::sync::Arc;
|
|
#[allow(unused_imports)] use clap::{self, Parser};
|
|
#[allow(unused_imports)] use tek::{
|
|
*,
|
|
jack::*,
|
|
tek_layout::Measure,
|
|
tek_engine::Usually,
|
|
tek_tui::{Tui, TuiRun, ItemPalette, ItemColor, ratatui::prelude::Color}
|
|
};
|
|
|
|
#[allow(unused)]
|
|
fn connect_from (jack: &JackConnection, input: &Port<MidiIn>, ports: &[String]) -> Usually<()> {
|
|
for port in ports.iter() {
|
|
if let Some(port) = jack.port_by_name(port).as_ref() {
|
|
jack.client().connect_ports(port, input)?;
|
|
} else {
|
|
panic!("Missing MIDI output: {port}. Use jack_lsp to list all port names.");
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
#[allow(unused)]
|
|
fn connect_to (jack: &JackConnection, output: &Port<MidiOut>, ports: &[String]) -> Usually<()> {
|
|
for port in ports.iter() {
|
|
if let Some(port) = jack.port_by_name(port).as_ref() {
|
|
jack.client().connect_ports(output, port)?;
|
|
} else {
|
|
panic!("Missing MIDI input: {port}. Use jack_lsp to list all port names.");
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
#[allow(unused)]
|
|
fn connect_audio_from (jack: &JackConnection, input: &Port<AudioIn>, ports: &[String]) -> Usually<()> {
|
|
for port in ports.iter() {
|
|
if let Some(port) = jack.port_by_name(port).as_ref() {
|
|
jack.client().connect_ports(port, input)?;
|
|
} else {
|
|
panic!("Missing MIDI output: {port}. Use jack_lsp to list all port names.");
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
#[allow(unused)]
|
|
fn connect_audio_to (jack: &JackConnection, output: &Port<AudioOut>, ports: &[String]) -> Usually<()> {
|
|
for port in ports.iter() {
|
|
if let Some(port) = jack.port_by_name(port).as_ref() {
|
|
jack.client().connect_ports(output, port)?;
|
|
} else {
|
|
panic!("Missing MIDI input: {port}. Use jack_lsp to list all port names.");
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|