mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 13:16:44 +01:00
main_ -> _cli
This commit is contained in:
parent
9b8a14df0e
commit
323a8aeb5f
4 changed files with 15 additions and 15 deletions
40
crates/tek_sequencer/src/sequencer_cli.rs
Normal file
40
crates/tek_sequencer/src/sequencer_cli.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
//! Phrase editor.
|
||||
include!("lib.rs");
|
||||
pub fn main () -> Usually<()> { SequencerCli::parse().run() }
|
||||
|
||||
use tek_core::clap::{self, Parser};
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(version, about, long_about = None)]
|
||||
pub struct SequencerCli {
|
||||
/// Name of JACK client
|
||||
#[arg(short, long)] name: Option<String>,
|
||||
/// Pulses per quarter note (sequencer resolution; default: 96)
|
||||
#[arg(short, long)] ppq: Option<usize>,
|
||||
/// Default phrase duration (in pulses; default: 4 * PPQ = 1 bar)
|
||||
#[arg(short, long)] length: Option<usize>,
|
||||
/// Whether to include a transport toolbar (default: true)
|
||||
#[arg(short, long)] transport: Option<bool>
|
||||
}
|
||||
|
||||
impl SequencerCli {
|
||||
fn run (&self) -> Usually<()> {
|
||||
let mut seq = Sequencer::new("");
|
||||
if let Some(name) = self.name.as_ref() {
|
||||
seq.name = Arc::new(RwLock::new(name.clone()));
|
||||
}
|
||||
if let Some(ppq) = self.ppq {
|
||||
seq.ppq = ppq;
|
||||
}
|
||||
if let Some(length) = self.length {
|
||||
// TODO FIXME WTF
|
||||
//if let Some(phrase) = seq.phrase.as_mut() {
|
||||
//phrase.write().unwrap().length = length;
|
||||
//}
|
||||
}
|
||||
if self.transport == Some(true) {
|
||||
seq.transport = Some(Arc::new(RwLock::new(TransportToolbar::new(None))));
|
||||
}
|
||||
Tui::run(Arc::new(RwLock::new(seq))).map(|_|())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue