mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
dynamic device activation
This commit is contained in:
parent
b73aa8a0dc
commit
e4f3942757
9 changed files with 484 additions and 587 deletions
|
|
@ -10,12 +10,12 @@ pub struct Transport {
|
|||
impl Transport {
|
||||
pub fn new (name: &str) -> Result<DynamicDevice<Self>, Box<dyn Error>> {
|
||||
let (client, _) = Client::new(name, ClientOptions::NO_START_SERVER)?;
|
||||
Ok(DynamicDevice::new(render, handle, process, Self {
|
||||
DynamicDevice::new(render, handle, process, Self {
|
||||
name: name.into(),
|
||||
transport: client.transport(),
|
||||
timesig: (4.0, 4.0),
|
||||
bpm: 113.0,
|
||||
}))
|
||||
}).activate(client)
|
||||
}
|
||||
|
||||
pub fn play_from_start_or_stop_and_rewind (&mut self) {
|
||||
|
|
@ -233,39 +233,22 @@ pub const ACTIONS: [(&'static str, &'static str);4] = [
|
|||
("(Shift-)Space", "⯈ Play/pause"),
|
||||
];
|
||||
|
||||
struct TransportJack;
|
||||
|
||||
impl NotificationHandler for TransportJack {
|
||||
fn thread_init (&self, _: &Client) {
|
||||
}
|
||||
|
||||
fn shutdown (&mut self, status: ClientStatus, reason: &str) {
|
||||
}
|
||||
|
||||
fn freewheel (&mut self, _: &Client, is_enabled: bool) {
|
||||
}
|
||||
|
||||
impl NotificationHandler for Transport {
|
||||
fn thread_init (&self, _: &Client) {}
|
||||
fn shutdown (&mut self, status: ClientStatus, reason: &str) {}
|
||||
fn freewheel (&mut self, _: &Client, is_enabled: bool) {}
|
||||
fn sample_rate (&mut self, _: &Client, _: Frames) -> Control {
|
||||
Control::Quit
|
||||
}
|
||||
|
||||
fn client_registration (&mut self, _: &Client, name: &str, is_reg: bool) {
|
||||
}
|
||||
|
||||
fn port_registration (&mut self, _: &Client, port_id: PortId, is_reg: bool) {
|
||||
}
|
||||
|
||||
fn client_registration (&mut self, _: &Client, name: &str, is_reg: bool) {}
|
||||
fn port_registration (&mut self, _: &Client, port_id: PortId, is_reg: bool) {}
|
||||
fn port_rename (&mut self, _: &Client, id: PortId, old: &str, new: &str) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
|
||||
fn ports_connected (&mut self, _: &Client, id_a: PortId, id_b: PortId, are: bool) {
|
||||
}
|
||||
|
||||
fn ports_connected (&mut self, _: &Client, id_a: PortId, id_b: PortId, are: bool) {}
|
||||
fn graph_reorder (&mut self, _: &Client) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
|
||||
fn xrun (&mut self, _: &Client) -> Control {
|
||||
Control::Continue
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue