mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
chore: tidy up
This commit is contained in:
parent
5afed6f055
commit
dc09ea901f
10 changed files with 321 additions and 160 deletions
35
src/main.rs
35
src/main.rs
|
|
@ -33,9 +33,13 @@ fn main () -> Result<(), Box<dyn Error>> {
|
|||
Some(cli::Command::Sampler) => engine.run(
|
||||
crate::device::sampler::Sampler::new()?,
|
||||
),
|
||||
Some(cli::Command::Sequencer) => engine.run(
|
||||
crate::device::sequencer::Sequencer::new(Some("Sequencer"))?,
|
||||
),
|
||||
Some(cli::Command::Sequencer { inputs, outputs }) => {
|
||||
engine.run(crate::device::sequencer::Sequencer::new(
|
||||
Some("Sequencer"),
|
||||
Some(&inputs.into_iter().map(|x|x.unwrap()).collect::<Vec<_>>()),
|
||||
Some(&outputs.into_iter().map(|x|x.unwrap()).collect::<Vec<_>>()),
|
||||
)?)
|
||||
},
|
||||
None => engine.run(App {
|
||||
exited: false,
|
||||
mode: Mode::Sequencer,
|
||||
|
|
@ -44,18 +48,26 @@ fn main () -> Result<(), Box<dyn Error>> {
|
|||
)?,
|
||||
focus: 0,
|
||||
devices: vec![
|
||||
crate::device::Device::Sequencer(
|
||||
crate::device::sequencer::Sequencer::new(Some("Melody#000"))?
|
||||
crate::device::Device::Mixer(
|
||||
crate::device::mixer::Mixer::new()?
|
||||
),
|
||||
crate::device::Device::Sequencer(
|
||||
crate::device::sequencer::Sequencer::new(Some("Rhythm#000"))?
|
||||
crate::device::sequencer::Sequencer::new(
|
||||
Some("Melody#000"),
|
||||
None,
|
||||
None
|
||||
)?
|
||||
),
|
||||
crate::device::Device::Sequencer(
|
||||
crate::device::sequencer::Sequencer::new(
|
||||
Some("Rhythm#000"),
|
||||
None,
|
||||
None,
|
||||
)?
|
||||
),
|
||||
crate::device::Device::Sampler(
|
||||
crate::device::sampler::Sampler::new()?
|
||||
),
|
||||
crate::device::Device::Mixer(
|
||||
crate::device::mixer::Mixer::new()?
|
||||
),
|
||||
crate::device::Device::Looper(
|
||||
crate::device::looper::Looper::new()?
|
||||
),
|
||||
|
|
@ -95,6 +107,7 @@ impl WidgetRef for App {
|
|||
use ratatui::style::Stylize;
|
||||
let mut constraints = vec![
|
||||
Constraint::Length(4),
|
||||
Constraint::Length(10),
|
||||
Constraint::Max(18),
|
||||
Constraint::Max(18),
|
||||
Constraint::Max(0),
|
||||
|
|
@ -105,9 +118,13 @@ impl WidgetRef for App {
|
|||
.direction(Direction::Vertical)
|
||||
.constraints(&constraints)
|
||||
.split(area);
|
||||
|
||||
self.transport.render(areas[0], buffer);
|
||||
for (index, device) in self.devices.iter().enumerate() {
|
||||
device.render(areas[index + 1], buffer);
|
||||
if index == self.focus {
|
||||
draw_focus_corners(buffer, areas[index+1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue