add --bpm flag

This commit is contained in:
🪞👃🪞 2025-01-02 16:38:04 +01:00
parent 42e2ef2a50
commit 94491a323a
11 changed files with 78 additions and 57 deletions

View file

@ -15,6 +15,9 @@ pub struct GrooveboxCli {
/// Whether to attempt to become transport master
#[arg(short='s', long, default_value_t = true)]
sync_follow: bool,
/// Default BPM
#[arg(short='b', long, default_value = None)]
bpm: Option<f64>,
/// MIDI outs to connect to MIDI input
#[arg(short='i', long)]
midi_from: Vec<String>,
@ -46,6 +49,9 @@ impl GrooveboxCli {
&[&self.l_from.as_slice(), &self.r_from.as_slice()],
&[&self.l_to.as_slice(), &self.r_to.as_slice()],
)?;
if let Some(bpm) = self.bpm {
app.clock().timebase.bpm.set(bpm);
}
if self.sync_lead {
jack.read().unwrap().client().register_timebase_callback(false, |mut state|{
app.clock().playhead.update_from_sample(state.position.frame() as f64);