mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 12:46:42 +01:00
constrain tracks from left side
This commit is contained in:
parent
e2023bdf53
commit
3502070613
5 changed files with 22 additions and 22 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
use Color::*;
|
||||||
/// A clip, rendered as a horizontal piano roll.
|
/// A clip, rendered as a horizontal piano roll.
|
||||||
pub struct PianoHorizontal {
|
pub struct PianoHorizontal {
|
||||||
pub clip: Option<Arc<RwLock<MidiClip>>>,
|
pub clip: Option<Arc<RwLock<MidiClip>>>,
|
||||||
|
|
@ -82,7 +83,7 @@ impl PianoHorizontal {
|
||||||
}
|
}
|
||||||
/// Draw the piano roll background using full blocks on note on and half blocks on legato: █▄ █▄ █▄
|
/// Draw the piano roll background using full blocks on note on and half blocks on legato: █▄ █▄ █▄
|
||||||
fn draw_fg (buf: &mut BigBuffer, clip: &MidiClip, zoom: usize) {
|
fn draw_fg (buf: &mut BigBuffer, clip: &MidiClip, zoom: usize) {
|
||||||
let style = Style::default().fg(clip.color.base.rgb);//.bg(Color::Rgb(0, 0, 0));
|
let style = Style::default().fg(clip.color.base.rgb);//.bg(Rgb(0, 0, 0));
|
||||||
let mut notes_on = [false;128];
|
let mut notes_on = [false;128];
|
||||||
for (x, time_start) in (0..clip.length).step_by(zoom).enumerate() {
|
for (x, time_start) in (0..clip.length).step_by(zoom).enumerate() {
|
||||||
for (_y, note) in (0..=127).rev().enumerate() {
|
for (_y, note) in (0..=127).rev().enumerate() {
|
||||||
|
|
@ -182,9 +183,9 @@ impl PianoHorizontal {
|
||||||
let note_lo = state.note_lo().get();
|
let note_lo = state.note_lo().get();
|
||||||
let note_hi = state.note_hi();
|
let note_hi = state.note_hi();
|
||||||
let note_pos = state.note_pos();
|
let note_pos = state.note_pos();
|
||||||
let key_style = Some(Style::default().fg(Color::Rgb(192, 192, 192)).bg(Color::Rgb(0, 0, 0)));
|
let key_style = Some(Style::default().fg(Rgb(192, 192, 192)).bg(Rgb(0, 0, 0)));
|
||||||
let off_style = Some(Style::default().fg(Tui::g(160)));
|
let off_style = Some(Style::default().fg(Tui::g(255)));
|
||||||
let on_style = Some(Style::default().fg(Tui::g(255)).bg(color.base.rgb).bold());
|
let on_style = Some(Style::default().fg(Rgb(255,0,0)).bg(color.base.rgb).bold());
|
||||||
Fill::y(Fixed::x(self.keys_width, ThunkRender::new(move|to: &mut TuiOut|{
|
Fill::y(Fixed::x(self.keys_width, ThunkRender::new(move|to: &mut TuiOut|{
|
||||||
let [x, y0, _w, _h] = to.area().xywh();
|
let [x, y0, _w, _h] = to.area().xywh();
|
||||||
for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
|
for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
impl Tek {
|
impl Tek {
|
||||||
pub fn view_tracks (&self) -> impl Content<TuiOut> + use<'_> {
|
pub fn view_tracks (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
|
let w = (self.size.w() as u16).saturating_sub(2 * self.w_sidebar());
|
||||||
let data = (self.selected.track().unwrap_or(0), self.tracks().len());
|
let data = (self.selected.track().unwrap_or(0), self.tracks().len());
|
||||||
self.fmtd.write().unwrap().trks.update(Some(data), rewrite!(buf, "({}/{})", data.0, data.1));
|
self.fmtd.write().unwrap().trks.update(Some(data), rewrite!(buf, "{}/{}", data.0, data.1));
|
||||||
self.row(self.w(), 1, Align::w(Bsp::e(
|
self.row(w, 1, Align::w(Bsp::e(
|
||||||
self.button3(" t", "track", self.fmtd.read().unwrap().trks.view.clone()),
|
self.button3(" t", "track", self.fmtd.read().unwrap().trks.view.clone()),
|
||||||
self.button2(" T", "add track"),
|
self.button2(" T", "add track"),
|
||||||
)), self.per_track(|t, track|{
|
)), self.per_track(|t, track|{
|
||||||
|
|
@ -17,8 +18,8 @@ impl Tek {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
pub fn view_scenes (&self) -> impl Content<TuiOut> + use<'_> {
|
pub fn view_scenes (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
let w = self.size.w() as u16;
|
let w = (self.size.w() as u16).saturating_sub(2 * self.w_sidebar());
|
||||||
let h = self.size.h() as u16;
|
let h = (self.size.h() as u16).saturating_sub(self.h_inputs() + self.h_outputs() + 1);
|
||||||
let editing = self.is_editing();
|
let editing = self.is_editing();
|
||||||
let selected_track = self.selected().track();
|
let selected_track = self.selected().track();
|
||||||
let selected_scene = self.selected().scene();
|
let selected_scene = self.selected().scene();
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ impl Tek {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
fn view_clips_into (&self) -> impl Content<TuiOut> + use<'_> {
|
fn view_clips_into (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
self.row_top(self.w(), 2,
|
let w = (self.size.w() as u16).saturating_sub(2 * self.w_sidebar());
|
||||||
|
self.row_top(w, 2,
|
||||||
Bsp::s(Align::e("Input:"), Align::e("Into:")),
|
Bsp::s(Align::e("Input:"), Align::e("Into:")),
|
||||||
self.per_track_top(|_, _|Tui::bg(Reset, Align::c(Bsp::s(
|
self.per_track_top(|_, _|Tui::bg(Reset, Align::c(Bsp::s(
|
||||||
OctaveVertical::default(),
|
OctaveVertical::default(),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
impl Tek {
|
impl Tek {
|
||||||
pub fn view_outputs (&self) -> impl Content<TuiOut> + use<'_> {
|
pub fn view_outputs (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
|
let w = (self.size.w() as u16).saturating_sub(2 * self.w_sidebar());
|
||||||
let fg = Tui::g(224);
|
let fg = Tui::g(224);
|
||||||
Align::n(Bsp::s(
|
Align::n(Bsp::s(
|
||||||
Bsp::s(
|
Bsp::s(
|
||||||
|
|
@ -8,7 +9,7 @@ impl Tek {
|
||||||
self.view_clips_from(),
|
self.view_clips_from(),
|
||||||
),
|
),
|
||||||
Bsp::s(
|
Bsp::s(
|
||||||
self.row_top(self.w(), 1,
|
self.row_top(w, 1,
|
||||||
Fill::x(Align::w(Bsp::e(
|
Fill::x(Align::w(Bsp::e(
|
||||||
self.button3(" o", "midi outs", format!("{}", self.midi_outs.len())),
|
self.button3(" o", "midi outs", format!("{}", self.midi_outs.len())),
|
||||||
self.button2(" O", "add midi out"),
|
self.button2(" O", "add midi out"),
|
||||||
|
|
@ -31,16 +32,12 @@ impl Tek {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
fn view_clips_from (&self) -> impl Content<TuiOut> + use<'_> {
|
fn view_clips_from (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
let heading = Align::e("From:");
|
let w = (self.size.w() as u16).saturating_sub(2 * self.w_sidebar());
|
||||||
let content = self.per_track_top(|_, _|Tui::bg(Reset, Align::c(Bsp::s(
|
self.row_top(w, 2, Align::e("From:"),
|
||||||
OctaveVertical::default(),
|
self.per_track_top(|_, _|Tui::bg(Reset,
|
||||||
" ------ "
|
Align::c(Bsp::s(" ------ ", OctaveVertical::default(),))))) }
|
||||||
))));
|
|
||||||
self.row_top(self.w(), 2, heading, content)
|
|
||||||
}
|
|
||||||
fn view_clips_next (&self) -> impl Content<TuiOut> + use<'_> {
|
fn view_clips_next (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
let heading = Align::e("Next:");
|
let w = (self.size.w() as u16).saturating_sub(2 * self.w_sidebar());
|
||||||
let content = self.per_track_top(|_, _|Tui::bg(Reset, " ----- "));
|
self.row_top(w, 1, Align::e("Next:"),
|
||||||
self.row_top(self.w(), 1, heading, content)
|
self.per_track_top(|_, _|Tui::bg(Reset, " ------ "))) }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
(bsp/n
|
(bsp/n
|
||||||
(fixed/y 1 :toolbar)
|
(fixed/y 2 :toolbar)
|
||||||
(fill/xy (align/c (bsp/a (fill/xy (align/e :pool))
|
(fill/xy (align/c (bsp/a (fill/xy (align/e :pool))
|
||||||
(bsp/a
|
(bsp/a
|
||||||
(fill/xy (align/n (bsp/s :tracks :inputs)))
|
(fill/xy (align/n (bsp/s :tracks :inputs)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue