control transport values

This commit is contained in:
🪞👃🪞 2024-07-12 16:56:19 +03:00
parent 33e5f47526
commit 45021bc77a
10 changed files with 168 additions and 86 deletions

View file

@ -130,7 +130,7 @@ impl<'a> ArrangerView<'a> {
let mut width = 0;
for y in 0..area.height {
if y == 0 {
"MIX".blit(buf, area.x + 1, area.y + y, style1)?;
//"MIX".blit(buf, area.x + 1, area.y + y, style1)?;
} else if y % 2 == 1 {
let index = y as usize / 2;
if let Some(track) = self.tracks.get(index) {
@ -156,7 +156,7 @@ impl<'a> ArrangerView<'a> {
area.x = area.x + 1;
for y in 0..area.height {
if y == 0 {
" MON ".blit(buf, area.x, area.y + y, style2)?;
//" MON ".blit(buf, area.x, area.y + y, style2)?;
} else if y % 2 == 1 {
let index = y as usize / 2;
if let Some(track) = self.tracks.get(index) {
@ -179,7 +179,7 @@ impl<'a> ArrangerView<'a> {
area.x = area.x + 1;
for y in 0..area.height {
if y == 0 {
" REC ".blit(buf, area.x, area.y + y, style2)?;
//" REC ".blit(buf, area.x, area.y + y, style2)?;
} else if y % 2 == 1 {
let index = y as usize / 2;
if let Some(track) = self.tracks.get(index) {
@ -202,7 +202,7 @@ impl<'a> ArrangerView<'a> {
area.x = area.x + 1;
for y in 0..area.height {
if y == 0 {
" OVR ".blit(buf, area.x, area.y + y, style2)?;
//" OVR ".blit(buf, area.x, area.y + y, style2)?;
} else if y % 2 == 1 {
let index = y as usize / 2;
if let Some(track) = self.tracks.get(index) {
@ -225,7 +225,7 @@ impl<'a> ArrangerView<'a> {
area.x = area.x + 1;
for y in 0..area.height {
if y == 0 {
" DEL ".blit(buf, area.x, area.y + y, style2)?;
//" DEL ".blit(buf, area.x, area.y + y, style2)?;
} else if y % 2 == 1 {
let index = y as usize / 2;
if let Some(_) = self.tracks.get(index) {
@ -244,7 +244,7 @@ impl<'a> ArrangerView<'a> {
area.x = area.x + 1;
for y in 0..area.height {
if y == 0 {
" GAIN ".blit(buf, area.x, area.y + y, style2)?;
//" GAIN ".blit(buf, area.x, area.y + y, style2)?;
} else if y % 2 == 1 {
let index = y as usize / 2;
if let Some(_) = self.tracks.get(index) {

View file

@ -48,11 +48,11 @@ render!(HelpModal |self, buf, area|{
let y = y + 1;
for i in 0..height-3 {
let y = y + i;
if let Some(command) = crate::control::KEYMAP_FOCUS.get(i as usize) {
if let Some(command) = crate::control::focus::KEYMAP_FOCUS.get(i as usize) {
format!("{:?}", command.0).blit(buf, x, y, Some(Style::default().white().bold()))?;
command.2.blit(buf, x + 11, y, Some(Style::default().white().bold()))?;
command.3.blit(buf, x + 26, y, Some(Style::default().white().dim()))?;
} else if let Some(command) = crate::control::KEYMAP.get((i as usize) - crate::control::KEYMAP_FOCUS.len()) {
} else if let Some(command) = crate::control::KEYMAP.get((i as usize) - crate::control::focus::KEYMAP_FOCUS.len()) {
format!("{:?}", command.0).blit(buf, x, y, Some(Style::default().white().bold()))?;
command.2.blit(buf, x + 11, y, Some(Style::default().white().bold()))?;
command.3.blit(buf, x + 26, y, Some(Style::default().white().dim()))?;

View file

@ -11,9 +11,9 @@ render!(TransportToolbar |self, buf, area| {
let bpm = self.bpm();
let pulse = self.pulse();
let usecs = self.usecs();
let Self { quant, focused, entered, .. } = self;
let Self { quant, sync, focused, entered, .. } = self;
fill_bg(buf, area, Nord::bg_lo(*focused, *entered));
let area = Split::right([
Split::right([
// Play/Pause button
&|buf: &mut Buffer, Rect { x, y, .. }: Rect|{
@ -38,21 +38,33 @@ render!(TransportToolbar |self, buf, area| {
&|buf: &mut Buffer, Rect { x, y, .. }: Rect|{
"BPM".blit(buf, x, y, Some(not_dim))?;
let width = format!("{}.{:03}", bpm, bpm % 1).blit(buf, x, y + 1, Some(not_dim_bold))?.width;
Ok(Rect { x, y, width: (width + 2).max(10), height: 2 })
let area = Rect { x, y, width: (width + 2).max(10), height: 2 };
if self.focused && self.entered && self.selected == TransportFocus::BPM {
Corners(Style::default().green().not_dim()).draw(buf, Rect { x: area.x - 1, ..area })?;
}
Ok(area)
},
// Quantization
&|buf: &mut Buffer, Rect { x, y, .. }: Rect|{
"QUANT".blit(buf, x, y, Some(not_dim))?;
let width = ppq_to_name(*quant).blit(buf, x, y + 1, Some(not_dim_bold))?.width;
Ok(Rect { x, y, width: (width + 2).max(10), height: 2 })
let area = Rect { x, y, width: (width + 2).max(10), height: 2 };
if self.focused && self.entered && self.selected == TransportFocus::Quant {
Corners(Style::default().green().not_dim()).draw(buf, Rect { x: area.x - 1, ..area })?;
}
Ok(area)
},
// Clip launch sync
&|buf: &mut Buffer, Rect { x, y, .. }: Rect|{
"SYNC".blit(buf, x, y, Some(not_dim))?;
let width = "4/4".blit(buf, x, y + 1, Some(not_dim_bold))?.width;
Ok(Rect { x, y, width: (width + 2).max(10), height: 2 })
let width = ppq_to_name(*sync).blit(buf, x, y + 1, Some(not_dim_bold))?.width;
let area = Rect { x, y, width: (width + 2).max(10), height: 2 };
if self.focused && self.entered && self.selected == TransportFocus::Sync {
Corners(Style::default().green().not_dim()).draw(buf, Rect { x: area.x - 1, ..area })?;
}
Ok(area)
},
// Clock
@ -65,13 +77,7 @@ render!(TransportToolbar |self, buf, area| {
timer.blit(buf, x + width - timer.len() as u16 - 1, y, Some(not_dim))
}
]).render(buf, area)?;
Ok(if *focused && *entered {
Corners(Style::default().green().not_dim()).draw(buf, area)?
} else {
area
})
]).render(buf, area)
});
// Record button/indicator