use crate::core::*; use crate::model::*; pub struct Track { pub name: String, /// Play input through output. pub monitoring: bool, /// Write input to sequence. pub recording: bool, /// Overdub input to sequence. pub overdub: bool, /// Map: tick -> MIDI events at tick pub phrases: Vec, /// Phrase selector pub sequence: Option, /// Output from current sequence. pub midi_out: Port, /// Red keys on piano roll. pub notes_on: Vec, /// Device chain pub chain: Chain, } impl Track { pub fn new ( name: &str, jack: &Client, devices: Option>>, phrases: Option>, ) -> Usually { Ok(Self { name: name.to_string(), chain: Chain::new(&name, devices)?, midi_out: jack.register_port(name, MidiOut)?, notes_on: vec![], monitoring: false, recording: false, overdub: true, sequence: None, phrases: phrases.unwrap_or_else(||vec![]) }) } } impl PortList for Track { fn midi_ins (&self) -> Usually> { Ok(vec![]) } fn midi_outs (&self) -> Usually> { Ok(vec![self.midi_out.name()?]) } }