wip: refactor pt.6, fixed tek_api

This commit is contained in:
🪞👃🪞 2024-11-10 14:35:20 +01:00
parent 5df08409e5
commit 869d92110d
29 changed files with 1678 additions and 1679 deletions

View file

@ -22,7 +22,9 @@ pub trait MixerTrackDevice: Audio + Debug {
impl MixerTrackDevice for Sampler {}
impl MixerTrackDevice for LV2Plugin {}
impl MixerTrackDevice for Plugin {}
//impl MixerTrackDevice for LV2Plugin {}
impl MixerTrack {
const SYM_NAME: &'static str = ":name";
@ -37,8 +39,6 @@ impl MixerTrack {
audio_outs: vec![],
devices: vec![],
};
#[allow(unused_mut)]
let mut devices: Vec<JackClient> = vec![];
edn!(edn in args {
Edn::Map(map) => {
if let Some(Edn::Str(n)) = map.get(&Edn::Key(Self::SYM_NAME)) {
@ -51,8 +51,8 @@ impl MixerTrack {
Edn::List(args) => match args.get(0) {
// Add a sampler device to the track
Some(Edn::Symbol(Self::SYM_SAMPLER)) => {
track.add_device(
Sampler::from_edn(jack, &args[1..])?
track.devices.push(
Box::new(Sampler::from_edn(jack, &args[1..])?) as Box<dyn MixerTrackDevice>
);
panic!(
"unsupported in track {}: {:?}; tek_mixer not compiled with feature \"sampler\"",
@ -62,8 +62,8 @@ impl MixerTrack {
},
// Add a LV2 plugin to the track.
Some(Edn::Symbol(Self::SYM_LV2)) => {
track.add_device(
LV2Plugin::from_edn(jack, &args[1..])?
track.devices.push(
Box::new(LV2Plugin::from_edn(jack, &args[1..])?) as Box<dyn MixerTrackDevice>
);
panic!(
"unsupported in track {}: {:?}; tek_mixer not compiled with feature \"plugin\"",
@ -80,7 +80,4 @@ impl MixerTrack {
});
Ok(track)
}
pub fn add_device (&mut self, device: impl MixerTrackDevice) {
self.devices.push(device.boxed())
}
}