shuffle template size calculus inside method for cleaner use of API

pull/32/head
midilab 1 year ago
parent da3e5d69a6
commit 8711844a02
  1. 5
      src/uClock.cpp
  2. 2
      src/uClock.h

@ -262,11 +262,12 @@ void uClockClass::setShuffleData(uint8_t step, int8_t tick)
ATOMIC(shuffle.step[step] = tick) ATOMIC(shuffle.step[step] = tick)
} }
void uClockClass::setShuffleTemplate(int8_t * shuff, uint8_t size) void uClockClass::setShuffleTemplate(int8_t * shuff)
{ {
uint8_t size = sizeof(shuff) / sizeof(shuff[0]);
if (size > MAX_SHUFFLE_TEMPLATE_SIZE) if (size > MAX_SHUFFLE_TEMPLATE_SIZE)
size = MAX_SHUFFLE_TEMPLATE_SIZE; size = MAX_SHUFFLE_TEMPLATE_SIZE;
setShuffleSize(size); ATOMIC(shuffle.size = size)
for (uint8_t i=0; i < size; i++) { for (uint8_t i=0; i < size; i++) {
setShuffleData(i, shuff[i]); setShuffleData(i, shuff[i]);
} }

@ -161,7 +161,7 @@ public:
bool isShuffled(); bool isShuffled();
void setShuffleSize(uint8_t size); void setShuffleSize(uint8_t size);
void setShuffleData(uint8_t step, int8_t tick); void setShuffleData(uint8_t step, int8_t tick);
void setShuffleTemplate(int8_t * shuff, uint8_t size); void setShuffleTemplate(int8_t * shuff);
// use this to know how many positive or negative ticks to add to current note length // use this to know how many positive or negative ticks to add to current note length
int8_t getShuffleLength(); int8_t getShuffleLength();

Loading…
Cancel
Save