@@ -360,12 +360,39 @@ bool __not_in_flash_func(timer_step)() {
360360 // num_slices, bpm_timer_counter, (float)bpm_timer_counter_last);
361361 bpm_timer_counter_last = bpm_timer_counter ;
362362 }
363+
364+ // In variable mode with clock input, check if enough pulses accumulated
365+ if (clock_in_do && clock_in_ready ) {
366+ // Calculate expected pulses for this slice based on num_slices
367+ // num_slices is in timer ticks (192 per quarter note)
368+ // splice_trigger is pulses per quarter note (typically 24)
369+ float expected_pulses = num_slices *
370+ (float )banks [sel_bank_cur ]
371+ -> sample [sel_sample_cur ]
372+ .snd [FILEZERO ]
373+ -> splice_trigger / 192.0f ;
374+ int32_t pulses_accumulated = clock_in_beat_total - clock_in_beat_last ;
375+
376+ if (pulses_accumulated < (int32_t )roundf (expected_pulses )) {
377+ // Not enough pulses accumulated for this slice yet
378+ should_skip_clock_pulse = true;
379+ } else {
380+ // Enough pulses accumulated, allow trigger and reset counter
381+ should_skip_clock_pulse = false;
382+ clock_in_beat_last = clock_in_beat_total ;
383+ }
384+ }
385+ } else {
386+ // Not in variable mode, reset the skip flag
387+ should_skip_clock_pulse = false;
363388 }
364389
365390 if (sequencerhandler [0 ].playing ) {
366391 // already done
367- } else if ((clock_in_do && clock_in_ready ) || do_splice_trigger ) {
392+ } else if (((clock_in_do && clock_in_ready && !should_skip_clock_pulse ) ||
393+ do_splice_trigger )) {
368394 clock_in_ready = false;
395+ should_skip_clock_pulse = false;
369396 mem_use = false;
370397 // keep to the beat
371398 if (fil_is_open && debounce_quantize == 0 ) {
0 commit comments