mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
dsl_ns!
This commit is contained in:
parent
72975c861a
commit
525ed15466
5 changed files with 643 additions and 665 deletions
57
crates/app/app_jack.rs
Normal file
57
crates/app/app_jack.rs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
use crate::*;
|
||||
|
||||
impl HasJack<'static> for App {
|
||||
fn jack (&self) -> &Jack<'static> {
|
||||
&self.jack
|
||||
}
|
||||
}
|
||||
|
||||
audio!(
|
||||
|self: App, client, scope|{
|
||||
let t0 = self.perf.get_t0();
|
||||
self.clock().update_from_scope(scope).unwrap();
|
||||
let midi_in = self.project.midi_input_collect(scope);
|
||||
if let Some(editor) = &self.editor() {
|
||||
let mut pitch: Option<u7> = None;
|
||||
for port in midi_in.iter() {
|
||||
for event in port.iter() {
|
||||
if let (_, Ok(LiveEvent::Midi {message: MidiMessage::NoteOn {ref key, ..}, ..}))
|
||||
= event
|
||||
{
|
||||
pitch = Some(key.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(pitch) = pitch {
|
||||
editor.set_note_pos(pitch.as_int() as usize);
|
||||
}
|
||||
}
|
||||
let result = self.project.process_tracks(client, scope);
|
||||
self.perf.update_from_jack_scope(t0, scope);
|
||||
result
|
||||
};
|
||||
|self, event|{
|
||||
use JackEvent::*;
|
||||
match event {
|
||||
SampleRate(sr) => {
|
||||
self.clock().timebase.sr.set(sr as f64);
|
||||
},
|
||||
PortRegistration(id, true) => {
|
||||
//let port = self.jack().port_by_id(id);
|
||||
//println!("\rport add: {id} {port:?}");
|
||||
//println!("\rport add: {id}");
|
||||
},
|
||||
PortRegistration(id, false) => {
|
||||
/*println!("\rport del: {id}")*/
|
||||
},
|
||||
PortsConnected(a, b, true) => { /*println!("\rport conn: {a} {b}")*/ },
|
||||
PortsConnected(a, b, false) => { /*println!("\rport disc: {a} {b}")*/ },
|
||||
ClientRegistration(id, true) => {},
|
||||
ClientRegistration(id, false) => {},
|
||||
ThreadInit => {},
|
||||
XRun => {},
|
||||
GraphReorder => {},
|
||||
_ => { panic!("{event:?}"); }
|
||||
}
|
||||
}
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue