mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
wip: ArrangerStandalone
This commit is contained in:
parent
1104093395
commit
3cbb2d2e0b
19 changed files with 165 additions and 231 deletions
|
|
@ -98,8 +98,8 @@ pub trait Process {
|
|||
}
|
||||
|
||||
/// Just run thing with JACK. Returns the activated client.
|
||||
pub fn jack_run <T: Sync> (name: &str, app: &Arc<RwLock<T>>) -> Usually<DynamicAsyncClient>
|
||||
where T: Handle + Process + Send + 'static
|
||||
pub fn jack_run <T> (name: &str, app: &Arc<RwLock<T>>) -> Usually<DynamicAsyncClient>
|
||||
where T: Handle + Process + Send + Sync + 'static
|
||||
{
|
||||
let options = ClientOptions::NO_START_SERVER;
|
||||
let (client, _status) = Client::new(name, options)?;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{*, jack::*};
|
||||
use crate::jack::*;
|
||||
|
||||
/// Notification handler used by the [Jack] factory
|
||||
/// when constructing [JackDevice]s.
|
||||
|
|
|
|||
|
|
@ -39,16 +39,16 @@ impl JackPorts {
|
|||
|
||||
/// Trait for things that may expose JACK ports.
|
||||
pub trait Ports {
|
||||
fn audio_ins <'a> (&'a self) -> Usually<Vec<&'a Port<Unowned>>> {
|
||||
fn audio_ins (&self) -> Usually<Vec<&Port<Unowned>>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
fn audio_outs <'a> (&'a self) -> Usually<Vec<&'a Port<Unowned>>> {
|
||||
fn audio_outs (&self) -> Usually<Vec<&Port<Unowned>>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
fn midi_ins <'a> (&'a self) -> Usually<Vec<&'a Port<Unowned>>> {
|
||||
fn midi_ins (&self) -> Usually<Vec<&Port<Unowned>>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
fn midi_outs <'a> (&'a self) -> Usually<Vec<&'a Port<Unowned>>> {
|
||||
fn midi_outs (&self) -> Usually<Vec<&Port<Unowned>>> {
|
||||
Ok(vec![])
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ pub(crate) use ratatui::buffer::{Buffer, Cell};
|
|||
/// Main thread render loop
|
||||
pub fn render_thread (
|
||||
exited: &Arc<AtomicBool>,
|
||||
device: &Arc<RwLock<impl Render + Send + Sync + 'static>>
|
||||
device: &Arc<RwLock<impl Render + 'static>>
|
||||
) -> Usually<JoinHandle<()>> {
|
||||
let exited = exited.clone();
|
||||
let device = device.clone();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::*;
|
|||
macro_rules! impl_axis_common { ($A:ident $T:ty) => {
|
||||
impl $A<$T> {
|
||||
pub fn start_inc (&mut self) -> $T {
|
||||
self.start = self.start + 1;
|
||||
self.start += 1;
|
||||
self.start
|
||||
}
|
||||
pub fn start_dec (&mut self) -> $T {
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ impl<'a> Split<'a> {
|
|||
let result = item.render(buf, Rect { x, y, width, height })?;
|
||||
match self.1 {
|
||||
Direction::Down => {
|
||||
y = y + result.height;
|
||||
y += result.height;
|
||||
height = height.saturating_sub(result.height);
|
||||
},
|
||||
Direction::Right => {
|
||||
x = x + result.width;
|
||||
x += result.width;
|
||||
width = width.saturating_sub(result.width);
|
||||
},
|
||||
_ => unimplemented!()
|
||||
|
|
@ -135,11 +135,11 @@ impl<'a> SplitFocus<'a> {
|
|||
areas.push(result);
|
||||
match self.0 {
|
||||
Direction::Down => {
|
||||
y = y + result.height;
|
||||
y += result.height;
|
||||
height = height.saturating_sub(result.height);
|
||||
},
|
||||
Direction::Right => {
|
||||
x = x + result.width;
|
||||
x += result.width;
|
||||
width = width.saturating_sub(result.width);
|
||||
},
|
||||
_ => unimplemented!()
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ impl Timebase {
|
|||
self.rate.load(Ordering::Relaxed)
|
||||
}
|
||||
#[inline] fn usec_per_frame (&self) -> f64 {
|
||||
1_000_000 as f64 / self.rate() as f64
|
||||
1_000_000f64 / self.rate()
|
||||
}
|
||||
#[inline] pub fn frame_to_usec (&self, frame: f64) -> f64 {
|
||||
frame * self.usec_per_frame()
|
||||
|
|
@ -43,10 +43,10 @@ impl Timebase {
|
|||
self.bpm.store(bpm, Ordering::Relaxed)
|
||||
}
|
||||
#[inline] fn usec_per_beat (&self) -> f64 {
|
||||
60_000_000f64 / self.bpm() as f64
|
||||
60_000_000f64 / self.bpm()
|
||||
}
|
||||
#[inline] fn beat_per_second (&self) -> f64 {
|
||||
self.bpm() as f64 / 60000000.0
|
||||
self.bpm() / 60000000.0
|
||||
}
|
||||
|
||||
/// Pulses per beat
|
||||
|
|
@ -54,10 +54,10 @@ impl Timebase {
|
|||
self.ppq.load(Ordering::Relaxed)
|
||||
}
|
||||
#[inline] pub fn pulse_per_frame (&self) -> f64 {
|
||||
self.usec_per_pulse() / self.usec_per_frame() as f64
|
||||
self.usec_per_pulse() / self.usec_per_frame()
|
||||
}
|
||||
#[inline] pub fn usec_per_pulse (&self) -> f64 {
|
||||
self.usec_per_beat() / self.ppq() as f64
|
||||
self.usec_per_beat() / self.ppq()
|
||||
}
|
||||
#[inline] pub fn pulse_to_frame (&self, pulses: f64) -> f64 {
|
||||
self.pulse_per_frame() * pulses
|
||||
|
|
@ -69,10 +69,10 @@ impl Timebase {
|
|||
4.0 * self.usec_per_beat() * num / den
|
||||
}
|
||||
#[inline] pub fn frames_per_pulse (&self) -> f64 {
|
||||
self.rate() as f64 / self.pulses_per_second()
|
||||
self.rate() / self.pulses_per_second()
|
||||
}
|
||||
#[inline] fn pulses_per_second (&self) -> f64 {
|
||||
self.beat_per_second() * self.ppq() as f64
|
||||
self.beat_per_second() * self.ppq()
|
||||
}
|
||||
|
||||
#[inline] pub fn note_to_frame (&self, note: (f64, f64)) -> f64 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue