diff --git a/crates/tek_api/src/api_edn.rs b/crates/tek_api/src/api_edn.rs index 7d1e57ec..00a2f451 100644 --- a/crates/tek_api/src/api_edn.rs +++ b/crates/tek_api/src/api_edn.rs @@ -22,8 +22,11 @@ impl Scene { }, _ => panic!("unexpected in scene '{name:?}': {edn:?}") }); - let scene = Self::new(name.unwrap_or(""), clips); - Ok(scene) + Ok(Scene { + name: Arc::new(name.unwrap_or("").to_string().into()), + color: ItemColor::random(), + clips, + }) } } @@ -35,9 +38,13 @@ impl MixerTrack { const SYM_LV2: &'static str = "lv2"; pub fn from_edn <'a, 'e> (jack: &Arc>, args: &[Edn<'e>]) -> Usually { let mut _gain = 0.0f64; - let mut track = Self::new("")?; + let mut track = MixerTrack { + name: String::new(), + ports: JackPorts::default(), + devices: vec![], + }; #[allow(unused_mut)] - let mut devices: Vec = vec![]; + let mut devices: Vec = vec![]; edn!(edn in args { Edn::Map(map) => { if let Some(Edn::Str(n)) = map.get(&Edn::Key(Self::SYM_NAME)) { @@ -81,7 +88,7 @@ impl MixerTrack { } impl LV2Plugin { - pub fn from_edn <'e> (jack: &Arc>, args: &[Edn<'e>]) -> Usually { + pub fn from_edn <'e> (jack: &Arc>, args: &[Edn<'e>]) -> Usually { let mut name = String::new(); let mut path = String::new(); edn!(edn in args { @@ -100,7 +107,7 @@ impl LV2Plugin { } impl Sampler { - pub fn from_edn <'e> (jack: &Arc>, args: &[Edn<'e>]) -> Usually { + pub fn from_edn <'e> (jack: &Arc>, args: &[Edn<'e>]) -> Usually { let mut name = String::new(); let mut dir = String::new(); let mut samples = BTreeMap::new(); @@ -126,7 +133,16 @@ impl Sampler { }, _ => panic!("unexpected in sampler {name}: {edn:?}") }); - Self::new(jack, &name, Some(samples)) + Ok(Sampler { + jack: jack.clone(), + name: name.into(), + mapped: samples, + unmapped: Default::default(), + voices: Default::default(), + ports: Default::default(), + buffer: Default::default(), + output_gain: 0. + }) } } diff --git a/crates/tek_api/src/lib.rs b/crates/tek_api/src/lib.rs index ef4988ce..1b346ebf 100644 --- a/crates/tek_api/src/lib.rs +++ b/crates/tek_api/src/lib.rs @@ -148,7 +148,7 @@ pub struct Phrase { /// MIDI message structural pub type PhraseData = Vec>; -#[derive(Default, Debug, Clone)] +#[derive(Debug)] pub struct Mixer { /// JACK client handle (needs to not be dropped for standalone mode to work). pub jack: Arc>, @@ -159,30 +159,25 @@ pub struct Mixer { } /// A mixer track. -#[derive(Default, Debug, Clone)] +#[derive(Debug)] pub struct MixerTrack { pub name: String, /// Inputs and outputs of 1st and last device pub ports: JackPorts, /// Device chain - pub devices: Vec, - /// Device selector - pub device: usize, + pub devices: Vec, } /// The sampler plugin plays sounds. -#[derive(Default, Debug, Clone)] +#[derive(Debug)] pub struct Sampler { pub jack: Arc>, pub name: String, - pub cursor: (usize, usize), - pub editing: Option>>, pub mapped: BTreeMap>>, pub unmapped: Vec>>, pub voices: Arc>>, pub ports: JackPorts, pub buffer: Vec>, - pub modal: Arc>>>, pub output_gain: f32 } diff --git a/crates/tek_core/src/audio.rs b/crates/tek_core/src/audio.rs index 6b2c245b..1d36fe07 100644 --- a/crates/tek_core/src/audio.rs +++ b/crates/tek_core/src/audio.rs @@ -36,6 +36,7 @@ pub trait AudioEngine { } } /// Wraps [Client] or [DynamicAsyncClient] in place. +#[derive(Debug)] pub enum JackClient { /// Before activation. Inactive(Client),