mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
some more core refactor before fixing the mess
This commit is contained in:
parent
fe09536a45
commit
0bbf74e915
12 changed files with 31 additions and 28 deletions
|
|
@ -1,6 +1,12 @@
|
||||||
use jack::*;
|
use jack::*;
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
|
submod! {
|
||||||
|
device
|
||||||
|
event
|
||||||
|
ports
|
||||||
|
}
|
||||||
|
|
||||||
/// A UI component that may be associated with a JACK client by the `Jack` factory.
|
/// A UI component that may be associated with a JACK client by the `Jack` factory.
|
||||||
pub trait Device<E: Engine>: Component<E> + Process {
|
pub trait Device<E: Engine>: Component<E> + Process {
|
||||||
/// Perform type erasure for collecting heterogeneous devices.
|
/// Perform type erasure for collecting heterogeneous devices.
|
||||||
|
|
@ -228,4 +234,3 @@ fn query_ports (
|
||||||
ports
|
ports
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::{*, jack::*};
|
use ::jack::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
/// A [Device] bound to a JACK client and a set of ports.
|
/// A [Device] bound to a JACK client and a set of ports.
|
||||||
pub struct JackDevice<E: Engine> {
|
pub struct JackDevice<E: Engine> {
|
||||||
|
|
@ -62,3 +63,4 @@ impl<E: Engine> JackDevice<E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::jack::*;
|
use ::jack::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
/// Notification handler used by the [Jack] factory
|
/// Notification handler used by the [Jack] factory
|
||||||
/// when constructing [JackDevice]s.
|
/// when constructing [JackDevice]s.
|
||||||
|
|
@ -68,4 +69,3 @@ impl<T: Fn(JackEvent) + Send> NotificationHandler for Notifications<T> {
|
||||||
Control::Continue
|
Control::Continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::{*, jack::*};
|
use ::jack::*;
|
||||||
|
use crate::*;
|
||||||
|
|
||||||
/// Collection of JACK ports as [AudioIn]/[AudioOut]/[MidiIn]/[MidiOut].
|
/// Collection of JACK ports as [AudioIn]/[AudioOut]/[MidiIn]/[MidiOut].
|
||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
|
|
@ -91,4 +92,3 @@ pub trait Ports {
|
||||||
)?}
|
)?}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,6 +25,9 @@ pub trait HandleContext {}
|
||||||
pub trait RenderContext {}
|
pub trait RenderContext {}
|
||||||
|
|
||||||
submod! {
|
submod! {
|
||||||
render
|
exit
|
||||||
|
focus
|
||||||
handle
|
handle
|
||||||
|
keymap
|
||||||
|
render
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,16 @@ pub trait Exit: Send {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Marker trait for [Component]s that can [Exit]
|
||||||
|
pub trait ExitableComponent<E>: Exit + Component<E> where E: Engine {
|
||||||
|
/// Perform type erasure for collecting heterogeneous components.
|
||||||
|
fn boxed (self) -> Box<dyn ExitableComponent<E>> where Self: Sized + 'static {
|
||||||
|
Box::new(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<E: Engine, C: Component<E> + Exit> ExitableComponent<E> for C {}
|
||||||
|
|
||||||
#[macro_export] macro_rules! exit {
|
#[macro_export] macro_rules! exit {
|
||||||
($T:ty) => {
|
($T:ty) => {
|
||||||
impl Exit for $T {
|
impl Exit for $T {
|
||||||
|
|
@ -20,13 +30,3 @@ pub trait Exit: Send {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Marker trait for [Component]s that can [Exit]
|
|
||||||
pub trait ExitableComponent<E>: Exit + Component<E> where E: Engine {
|
|
||||||
/// Perform type erasure for collecting heterogeneous components.
|
|
||||||
fn boxed (self) -> Box<dyn ExitableComponent<E>> where Self: Sized + 'static {
|
|
||||||
Box::new(self)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<E: Engine, C: Component<E> + Exit> ExitableComponent<E> for C {}
|
|
||||||
|
|
@ -27,16 +27,10 @@ use better_panic::{Settings, Verbosity};
|
||||||
}
|
}
|
||||||
|
|
||||||
submod! {
|
submod! {
|
||||||
|
audio
|
||||||
component
|
component
|
||||||
edn
|
edn
|
||||||
engine
|
engine
|
||||||
exit
|
|
||||||
focus
|
|
||||||
jack_core
|
|
||||||
jack_device
|
|
||||||
jack_event
|
|
||||||
jack_ports
|
|
||||||
keymap
|
|
||||||
space
|
space
|
||||||
time
|
time
|
||||||
tui
|
tui
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
use crate::*;
|
|
||||||
|
|
@ -77,7 +77,7 @@ impl<'a> Render<Tui> for RowSeparators<'a> {
|
||||||
if y >= to.buffer().area.height {
|
if y >= to.buffer().area.height {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
for x in area.x..area.width+area.y-2 {
|
for x in area.x..(area.width+area.y).saturating_sub(2) {
|
||||||
let cell = to.buffer().get_mut(x, y);
|
let cell = to.buffer().get_mut(x, y);
|
||||||
cell.modifier = Modifier::UNDERLINED;
|
cell.modifier = Modifier::UNDERLINED;
|
||||||
cell.underline_color = Nord::SEPARATOR;
|
cell.underline_color = Nord::SEPARATOR;
|
||||||
|
|
|
||||||
|
|
@ -143,8 +143,8 @@ impl<'a> Render<Tui> for SequenceNotes<'a> {
|
||||||
let area = Rect {
|
let area = Rect {
|
||||||
x: area.x + Sequencer::H_KEYS_OFFSET as u16,
|
x: area.x + Sequencer::H_KEYS_OFFSET as u16,
|
||||||
y: area.y + 1,
|
y: area.y + 1,
|
||||||
width: area.width - Sequencer::H_KEYS_OFFSET as u16,
|
width: area.width.saturating_sub(Sequencer::H_KEYS_OFFSET as u16),
|
||||||
height: area.height - 2
|
height: area.height.saturating_sub(2),
|
||||||
};
|
};
|
||||||
to.buffer_update(area, &move |cell, x, y|{
|
to.buffer_update(area, &move |cell, x, y|{
|
||||||
let src_x = ((x as usize + self.0.time_axis.start) * self.0.time_axis.scale) as usize;
|
let src_x = ((x as usize + self.0.time_axis.start) * self.0.time_axis.scale) as usize;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue