reenable global midi ins/outs

This commit is contained in:
🪞👃🪞 2025-01-16 20:07:07 +01:00
parent dff6f1e279
commit 9b549d7dfe
2 changed files with 13 additions and 4 deletions

View file

@ -2,10 +2,10 @@ use crate::*;
#[derive(Debug)] #[derive(Debug)]
pub struct JackPort<T: PortSpec> { pub struct JackPort<T: PortSpec> {
/// Port name
pub name: Arc<str>,
/// Handle to JACK client, for receiving reconnect events. /// Handle to JACK client, for receiving reconnect events.
pub jack: Arc<RwLock<JackConnection>>, pub jack: Arc<RwLock<JackConnection>>,
/// Port name
pub name: Arc<str>,
/// Port handle. /// Port handle.
pub port: Port<T>, pub port: Port<T>,
/// List of ports to connect to. /// List of ports to connect to.

View file

@ -98,7 +98,8 @@ impl TekCli {
Ok(match self.mode { Ok(match self.mode {
TekMode::Clock => TekMode::Clock =>
engine.run(&jack.activate_with(|jack|Tek::new_clock( engine.run(&jack.activate_with(|jack|Tek::new_clock(
jack, self.bpm, self.sync_lead, self.sync_follow))?)?, jack, self.bpm, self.sync_lead, self.sync_follow,
&midi_froms, &midi_tos))?)?,
TekMode::Sequencer => TekMode::Sequencer =>
engine.run(&jack.activate_with(|jack|Tek::new_sequencer( engine.run(&jack.activate_with(|jack|Tek::new_sequencer(
jack, self.bpm, self.sync_lead, self.sync_follow, jack, self.bpm, self.sync_lead, self.sync_follow,
@ -297,7 +298,7 @@ impl Tek {
editing: false.into(), editing: false.into(),
midi_buf: vec![vec![];65536], midi_buf: vec![vec![];65536],
player: Some(MidiPlayer::new(&jack, "sequencer", Some(&clip), &midi_froms, &midi_tos)?), player: Some(MidiPlayer::new(&jack, "sequencer", Some(&clip), &midi_froms, &midi_tos)?),
..Self::new_clock(jack, bpm, sync_lead, sync_follow)? ..Self::new_clock(jack, bpm, sync_lead, sync_follow, midi_froms, midi_tos)?
}) })
} }
fn new_clock ( fn new_clock (
@ -305,12 +306,20 @@ impl Tek {
bpm: Option<f64>, bpm: Option<f64>,
sync_lead: bool, sync_lead: bool,
sync_follow: bool, sync_follow: bool,
midi_froms: &[PortConnection],
midi_tos: &[PortConnection],
) -> Usually<Self> { ) -> Usually<Self> {
let tek = Self { let tek = Self {
edn: include_str!("./view_transport.edn").to_string(), edn: include_str!("./view_transport.edn").to_string(),
jack: jack.clone(), jack: jack.clone(),
color: ItemPalette::random(), color: ItemPalette::random(),
clock: Clock::new(jack, bpm), clock: Clock::new(jack, bpm),
midi_ins: vec![
JackPort::<MidiIn>::new(jack, "mi", midi_froms)?
],
midi_outs: vec![
JackPort::<MidiOut>::new(jack, "mo", midi_tos)?
],
..Default::default() ..Default::default()
}; };
tek.sync_lead(sync_lead); tek.sync_lead(sync_lead);