Feat: UI/UX fixes + removing clones from places

This commit is contained in:
2026-03-05 00:15:51 +01:00
parent 35370a6f2c
commit 60fb62829f
17 changed files with 1817 additions and 290 deletions

View File

@@ -555,7 +555,7 @@ pub struct SequencerState {
pattern_cache: PatternCache,
pending_updates: HashMap<(usize, usize), PatternSnapshot>,
runs_counter: RunsCounter,
step_traces: StepTracesMap,
step_traces: Arc<StepTracesMap>,
event_count: usize,
script_engine: ScriptEngine,
variables: Variables,
@@ -593,7 +593,7 @@ impl SequencerState {
pattern_cache: PatternCache::new(),
pending_updates: HashMap::new(),
runs_counter: RunsCounter::new(),
step_traces: HashMap::new(),
step_traces: Arc::new(HashMap::new()),
event_count: 0,
script_engine,
variables,
@@ -713,7 +713,7 @@ impl SequencerState {
self.audio_state.active_patterns.clear();
self.audio_state.pending_starts.clear();
self.audio_state.pending_stops.clear();
self.step_traces.clear();
self.step_traces = Arc::new(HashMap::new());
self.runs_counter.counts.clear();
self.audio_state.flush_midi_notes = true;
}
@@ -731,7 +731,7 @@ impl SequencerState {
self.speed_overrides.clear();
self.script_engine.clear_global_params();
self.runs_counter.counts.clear();
self.step_traces.clear();
self.step_traces = Arc::new(HashMap::new());
self.audio_state.flush_midi_notes = true;
}
SeqCommand::ResetScriptState => {
@@ -811,7 +811,7 @@ impl SequencerState {
fn tick_paused(&mut self) -> TickOutput {
for pending in self.audio_state.pending_stops.drain(..) {
self.audio_state.active_patterns.remove(&pending.id);
self.step_traces.retain(|&(bank, pattern, _), _| {
Arc::make_mut(&mut self.step_traces).retain(|&(bank, pattern, _), _| {
bank != pending.id.bank || pattern != pending.id.pattern
});
let key = (pending.id.bank, pending.id.pattern);
@@ -894,7 +894,7 @@ impl SequencerState {
for pending in &self.audio_state.pending_stops {
if check_quantization_boundary(pending.quantization, beat, prev_beat, quantum) {
self.audio_state.active_patterns.remove(&pending.id);
self.step_traces.retain(|&(bank, pattern, _), _| {
Arc::make_mut(&mut self.step_traces).retain(|&(bank, pattern, _), _| {
bank != pending.id.bank || pattern != pending.id.pattern
});
// Flush pending update so cache stays current for future launches
@@ -1015,7 +1015,7 @@ impl SequencerState {
.script_engine
.evaluate_with_trace(script, &ctx, &mut trace)
{
self.step_traces.insert(
Arc::make_mut(&mut self.step_traces).insert(
(active.bank, active.pattern, source_idx),
std::mem::take(&mut trace),
);
@@ -1229,7 +1229,7 @@ impl SequencerState {
last_step_beat: a.last_step_beat,
})
.collect(),
step_traces: Arc::new(self.step_traces.clone()),
step_traces: Arc::clone(&self.step_traces),
event_count: self.event_count,
tempo: self.last_tempo,
beat: self.last_beat,