pass root clock - and groovebox works!

This commit is contained in:
🪞👃🪞 2025-05-11 02:06:08 +03:00
parent 997d67a487
commit 4e2702f69e
2 changed files with 16 additions and 15 deletions

View file

@ -111,10 +111,10 @@ impl Cli {
_ => todo!("{mode:?}"), _ => todo!("{mode:?}"),
}; };
let config = Configuration::new(&config_path, false)?; let config = Configuration::new(&config_path, false)?;
let clock = Clock::new(jack, self.bpm)?;
let mut app = App { let mut app = App {
jack: jack.clone(), jack: jack.clone(),
color: ItemTheme::random(), color: ItemTheme::random(),
clock: Clock::new(jack, self.bpm)?,
pool: match mode { pool: match mode {
LaunchMode::Sequencer | LaunchMode::Groovebox => clip.as_ref().map(Into::into), LaunchMode::Sequencer | LaunchMode::Groovebox => clip.as_ref().map(Into::into),
LaunchMode::Arranger { .. } => Some(Default::default()), LaunchMode::Arranger { .. } => Some(Default::default()),
@ -141,7 +141,7 @@ impl Cli {
&name, &name,
None, None,
jack, jack,
None, Some(&clock),
clip.as_ref(), clip.as_ref(),
midi_froms.as_slice(), midi_froms.as_slice(),
midi_tos.as_slice() midi_tos.as_slice()
@ -152,7 +152,7 @@ impl Cli {
&name, &name,
None, None,
jack, jack,
None, Some(&clock),
clip.as_ref(), clip.as_ref(),
midi_froms.as_slice(), midi_froms.as_slice(),
midi_froms.as_slice(), midi_froms.as_slice(),
@ -165,6 +165,7 @@ impl Cli {
scenes, scenes,
selected: Selection::TrackClip { track: 0, scene: 0 }, selected: Selection::TrackClip { track: 0, scene: 0 },
config, config,
clock,
..Default::default() ..Default::default()
}; };
if let &LaunchMode::Arranger { scenes, tracks, track_width, .. } = mode { if let &LaunchMode::Arranger { scenes, tracks, track_width, .. } = mode {

View file

@ -18,29 +18,29 @@ pub trait HasSequencer {
/// Contains state for playing a clip /// Contains state for playing a clip
pub struct Sequencer { pub struct Sequencer {
/// State of clock and playhead /// State of clock and playhead
pub clock: Clock, pub clock: Clock,
/// Start time and clip being played /// Start time and clip being played
pub play_clip: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>, pub play_clip: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>,
/// Start time and next clip /// Start time and next clip
pub next_clip: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>, pub next_clip: Option<(Moment, Option<Arc<RwLock<MidiClip>>>)>,
/// Play input through output. /// Play input through output.
pub monitoring: bool, pub monitoring: bool,
/// Write input to sequence. /// Write input to sequence.
pub recording: bool, pub recording: bool,
/// Overdub input to sequence. /// Overdub input to sequence.
pub overdub: bool, pub overdub: bool,
/// Send all notes off /// Send all notes off
pub reset: bool, // TODO?: after Some(nframes) pub reset: bool, // TODO?: after Some(nframes)
/// Record from MIDI ports to current sequence. /// Record from MIDI ports to current sequence.
pub midi_ins: Vec<JackMidiIn>, pub midi_ins: Vec<JackMidiIn>,
/// Play from current sequence to MIDI ports /// Play from current sequence to MIDI ports
pub midi_outs: Vec<JackMidiOut>, pub midi_outs: Vec<JackMidiOut>,
/// Notes currently held at input /// Notes currently held at input
pub notes_in: Arc<RwLock<[bool; 128]>>, pub notes_in: Arc<RwLock<[bool; 128]>>,
/// Notes currently held at output /// Notes currently held at output
pub notes_out: Arc<RwLock<[bool; 128]>>, pub notes_out: Arc<RwLock<[bool; 128]>>,
/// MIDI output buffer /// MIDI output buffer
pub note_buf: Vec<u8>, pub note_buf: Vec<u8>,
} }
impl Default for Sequencer { impl Default for Sequencer {