Process -> Audio; Layers2 -> Layers

This commit is contained in:
🪞👃🪞 2024-09-10 11:45:18 +03:00
parent 1cbf8de4e4
commit cd8a808c21
20 changed files with 334 additions and 414 deletions

View file

@ -25,7 +25,7 @@ impl<E: Engine> Mixer<E> {
self.tracks.get(self.selected_track)
}
}
impl<E: Engine> Process for Mixer<E> {
impl<E: Engine> Audio for Mixer<E> {
fn process (&mut self, _: &Client, _: &ProcessScope) -> Control {
Control::Continue
}

View file

@ -39,7 +39,7 @@ impl<E> Plugin<E> {
}
}
impl<E> Process for Plugin<E> {
impl<E> Audio for Plugin<E> {
fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
match self.plugin.as_mut() {
Some(PluginKind::LV2(LV2Plugin {

View file

@ -22,7 +22,11 @@ pub struct AddSampleModal {
exit!(AddSampleModal);
impl Render<Tui> for AddSampleModal {
impl Widget for AddSampleModal {
type Engine = Tui;
fn layout (&self, to: [u16;4]) -> Perhaps<[u16;4]> {
todo!()
}
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
let area = to.area();
to.make_dim();

View file

@ -13,7 +13,6 @@ pub struct Sampler {
pub modal: Arc<Mutex<Option<Box<dyn Exit + Send>>>>,
pub output_gain: f32
}
process!(Sampler = Sampler::process);
impl Sampler {
pub fn from_edn <'e> (args: &[Edn<'e>]) -> Usually<JackDevice<Tui>> {
@ -83,14 +82,6 @@ impl Sampler {
None
}
pub fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
self.process_midi_in(scope);
self.clear_output_buffer();
self.process_audio_out(scope);
self.write_output_buffer(scope);
Control::Continue
}
/// Create [Voice]s from [Sample]s in response to MIDI input.
fn process_midi_in (&mut self, scope: &ProcessScope) {
for RawMidi { time, bytes } in self.ports.midi_ins.get("midi").unwrap().iter(scope) {
@ -144,8 +135,12 @@ impl Sampler {
}
}
impl Layout<Tui> for Sampler {
fn layout (&self, area: [u16;4]) -> Perhaps<[u16;4]> {
todo!()
impl Audio for Sampler {
fn process (&mut self, _: &Client, scope: &ProcessScope) -> Control {
self.process_midi_in(scope);
self.clear_output_buffer();
self.process_audio_out(scope);
self.write_output_buffer(scope);
Control::Continue
}
}

View file

@ -1,6 +1,10 @@
use crate::*;
impl Render<Tui> for Sampler {
impl Widget for Sampler {
type Engine = Tui;
fn layout (&self, to: [u16;4]) -> Perhaps<[u16;4]> {
todo!()
}
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
tui_render_sampler(self, to)
}