mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: reenable mixer components
This commit is contained in:
parent
2f189c6d7e
commit
1dbc5d1bb7
6 changed files with 87 additions and 16 deletions
|
|
@ -1,7 +1,9 @@
|
|||
use crate::*;
|
||||
|
||||
/// The sampler plugin plays sounds.
|
||||
pub struct Sampler {
|
||||
pub struct Sampler<E: Engine> {
|
||||
_engine: PhantomData<E>,
|
||||
pub jack: Arc<RwLock<JackClient>>,
|
||||
pub name: String,
|
||||
pub cursor: (usize, usize),
|
||||
pub editing: Option<Arc<RwLock<Sample>>>,
|
||||
|
|
@ -14,7 +16,7 @@ pub struct Sampler {
|
|||
pub output_gain: f32
|
||||
}
|
||||
|
||||
impl Sampler {
|
||||
impl<E: Engine> Sampler<E> {
|
||||
pub fn from_edn <'e> (args: &[Edn<'e>]) -> Usually<JackDevice<Tui>> {
|
||||
let mut name = String::new();
|
||||
let mut dir = String::new();
|
||||
|
|
@ -54,6 +56,7 @@ impl Sampler {
|
|||
.audio_out("outL")
|
||||
.audio_out("outR")
|
||||
.run(|ports|Box::new(Self {
|
||||
_engine: Default::default(),
|
||||
name: name.into(),
|
||||
cursor: (0, 0),
|
||||
editing: None,
|
||||
|
|
@ -135,7 +138,7 @@ impl Sampler {
|
|||
}
|
||||
}
|
||||
|
||||
impl Audio for Sampler {
|
||||
impl<E: Engine> Audio for Sampler<E> {
|
||||
fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
|
||||
self.process_midi_in(scope);
|
||||
self.clear_output_buffer();
|
||||
|
|
@ -144,7 +147,7 @@ impl Audio for Sampler {
|
|||
Control::Continue
|
||||
}
|
||||
}
|
||||
impl Handle<Tui> for Sampler {
|
||||
impl Handle<Tui> for Sampler<Tui> {
|
||||
fn handle (&mut self, from: &TuiInput) -> Perhaps<bool> {
|
||||
match from.event() {
|
||||
key!(KeyCode::Up) => {
|
||||
|
|
@ -188,7 +191,7 @@ impl Handle<Tui> for Sampler {
|
|||
}
|
||||
}
|
||||
|
||||
impl Widget for Sampler {
|
||||
impl Widget for Sampler<Tui> {
|
||||
type Engine = Tui;
|
||||
fn layout (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
todo!()
|
||||
|
|
@ -198,7 +201,7 @@ impl Widget for Sampler {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn tui_render_sampler (sampler: &Sampler, to: &mut TuiOutput) -> Usually<()> {
|
||||
pub fn tui_render_sampler (sampler: &Sampler<Tui>, to: &mut TuiOutput) -> Usually<()> {
|
||||
let [x, y, _, height] = to.area();
|
||||
let style = Style::default().gray();
|
||||
let title = format!(" {} ({})", sampler.name, sampler.voices.read().unwrap().len());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue