shuffle schema integrated to dinamicly PPQN system. missing reviewing more complex shuffle templates

pull/32/head
midilab 4 months ago
parent c5f126a90b
commit 459ae7f4e6
  1. 23
      src/uClock.cpp
  2. 10
      src/uClock.h

@ -311,12 +311,35 @@ bool inline uClockClass::processShuffle()
if (shuffle_shoot_ctrl == false && mod_counter == 0)
shuffle_shoot_ctrl = true;
//if (mod_counter == mod_step_ref-1)
if (shff >= 0) {
mod_shuffle = mod_counter - shff;
// any late shuffle? we should skip next mod_counter == 0
if (last_shff < 0 && mod_counter != 1)
return false;
} else if (shff < 0) {
mod_shuffle = mod_counter - (mod_step_ref + shff);
//if (last_shff < 0 && mod_counter != 1)
// return false;
shuffle_shoot_ctrl = true;
}
//Serial.println("-----------------");
//Serial.print("shff: ");
//Serial.println(shff);
//Serial.print("mod_counter: ");
//Serial.println(mod_counter);
//Serial.print("mod_shuffle: ");
//Serial.println(mod_shuffle);
//Serial.print("shuffle_shoot_ctrl: ");
//Serial.println(shuffle_shoot_ctrl);
//Serial.print("last_shff: ");
//Serial.println(last_shff);
last_shff = shff;
// shuffle_shoot_ctrl helps keep track if we have shoot or not a note for the step space of ppqn/4 pulses
if (mod_shuffle == 0 && shuffle_shoot_ctrl == true) {
// keep track of next note shuffle for current note lenght control
shuffle_length_ctrl = shuffle.step[(step_counter+1)%shuffle.size];

@ -44,9 +44,8 @@ namespace umodular { namespace clock {
// 48 PPQN (12 pulses per step)
// 96 PPQN (24 pulses per step)
// min: 2 step, max: 16 steps
// adjust the size of you template if more than 16 needed
// step adjust goes min: -5, max: 5
// min: -(ppqn/4)-1 step, max: (ppqn/4)-1 steps
// adjust the size of you template if more than 16 shuffle step info needed
#define MAX_SHUFFLE_TEMPLATE_SIZE 16
typedef struct {
bool active = false;
@ -198,13 +197,14 @@ class uClockClass {
float tempo;
uint32_t start_timer;
uint8_t mode;
SyncMode mode;
volatile uint32_t ext_interval_buffer[EXT_INTERVAL_BUFFER_SIZE];
uint16_t ext_interval_idx;
// shuffle implementation that applies to 16PPQN callback
// shuffle implementation
volatile SHUFFLE_TEMPLATE shuffle;
int8_t last_shff = 0;
bool shuffle_shoot_ctrl = true;
volatile int8_t shuffle_length_ctrl = 0;
};

Loading…
Cancel
Save