mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
systematizing jack handlers
This commit is contained in:
parent
d627d257ad
commit
4ae62c5bc2
10 changed files with 342 additions and 208 deletions
|
|
@ -2,7 +2,7 @@ use crate::prelude::*;
|
|||
|
||||
pub struct Mixer {
|
||||
name: String,
|
||||
jack: Jack<Notifications>,
|
||||
jack: Jack<MixerJack>,
|
||||
tracks: Vec<Track>,
|
||||
selected_track: usize,
|
||||
selected_column: usize,
|
||||
|
|
@ -14,14 +14,9 @@ impl Mixer {
|
|||
name,
|
||||
ClientOptions::NO_START_SERVER
|
||||
)?;
|
||||
let jack = client.activate_async(
|
||||
Notifications,
|
||||
ClosureProcessHandler::new(Box::new(
|
||||
move |_: &Client, _: &ProcessScope| -> Control {
|
||||
Control::Continue
|
||||
}) as Box<dyn FnMut(&Client, &ProcessScope)->Control + Send>
|
||||
)
|
||||
)?;
|
||||
let jack = MixerJack.activate(client, ClosureProcessHandler::new(Box::new(
|
||||
move|client: &Client, scope: &ProcessScope|process(client, scope)
|
||||
) as BoxedProcessHandler))?;
|
||||
Ok(DynamicDevice::new(render, handle, |_|{}, Self {
|
||||
name: name.into(),
|
||||
selected_column: 0,
|
||||
|
|
@ -41,6 +36,13 @@ impl Mixer {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn process (
|
||||
client: &Client,
|
||||
scope: &ProcessScope
|
||||
) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
|
||||
pub fn render (state: &Mixer, buf: &mut Buffer, mut area: Rect)
|
||||
-> Usually<Rect>
|
||||
{
|
||||
|
|
@ -211,9 +213,17 @@ impl Track {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct Notifications;
|
||||
pub struct MixerJack;
|
||||
|
||||
impl NotificationHandler for Notifications {
|
||||
impl MixerJack {
|
||||
fn activate <P> (self, client: Client, handler: P) -> Usually<AsyncClient<Self, P>>
|
||||
where P: 'static + Send + ::jack::ProcessHandler
|
||||
{
|
||||
Ok(client.activate_async(self, handler)?)
|
||||
}
|
||||
}
|
||||
|
||||
impl NotificationHandler for MixerJack {
|
||||
fn thread_init (&self, _: &Client) {
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +264,7 @@ impl NotificationHandler for Notifications {
|
|||
//fn handle (&mut self, engine: &mut TUI<W>) -> Result<Option<bool>> {
|
||||
//Ok(None)
|
||||
//}
|
||||
//}
|
||||
//
|
||||
|
||||
//impl<W: Write> Output<TUI<W>, [u16;2]> for Mixer {
|
||||
//fn render (&self, envine: &mut TUI<W>) -> Result<Option<[u16;2]>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue