mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 05:06:43 +01:00
wip: updates to module architecture
This commit is contained in:
parent
e08a79b507
commit
8652a5e415
6 changed files with 52 additions and 57 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use tek::{*, jack::*};
|
use tek::{*, jack::*, plugin::*, audio::*};
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,9 @@ mod audio_in;
|
||||||
mod audio_out;
|
mod audio_out;
|
||||||
|
|
||||||
mod sampler;
|
mod sampler;
|
||||||
pub(crate) use sampler::*;
|
pub(crate) use self::sampler::*;
|
||||||
pub use self::sampler::{Sampler, Sample, Voice};
|
pub use self::sampler::{Sampler, Sample, Voice};
|
||||||
|
|
||||||
|
mod mixer;
|
||||||
|
pub(crate) use self::mixer::*;
|
||||||
|
pub use self::mixer::{Mixer, MixerTrack, MixerTrackDevice};
|
||||||
|
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
use crate::*;
|
|
||||||
|
|
||||||
pub enum MixerTrackCommand {}
|
|
||||||
|
|
||||||
/// A mixer track.
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct MixerTrack {
|
|
||||||
pub name: String,
|
|
||||||
/// Inputs of 1st device
|
|
||||||
pub audio_ins: Vec<Port<AudioIn>>,
|
|
||||||
/// Outputs of last device
|
|
||||||
pub audio_outs: Vec<Port<AudioOut>>,
|
|
||||||
/// Device chain
|
|
||||||
pub devices: Vec<Box<dyn MixerTrackDevice>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
//impl MixerTrackDevice for LV2Plugin {}
|
|
||||||
|
|
||||||
pub trait MixerTrackDevice: Debug + Send + Sync {
|
|
||||||
fn boxed (self) -> Box<dyn MixerTrackDevice> where Self: Sized + 'static {
|
|
||||||
Box::new(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl MixerTrackDevice for Sampler {}
|
|
||||||
|
|
||||||
impl MixerTrackDevice for Plugin {}
|
|
||||||
|
|
@ -8,8 +8,30 @@ pub struct Mixer {
|
||||||
pub selected_track: usize,
|
pub selected_track: usize,
|
||||||
pub selected_column: usize,
|
pub selected_column: usize,
|
||||||
}
|
}
|
||||||
pub struct MixerAudio {
|
audio!(|self: Mixer, _client, _scope|Control::Continue);
|
||||||
model: Arc<RwLock<Mixer>>
|
|
||||||
|
pub enum MixerTrackCommand {}
|
||||||
|
|
||||||
|
/// A mixer track.
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct MixerTrack {
|
||||||
|
pub name: String,
|
||||||
|
/// Inputs of 1st device
|
||||||
|
pub audio_ins: Vec<Port<AudioIn>>,
|
||||||
|
/// Outputs of last device
|
||||||
|
pub audio_outs: Vec<Port<AudioOut>>,
|
||||||
|
/// Device chain
|
||||||
|
pub devices: Vec<Box<dyn MixerTrackDevice>>,
|
||||||
}
|
}
|
||||||
from!(|mode: &Arc<RwLock<Mixer>>| MixerAudio = Self { model: model.clone() });
|
|
||||||
audio!(|self: MixerAudio, _, _|Control::Continue);
|
//impl MixerTrackDevice for LV2Plugin {}
|
||||||
|
|
||||||
|
pub trait MixerTrackDevice: Debug + Send + Sync {
|
||||||
|
fn boxed (self) -> Box<dyn MixerTrackDevice> where Self: Sized + 'static {
|
||||||
|
Box::new(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MixerTrackDevice for Sampler {}
|
||||||
|
|
||||||
|
impl MixerTrackDevice for Plugin {}
|
||||||
|
|
|
||||||
|
|
@ -2,30 +2,27 @@
|
||||||
#![allow(clippy::unit_arg)]
|
#![allow(clippy::unit_arg)]
|
||||||
|
|
||||||
pub mod core; pub use self::core::*;
|
pub mod core; pub use self::core::*;
|
||||||
|
|
||||||
pub mod time; pub(crate) use self::time::*;
|
pub mod time; pub(crate) use self::time::*;
|
||||||
|
|
||||||
pub mod space; pub(crate) use self::space::*;
|
pub mod space; pub(crate) use self::space::*;
|
||||||
|
|
||||||
pub mod tui; pub(crate) use self::tui::*;
|
pub mod tui; pub(crate) use self::tui::*; pub use tui::*;
|
||||||
pub use tui::{Tui, TransportTui, SequencerTui, SamplerTui, GrooveboxTui, ArrangerTui};
|
|
||||||
|
|
||||||
pub mod jack; pub(crate) use self::jack::*;
|
pub mod jack; pub(crate) use self::jack::*; pub use self::jack::*;
|
||||||
pub use jack::JackClient;
|
|
||||||
|
|
||||||
pub mod midi; pub(crate) use self::midi::*;
|
pub mod midi; pub(crate) use self::midi::*;
|
||||||
|
|
||||||
pub mod audio; pub(crate) use self::audio::*;
|
pub mod audio; pub(crate) use self::audio::*; pub use self::audio::*;
|
||||||
pub use audio::{Sampler, Sample, Voice};
|
|
||||||
|
|
||||||
//pub mod plugin; pub(crate) use self::plugin::*;
|
pub mod plugin; pub(crate) use self::plugin::*; pub use self::plugin::*;
|
||||||
|
|
||||||
pub use ::better_panic;
|
pub use ::better_panic; pub(crate) use better_panic::{Settings, Verbosity};
|
||||||
pub(crate) use better_panic::{Settings, Verbosity};
|
|
||||||
|
|
||||||
pub use ::atomic_float;
|
pub use ::atomic_float; pub(crate) use atomic_float::*;
|
||||||
pub(crate) use atomic_float::*;
|
|
||||||
|
|
||||||
pub(crate) use std::sync::{Arc, Mutex, RwLock};
|
pub(crate) use std::sync::{Arc, Mutex, RwLock};
|
||||||
#[allow(unused)] pub(crate) use std::sync::atomic::Ordering;
|
pub(crate) use std::sync::atomic::Ordering;
|
||||||
pub(crate) use std::sync::atomic::{AtomicBool, AtomicUsize};
|
pub(crate) use std::sync::atomic::{AtomicBool, AtomicUsize};
|
||||||
pub(crate) use std::collections::BTreeMap;
|
pub(crate) use std::collections::BTreeMap;
|
||||||
pub(crate) use std::marker::PhantomData;
|
pub(crate) use std::marker::PhantomData;
|
||||||
|
|
@ -36,30 +33,27 @@ pub(crate) use std::time::Duration;
|
||||||
pub(crate) use std::io::{Stdout, stdout};
|
pub(crate) use std::io::{Stdout, stdout};
|
||||||
pub(crate) use std::ops::{Add, Sub, Mul, Div, Rem};
|
pub(crate) use std::ops::{Add, Sub, Mul, Div, Rem};
|
||||||
pub(crate) use std::cmp::{Ord, Eq, PartialEq};
|
pub(crate) use std::cmp::{Ord, Eq, PartialEq};
|
||||||
pub(crate) use std::fmt::{Debug, Display};
|
pub(crate) use std::fmt::{Debug, Display, Formatter};
|
||||||
|
|
||||||
pub use ::crossterm;
|
pub use ::crossterm;
|
||||||
pub(crate) use crossterm::{ExecutableCommand};
|
pub(crate) use crossterm::{ExecutableCommand};
|
||||||
pub(crate) use crossterm::terminal::{EnterAlternateScreen, LeaveAlternateScreen, enable_raw_mode, disable_raw_mode};
|
pub(crate) use crossterm::terminal::{EnterAlternateScreen, LeaveAlternateScreen, enable_raw_mode, disable_raw_mode};
|
||||||
pub(crate) use crossterm::event::{KeyCode, KeyModifiers, KeyEvent, KeyEventKind, KeyEventState};
|
pub(crate) use crossterm::event::{KeyCode, KeyModifiers, KeyEvent, KeyEventKind, KeyEventState};
|
||||||
|
|
||||||
pub use ::ratatui;
|
pub use ::ratatui; pub(crate) use ratatui::{
|
||||||
pub(crate) use ratatui::{
|
|
||||||
prelude::{Style, Color, Buffer},
|
prelude::{Style, Color, Buffer},
|
||||||
style::{Stylize, Modifier},
|
style::{Stylize, Modifier},
|
||||||
backend::{Backend, CrosstermBackend, ClearType}
|
backend::{Backend, CrosstermBackend, ClearType}
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use ::midly::{self, num::u7};
|
pub use ::midly::{self, num::u7}; pub(crate) use ::midly::{
|
||||||
pub(crate) use ::midly::{
|
|
||||||
Smf,
|
Smf,
|
||||||
MidiMessage,
|
MidiMessage,
|
||||||
TrackEventKind,
|
TrackEventKind,
|
||||||
live::LiveEvent,
|
live::LiveEvent,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use ::palette;
|
pub use ::palette; pub(crate) use ::palette::{
|
||||||
pub(crate) use ::palette::{
|
|
||||||
*,
|
*,
|
||||||
convert::*,
|
convert::*,
|
||||||
okhsl::*
|
okhsl::*
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
pub(crate) mod lv2; pub(crate) use lv2::*;
|
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
|
pub mod lv2; pub(crate) use lv2::*;
|
||||||
|
pub use self::lv2::LV2Plugin;
|
||||||
|
|
||||||
/// A plugin device.
|
/// A plugin device.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Plugin {
|
pub struct Plugin {
|
||||||
|
|
@ -22,12 +24,12 @@ pub struct Plugin {
|
||||||
pub enum PluginKind {
|
pub enum PluginKind {
|
||||||
#[default] None,
|
#[default] None,
|
||||||
LV2(LV2Plugin),
|
LV2(LV2Plugin),
|
||||||
VST2 { instance: ::vst::host::PluginInstance },
|
VST2 { instance: () /*::vst::host::PluginInstance*/ },
|
||||||
VST3,
|
VST3,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for PluginKind {
|
impl Debug for PluginKind {
|
||||||
fn fmt (&self, f: &mut Formatter<'_>) -> std::result::Result<(), Error> {
|
fn fmt (&self, f: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
|
||||||
write!(f, "{}", match self {
|
write!(f, "{}", match self {
|
||||||
Self::None => "(none)",
|
Self::None => "(none)",
|
||||||
Self::LV2(_) => "LV2",
|
Self::LV2(_) => "LV2",
|
||||||
|
|
@ -77,7 +79,7 @@ impl Plugin {
|
||||||
|
|
||||||
pub struct PluginAudio(Arc<RwLock<Plugin>>);
|
pub struct PluginAudio(Arc<RwLock<Plugin>>);
|
||||||
from!(|model: &Arc<RwLock<Plugin>>| PluginAudio = Self(model.clone()));
|
from!(|model: &Arc<RwLock<Plugin>>| PluginAudio = Self(model.clone()));
|
||||||
audio!(|self: PluginAudio, client_, _scope|{
|
audio!(|self: PluginAudio, client, scope|{
|
||||||
let state = &mut*self.0.write().unwrap();
|
let state = &mut*self.0.write().unwrap();
|
||||||
match state.plugin.as_mut() {
|
match state.plugin.as_mut() {
|
||||||
Some(PluginKind::LV2(LV2Plugin {
|
Some(PluginKind::LV2(LV2Plugin {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue