mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
add JackEvent parameters
This commit is contained in:
parent
b162e6f2c3
commit
c51bcbfaa8
1 changed files with 18 additions and 33 deletions
|
|
@ -200,13 +200,13 @@ fn panic_hook (info: &std::panic::PanicInfo) {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum JackEvent {
|
pub enum JackEvent {
|
||||||
ThreadInit,
|
ThreadInit,
|
||||||
Shutdown,
|
Shutdown(ClientStatus, String),
|
||||||
Freewheel,
|
Freewheel(bool),
|
||||||
SampleRate,
|
SampleRate(Frames),
|
||||||
ClientRegistration,
|
ClientRegistration(String, bool),
|
||||||
PortRegistration,
|
PortRegistration(PortId, bool),
|
||||||
PortRename,
|
PortRename(PortId, String, String),
|
||||||
PortsConnected,
|
PortsConnected(PortId, PortId, bool),
|
||||||
GraphReorder,
|
GraphReorder,
|
||||||
XRun,
|
XRun,
|
||||||
}
|
}
|
||||||
|
|
@ -215,60 +215,45 @@ pub struct Notifications<T: Fn(AppEvent) + Send>(T);
|
||||||
|
|
||||||
impl<T: Fn(AppEvent) + Send> NotificationHandler for Notifications<T> {
|
impl<T: Fn(AppEvent) + Send> NotificationHandler for Notifications<T> {
|
||||||
fn thread_init (&self, _: &Client) {
|
fn thread_init (&self, _: &Client) {
|
||||||
//println!("JACK: thread init");
|
|
||||||
self.0(AppEvent::Jack(JackEvent::ThreadInit));
|
self.0(AppEvent::Jack(JackEvent::ThreadInit));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shutdown (&mut self, status: ClientStatus, reason: &str) {
|
fn shutdown (&mut self, status: ClientStatus, reason: &str) {
|
||||||
//println!("JACK: shutdown with status {:?} because \"{}\"", status, reason);
|
self.0(AppEvent::Jack(JackEvent::Shutdown(status, reason.into())));
|
||||||
self.0(AppEvent::Jack(JackEvent::Shutdown));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn freewheel (&mut self, _: &Client, is_enabled: bool) {
|
fn freewheel (&mut self, _: &Client, enabled: bool) {
|
||||||
//println!("JACK: freewheel mode is {}", if is_enabled { "on" } else { "off" });
|
self.0(AppEvent::Jack(JackEvent::Freewheel(enabled)));
|
||||||
self.0(AppEvent::Jack(JackEvent::Freewheel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sample_rate (&mut self, _: &Client, _: Frames) -> Control {
|
fn sample_rate (&mut self, _: &Client, frames: Frames) -> Control {
|
||||||
self.0(AppEvent::Jack(JackEvent::SampleRate));
|
self.0(AppEvent::Jack(JackEvent::SampleRate(frames)));
|
||||||
Control::Quit
|
Control::Quit
|
||||||
}
|
}
|
||||||
|
|
||||||
fn client_registration (&mut self, _: &Client, name: &str, is_reg: bool) {
|
fn client_registration (&mut self, _: &Client, name: &str, reg: bool) {
|
||||||
//println!("JACK: {} client with name \"{name}\"",
|
self.0(AppEvent::Jack(JackEvent::ClientRegistration(name.into(), reg)));
|
||||||
//if is_reg { "registered" } else { "unregistered" });
|
|
||||||
self.0(AppEvent::Jack(JackEvent::ClientRegistration));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn port_registration (&mut self, _: &Client, port_id: PortId, is_reg: bool) {
|
fn port_registration (&mut self, _: &Client, id: PortId, reg: bool) {
|
||||||
//println!("JACK: {} port with id {port_id}",
|
self.0(AppEvent::Jack(JackEvent::PortRegistration(id, reg)));
|
||||||
//if is_reg { "registered" } else { "unregistered" });
|
|
||||||
self.0(AppEvent::Jack(JackEvent::PortRegistration));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn port_rename (&mut self, _: &Client, id: PortId, old: &str, new: &str) -> Control {
|
fn port_rename (&mut self, _: &Client, id: PortId, old: &str, new: &str) -> Control {
|
||||||
//println!("JACK: port with id {id} renamed from {old} to {new}",);
|
self.0(AppEvent::Jack(JackEvent::PortRename(id, old.into(), new.into())));
|
||||||
self.0(AppEvent::Jack(JackEvent::PortRename));
|
|
||||||
Control::Continue
|
Control::Continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ports_connected (&mut self, _: &Client, a: PortId, b: PortId, are: bool) {
|
fn ports_connected (&mut self, _: &Client, a: PortId, b: PortId, are: bool) {
|
||||||
//println!("JACK: ports with id {a} and {b} are {}", if are {
|
self.0(AppEvent::Jack(JackEvent::PortsConnected(a, b, are)));
|
||||||
//"connected"
|
|
||||||
//} else {
|
|
||||||
//"disconnected"
|
|
||||||
//});
|
|
||||||
self.0(AppEvent::Jack(JackEvent::PortsConnected));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn graph_reorder (&mut self, _: &Client) -> Control {
|
fn graph_reorder (&mut self, _: &Client) -> Control {
|
||||||
//println!("JACK: graph reordered");
|
|
||||||
self.0(AppEvent::Jack(JackEvent::GraphReorder));
|
self.0(AppEvent::Jack(JackEvent::GraphReorder));
|
||||||
Control::Continue
|
Control::Continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fn xrun (&mut self, _: &Client) -> Control {
|
fn xrun (&mut self, _: &Client) -> Control {
|
||||||
//println!("JACK: xrun occurred");
|
|
||||||
self.0(AppEvent::Jack(JackEvent::XRun));
|
self.0(AppEvent::Jack(JackEvent::XRun));
|
||||||
Control::Continue
|
Control::Continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue