mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
69 lines
1.5 KiB
Rust
69 lines
1.5 KiB
Rust
use crate::*;
|
|
|
|
impl<T: Has<Vec<Device>> + Has<Track>> HasDevices for T {
|
|
fn devices (&self) -> &Vec<Device> {
|
|
self.get()
|
|
}
|
|
fn devices_mut (&mut self) -> &mut Vec<Device> {
|
|
self.get_mut()
|
|
}
|
|
}
|
|
|
|
pub trait HasDevices: Has<Track> {
|
|
fn devices (&self) -> &Vec<Device>;
|
|
fn devices_mut (&mut self) -> &mut Vec<Device>;
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum Device {
|
|
#[cfg(feature = "sampler")]
|
|
Sampler(Sampler),
|
|
#[cfg(feature = "lv2")] // TODO
|
|
Lv2(Lv2),
|
|
#[cfg(feature = "vst2")] // TODO
|
|
Vst2,
|
|
#[cfg(feature = "vst3")] // TODO
|
|
Vst3,
|
|
#[cfg(feature = "clap")] // TODO
|
|
Clap,
|
|
#[cfg(feature = "sf2")] // TODO
|
|
Sf2,
|
|
}
|
|
|
|
impl Device {
|
|
pub fn name (&self) -> &str {
|
|
match self {
|
|
Self::Sampler(sampler) => sampler.name.as_ref(),
|
|
_ => todo!(),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub struct DeviceAudio<'a>(pub &'a mut Device);
|
|
|
|
audio!(|self: DeviceAudio<'a>, client, scope|{
|
|
use Device::*;
|
|
match self.0 {
|
|
#[cfg(feature = "sampler")]
|
|
Sampler(sampler) => sampler.process(client, scope),
|
|
|
|
#[cfg(feature = "lv2")]
|
|
Lv2(lv2) => lv2.process(client, scope),
|
|
|
|
#[cfg(feature = "vst2")]
|
|
Vst2 => { todo!() }, // TODO
|
|
|
|
#[cfg(feature = "vst3")]
|
|
Vst3 => { todo!() }, // TODO
|
|
|
|
#[cfg(feature = "clap")]
|
|
Clap => { todo!() }, // TODO
|
|
|
|
#[cfg(feature = "sf2")]
|
|
Sf2 => { todo!() }, // TODO
|
|
}
|
|
});
|
|
|
|
#[tengri_proc::command(Device)]
|
|
impl DeviceCommand {
|
|
}
|