Ungoing refactoring

This commit is contained in:
2026-02-04 18:47:40 +01:00
parent c95c82169f
commit ed70b47c81
19 changed files with 749 additions and 451 deletions

View File

@@ -154,14 +154,12 @@ pub struct SharedSequencerState {
pub active_patterns: Vec<ActivePatternState>,
pub step_traces: Arc<StepTracesMap>,
pub event_count: usize,
pub dropped_events: usize,
}
pub struct SequencerSnapshot {
pub active_patterns: Vec<ActivePatternState>,
step_traces: Arc<StepTracesMap>,
pub event_count: usize,
pub dropped_events: usize,
}
impl SequencerSnapshot {
@@ -205,12 +203,11 @@ impl SequencerHandle {
active_patterns: state.active_patterns.clone(),
step_traces: Arc::clone(&state.step_traces),
event_count: state.event_count,
dropped_events: state.dropped_events,
}
}
pub fn swap_audio_channel(&self) -> Receiver<AudioCommand> {
let (new_tx, new_rx) = bounded::<AudioCommand>(256);
let (new_tx, new_rx) = unbounded::<AudioCommand>();
self.audio_tx.store(Arc::new(new_tx));
new_rx
}
@@ -294,7 +291,7 @@ pub fn spawn_sequencer(
Receiver<MidiCommand>,
) {
let (cmd_tx, cmd_rx) = bounded::<SeqCommand>(64);
let (audio_tx, audio_rx) = bounded::<AudioCommand>(256);
let (audio_tx, audio_rx) = unbounded::<AudioCommand>();
let (midi_tx, midi_rx) = bounded::<MidiCommand>(256);
let audio_tx = Arc::new(ArcSwap::from_pointee(audio_tx));
let midi_tx = Arc::new(ArcSwap::from_pointee(midi_tx));
@@ -535,7 +532,6 @@ pub(crate) struct SequencerState {
runs_counter: RunsCounter,
step_traces: Arc<StepTracesMap>,
event_count: usize,
dropped_events: usize,
script_engine: ScriptEngine,
variables: Variables,
speed_overrides: HashMap<(usize, usize), f64>,
@@ -564,7 +560,6 @@ impl SequencerState {
runs_counter: RunsCounter::new(),
step_traces: Arc::new(HashMap::new()),
event_count: 0,
dropped_events: 0,
script_engine,
variables,
speed_overrides: HashMap::with_capacity(MAX_PATTERNS),
@@ -1057,7 +1052,6 @@ impl SequencerState {
.collect(),
step_traces: Arc::clone(&self.step_traces),
event_count: self.event_count,
dropped_events: self.dropped_events,
}
}
}
@@ -1175,7 +1169,7 @@ fn sequencer_loop(
}
} else {
// Audio direct to doux — sample-accurate scheduling via /time/ parameter
let _ = audio_tx.load().try_send(AudioCommand::Evaluate {
let _ = audio_tx.load().send(AudioCommand::Evaluate {
cmd: tsc.cmd,
time: tsc.time,
});