mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-11 22:26:44 +01:00
reenable playhead for playing clip
This commit is contained in:
parent
0f3103a003
commit
b2680914d7
3 changed files with 28 additions and 11 deletions
|
|
@ -55,8 +55,8 @@ impl Content for PhraseEditor<Tui> {
|
|||
let ScaledAxis {
|
||||
start: time_start, point: time_point, clamp: time_clamp, scale: time_scale
|
||||
} = *self.time_axis.read().unwrap();
|
||||
let color = Color::Rgb(0,255,0);
|
||||
let color = phrase.as_ref().map(|p|p.read().unwrap().color.base.rgb).unwrap_or(color);
|
||||
//let color = Color::Rgb(0,255,0);
|
||||
//let color = phrase.as_ref().map(|p|p.read().unwrap().color.base.rgb).unwrap_or(color);
|
||||
let keys = CustomWidget::new(|to:[u16;2]|Ok(Some(to.clip_w(5))), move|to: &mut TuiOutput|{
|
||||
Ok(if to.area().h() >= 2 {
|
||||
to.buffer_update(to.area().set_w(5), &|cell, x, y|{
|
||||
|
|
@ -109,18 +109,18 @@ impl Content for PhraseEditor<Tui> {
|
|||
}
|
||||
})
|
||||
});
|
||||
let playhead_inactive = Style::default().fg(Color::Rgb(255,255,255)).bg(Color::Rgb(0,0,0));
|
||||
let playhead_inactive = Style::default().fg(Color::Rgb(255,255,255)).bg(Color::Rgb(40,50,30));
|
||||
let playhead_active = playhead_inactive.clone().yellow().bold().not_dim();
|
||||
let playhead = CustomWidget::new(
|
||||
|to:[u16;2]|Ok(Some(to.clip_h(1))),
|
||||
move|to: &mut TuiOutput|{
|
||||
if let Some(_) = phrase {
|
||||
let now = self.now.load(Ordering::Relaxed); // TODO FIXME: self.now % phrase.read().unwrap().length;
|
||||
let now = self.now.get() as usize; // TODO FIXME: self.now % phrase.read().unwrap().length;
|
||||
let time_clamp = time_clamp
|
||||
.expect("time_axis of sequencer expected to be clamped");
|
||||
for x in 0..time_clamp/time_scale {
|
||||
let this_step = (x * time_scale + time_start + 0) * time_scale;
|
||||
let next_step = (x * time_scale + time_start + 1) * time_scale;
|
||||
for x in 0..(time_clamp/time_scale).saturating_sub(time_start) {
|
||||
let this_step = time_start + (x + 0) * time_scale;
|
||||
let next_step = time_start + (x + 1) * time_scale;
|
||||
let x = to.area().x() + x as u16;
|
||||
let active = this_step <= now && now < next_step;
|
||||
let character = if active { "|" } else { "·" };
|
||||
|
|
@ -136,8 +136,7 @@ impl Content for PhraseEditor<Tui> {
|
|||
let border = Lozenge(Style::default().bg(Color::Rgb(40, 50, 30)).fg(border_color));
|
||||
let note_area = lay!(notes, cursor).fill_x();
|
||||
let piano_roll = row!(keys, note_area).fill_x();
|
||||
let content_bg = Color::Rgb(40, 50, 30);
|
||||
let content = piano_roll.bg(content_bg).border(border);
|
||||
let content = piano_roll.bg(Color::Rgb(40, 50, 30)).border(border);
|
||||
let content = lay!(content, playhead);
|
||||
let mut upper_left = String::from("Sequencer");
|
||||
if let Some(phrase) = phrase {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue