mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +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)]
|
||||
pub enum JackEvent {
|
||||
ThreadInit,
|
||||
Shutdown,
|
||||
Freewheel,
|
||||
SampleRate,
|
||||
ClientRegistration,
|
||||
PortRegistration,
|
||||
PortRename,
|
||||
PortsConnected,
|
||||
Shutdown(ClientStatus, String),
|
||||
Freewheel(bool),
|
||||
SampleRate(Frames),
|
||||
ClientRegistration(String, bool),
|
||||
PortRegistration(PortId, bool),
|
||||
PortRename(PortId, String, String),
|
||||
PortsConnected(PortId, PortId, bool),
|
||||
GraphReorder,
|
||||
XRun,
|
||||
}
|
||||
|
|
@ -215,60 +215,45 @@ pub struct Notifications<T: Fn(AppEvent) + Send>(T);
|
|||
|
||||
impl<T: Fn(AppEvent) + Send> NotificationHandler for Notifications<T> {
|
||||
fn thread_init (&self, _: &Client) {
|
||||
//println!("JACK: thread init");
|
||||
self.0(AppEvent::Jack(JackEvent::ThreadInit));
|
||||
}
|
||||
|
||||
fn shutdown (&mut self, status: ClientStatus, reason: &str) {
|
||||
//println!("JACK: shutdown with status {:?} because \"{}\"", status, reason);
|
||||
self.0(AppEvent::Jack(JackEvent::Shutdown));
|
||||
self.0(AppEvent::Jack(JackEvent::Shutdown(status, reason.into())));
|
||||
}
|
||||
|
||||
fn freewheel (&mut self, _: &Client, is_enabled: bool) {
|
||||
//println!("JACK: freewheel mode is {}", if is_enabled { "on" } else { "off" });
|
||||
self.0(AppEvent::Jack(JackEvent::Freewheel));
|
||||
fn freewheel (&mut self, _: &Client, enabled: bool) {
|
||||
self.0(AppEvent::Jack(JackEvent::Freewheel(enabled)));
|
||||
}
|
||||
|
||||
fn sample_rate (&mut self, _: &Client, _: Frames) -> Control {
|
||||
self.0(AppEvent::Jack(JackEvent::SampleRate));
|
||||
fn sample_rate (&mut self, _: &Client, frames: Frames) -> Control {
|
||||
self.0(AppEvent::Jack(JackEvent::SampleRate(frames)));
|
||||
Control::Quit
|
||||
}
|
||||
|
||||
fn client_registration (&mut self, _: &Client, name: &str, is_reg: bool) {
|
||||
//println!("JACK: {} client with name \"{name}\"",
|
||||
//if is_reg { "registered" } else { "unregistered" });
|
||||
self.0(AppEvent::Jack(JackEvent::ClientRegistration));
|
||||
fn client_registration (&mut self, _: &Client, name: &str, reg: bool) {
|
||||
self.0(AppEvent::Jack(JackEvent::ClientRegistration(name.into(), reg)));
|
||||
}
|
||||
|
||||
fn port_registration (&mut self, _: &Client, port_id: PortId, is_reg: bool) {
|
||||
//println!("JACK: {} port with id {port_id}",
|
||||
//if is_reg { "registered" } else { "unregistered" });
|
||||
self.0(AppEvent::Jack(JackEvent::PortRegistration));
|
||||
fn port_registration (&mut self, _: &Client, id: PortId, reg: bool) {
|
||||
self.0(AppEvent::Jack(JackEvent::PortRegistration(id, reg)));
|
||||
}
|
||||
|
||||
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));
|
||||
self.0(AppEvent::Jack(JackEvent::PortRename(id, old.into(), new.into())));
|
||||
Control::Continue
|
||||
}
|
||||
|
||||
fn ports_connected (&mut self, _: &Client, a: PortId, b: PortId, are: bool) {
|
||||
//println!("JACK: ports with id {a} and {b} are {}", if are {
|
||||
//"connected"
|
||||
//} else {
|
||||
//"disconnected"
|
||||
//});
|
||||
self.0(AppEvent::Jack(JackEvent::PortsConnected));
|
||||
self.0(AppEvent::Jack(JackEvent::PortsConnected(a, b, are)));
|
||||
}
|
||||
|
||||
fn graph_reorder (&mut self, _: &Client) -> Control {
|
||||
//println!("JACK: graph reordered");
|
||||
self.0(AppEvent::Jack(JackEvent::GraphReorder));
|
||||
Control::Continue
|
||||
}
|
||||
|
||||
fn xrun (&mut self, _: &Client) -> Control {
|
||||
//println!("JACK: xrun occurred");
|
||||
self.0(AppEvent::Jack(JackEvent::XRun));
|
||||
Control::Continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue