More colors for shallow scripts and more steps

This commit is contained in:
2026-01-23 00:36:04 +01:00
parent 88b6f64a72
commit 1aad52eed1
5 changed files with 33 additions and 23 deletions

View File

@@ -148,12 +148,7 @@ impl App {
pub fn step_up(&mut self) {
let len = self.current_edit_pattern().length;
let num_rows = match len {
0..=8 => 1,
9..=16 => 2,
17..=24 => 3,
_ => 4,
};
let num_rows = len.div_ceil(8);
let steps_per_row = len.div_ceil(num_rows);
if self.editor_ctx.step >= steps_per_row {
@@ -166,12 +161,7 @@ impl App {
pub fn step_down(&mut self) {
let len = self.current_edit_pattern().length;
let num_rows = match len {
0..=8 => 1,
9..=16 => 2,
17..=24 => 3,
_ => 4,
};
let num_rows = len.div_ceil(8);
let steps_per_row = len.div_ceil(num_rows);
self.editor_ctx.step = (self.editor_ctx.step + steps_per_row) % len;

View File

@@ -1,4 +1,4 @@
pub const MAX_BANKS: usize = 16;
pub const MAX_PATTERNS: usize = 16;
pub const MAX_STEPS: usize = 32;
pub const MAX_STEPS: usize = 128;
pub const DEFAULT_LENGTH: usize = 16;

View File

@@ -131,7 +131,7 @@ impl Pattern {
}
pub fn set_length(&mut self, length: usize) {
let length = length.clamp(2, MAX_STEPS);
let length = length.clamp(1, MAX_STEPS);
while self.steps.len() < length {
self.steps.push(Step::default());
}

View File

@@ -41,12 +41,7 @@ fn render_sequencer(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot,
let pattern = app.current_edit_pattern();
let length = pattern.length;
let num_rows = match length {
0..=8 => 1,
9..=16 => 2,
17..=24 => 3,
_ => 4,
};
let num_rows = length.div_ceil(8);
let steps_per_row = length.div_ceil(num_rows);
let spacing = num_rows.saturating_sub(1) as u16;
@@ -110,12 +105,37 @@ fn render_tile(
false
};
let link_color = step.and_then(|s| s.source).map(|src| {
const BRIGHT: [(u8, u8, u8); 5] = [
(180, 140, 220),
(220, 140, 170),
(220, 180, 130),
(130, 180, 220),
(170, 220, 140),
];
const DIM: [(u8, u8, u8); 5] = [
(90, 70, 120),
(120, 70, 85),
(120, 90, 65),
(65, 90, 120),
(85, 120, 70),
];
let i = src % 5;
(BRIGHT[i], DIM[i])
});
let (bg, fg) = match (is_playing, is_active, is_selected, is_linked) {
(true, true, _, _) => (Color::Rgb(195, 85, 65), Color::White),
(true, false, _, _) => (Color::Rgb(180, 120, 45), Color::Black),
(false, true, true, true) => (Color::Rgb(180, 140, 220), Color::Black),
(false, true, true, true) => {
let (r, g, b) = link_color.unwrap().0;
(Color::Rgb(r, g, b), Color::Black)
}
(false, true, true, false) => (Color::Rgb(0, 220, 180), Color::Black),
(false, true, false, true) => (Color::Rgb(90, 70, 120), Color::White),
(false, true, false, true) => {
let (r, g, b) = link_color.unwrap().1;
(Color::Rgb(r, g, b), Color::White)
}
(false, true, false, false) => (Color::Rgb(45, 106, 95), Color::White),
(false, false, true, _) => (Color::Rgb(80, 180, 255), Color::Black),
(false, false, false, _) => (Color::Rgb(45, 48, 55), Color::Rgb(120, 125, 135)),

View File

@@ -319,7 +319,7 @@ fn render_modal(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot, term
}
Modal::SetPattern { field, input } => {
let (title, hint) = match field {
PatternField::Length => ("Set Length (2-32)", "Enter number"),
PatternField::Length => ("Set Length (1-128)", "Enter number"),
PatternField::Speed => ("Set Speed", "1/8x, 1/4x, 1/2x, 1x, 2x, 4x, 8x"),
};
TextInputModal::new(title, input)