mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
sweeeeping sweep
This commit is contained in:
parent
c9b09b7dea
commit
e677d1d7d4
38 changed files with 766 additions and 691 deletions
|
|
@ -111,7 +111,7 @@ audio!(|self: Groovebox, client, scope|{
|
|||
self.perf.update(t0, scope);
|
||||
Control::Continue
|
||||
});
|
||||
render!(<Tui>|self:Groovebox|{
|
||||
render!(Tui: (self: Groovebox) => {
|
||||
let w = self.size.w();
|
||||
let phrase_w = if w > 60 { 20 } else if w > 40 { 15 } else { 10 };
|
||||
let pool_w = if self.pool.visible { phrase_w } else { 0 };
|
||||
|
|
@ -120,19 +120,21 @@ render!(<Tui>|self:Groovebox|{
|
|||
let color = self.player.play_phrase().as_ref()
|
||||
.and_then(|(_,p)|p.as_ref().map(|p|p.read().unwrap().color))
|
||||
.clone();
|
||||
let transport = Fixed::y(3, row!([
|
||||
let transport = Fixed::y(3, row!(
|
||||
PlayPause(self.clock().is_rolling()),
|
||||
TransportView::new(self, color, true),
|
||||
]));
|
||||
let selector = Push::x(sampler_w, Fixed::y(1, row!(![
|
||||
));
|
||||
let selector = Push::x(sampler_w, Fixed::y(1, row!(
|
||||
PhraseSelector::play_phrase(&self.player),
|
||||
PhraseSelector::next_phrase(&self.player),
|
||||
])));
|
||||
let pool = move|x|Split::w(false, pool_w, Pull::y(1, Fill::y(Align::e(PoolView(&self.pool)))), x);
|
||||
let sampler = move|x|Split::e(false, sampler_w, Fill::xy(col!([
|
||||
)));
|
||||
let pool = move|x|Split::w(false, pool_w,
|
||||
Pull::y(1, Fill::y(Align::e(PoolView(&self.pool)))),
|
||||
x);
|
||||
let sampler = move|x|Split::e(false, sampler_w, Fill::xy(col!(
|
||||
Meters(self.sampler.input_meter.as_ref()),
|
||||
GrooveboxSamples(self)
|
||||
])), x);
|
||||
)), x);
|
||||
let status = EditStatus(&self.sampler, &self.editor, note_pt, pool(sampler(&self.editor)));
|
||||
Fill::xy(lay!([
|
||||
&self.size,
|
||||
|
|
@ -145,9 +147,9 @@ render!(<Tui>|self:Groovebox|{
|
|||
]))
|
||||
});
|
||||
|
||||
struct EditStatus<'a, T: Render<Tui>>(&'a Sampler, &'a MidiEditor, usize, T);
|
||||
impl<'a, T: Render<Tui>> Content<Tui> for EditStatus<'a, T> {
|
||||
fn content (&self) -> Option<impl Render<Tui>> {
|
||||
struct EditStatus<'a, T: Content<Tui>>(&'a Sampler, &'a MidiEditor, usize, T);
|
||||
impl<'a, T: Content<Tui>> Content<Tui> for EditStatus<'a, T> {
|
||||
fn content (&self) -> Option<impl Content<Tui>> {
|
||||
Some(Split::n(false, 9, col!([
|
||||
row!(|add|{
|
||||
if let Some(sample) = &self.0.mapped[self.2] {
|
||||
|
|
@ -169,7 +171,7 @@ impl<'a, T: Render<Tui>> Content<Tui> for EditStatus<'a, T> {
|
|||
]), &self.3))
|
||||
}
|
||||
}
|
||||
impl<'a, T: Render<Tui>> Render<Tui> for EditStatus<'a, T> {
|
||||
impl<'a, T: Content<Tui>> Content<Tui> for EditStatus<'a, T> {
|
||||
fn min_size (&self, to: [u16;2]) -> Perhaps<[u16;2]> {
|
||||
self.content().unwrap().min_size(to)
|
||||
}
|
||||
|
|
@ -179,11 +181,11 @@ impl<'a, T: Render<Tui>> Render<Tui> for EditStatus<'a, T> {
|
|||
}
|
||||
|
||||
struct GrooveboxSamples<'a>(&'a Groovebox);
|
||||
render!(<Tui>|self: GrooveboxSamples<'a>|{
|
||||
render!(Tui: (self: GrooveboxSamples<'a>) => {
|
||||
let note_lo = self.0.editor.note_lo().load(Relaxed);
|
||||
let note_pt = self.0.editor.note_point();
|
||||
let note_hi = self.0.editor.note_hi();
|
||||
Fill::xy(col!(note in (note_lo..=note_hi).rev() => {
|
||||
Fill::xy(col_iter!((note_lo..=note_hi).rev() => |note| {
|
||||
let mut bg = if note == note_pt { TuiTheme::g(64) } else { Color::Reset };
|
||||
let mut fg = TuiTheme::g(160);
|
||||
if let Some((index, _)) = self.0.sampler.recording {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue