Rename from shuffle to swing. Add indicator for aligning swing hits with notes.
This commit is contained in:
@ -210,8 +210,8 @@ void editChannelParameter(int val) {
|
||||
case PARAM_CH_OFFSET:
|
||||
ch.setOffset(ch.getOffset() + val);
|
||||
break;
|
||||
case PARAM_CH_SHUFFLE:
|
||||
ch.setShuffle(ch.getShuffle() + val);
|
||||
case PARAM_CH_SWING:
|
||||
ch.setSwing(ch.getSwing() + val);
|
||||
break;
|
||||
case PARAM_CH_CV_SRC: {
|
||||
int source = static_cast<int>(ch.getCvSource());
|
||||
|
||||
@ -38,7 +38,7 @@ enum ParamsChannelPage {
|
||||
PARAM_CH_PROB,
|
||||
PARAM_CH_DUTY,
|
||||
PARAM_CH_OFFSET,
|
||||
PARAM_CH_SHUFFLE,
|
||||
PARAM_CH_SWING,
|
||||
PARAM_CH_CV_SRC,
|
||||
PARAM_CH_CV_DEST,
|
||||
PARAM_CH_LAST,
|
||||
|
||||
@ -18,7 +18,7 @@ enum CvDestination {
|
||||
CV_DEST_PROB,
|
||||
CV_DEST_DUTY,
|
||||
CV_DEST_OFFSET,
|
||||
CV_DEST_SHUFFLE,
|
||||
CV_DEST_SWING,
|
||||
CV_DEST_LAST,
|
||||
};
|
||||
|
||||
@ -59,7 +59,7 @@ class Channel {
|
||||
void setProbability(int prob) { base_probability = constrain(prob, 0, 100); }
|
||||
void setDutyCycle(int duty) { base_duty_cycle = constrain(duty, 1, 99); }
|
||||
void setOffset(int off) { base_offset = constrain(off, 0, 100); }
|
||||
void setShuffle(int val) { base_shuffle = constrain(val, 0, 50); }
|
||||
void setSwing(int val) { base_shuffle = constrain(val, 0, 50); }
|
||||
void setCvSource(CvSource source) { cv_source = source; }
|
||||
void setCvDestination(CvDestination dest) { cv_destination = dest; }
|
||||
|
||||
@ -68,7 +68,7 @@ class Channel {
|
||||
int getProbability(bool withCvMod = false) const { return withCvMod ? cvmod_probability : base_probability; }
|
||||
int getDutyCycle(bool withCvMod = false) const { return withCvMod ? cvmod_duty_cycle : base_duty_cycle; }
|
||||
int getOffset(bool withCvMod = false) const { return withCvMod ? cvmod_offset : base_offset; }
|
||||
int getShuffle(bool withCvMod = false) const { return withCvMod ? cvmod_shuffle : base_shuffle; }
|
||||
int getSwing(bool withCvMod = false) const { return withCvMod ? cvmod_shuffle : base_shuffle; }
|
||||
int getClockMod(bool withCvMod = false) const { return clock_mod[getClockModIndex(withCvMod)]; }
|
||||
int getClockModIndex(bool withCvMod = false) const { return withCvMod ? cvmod_clock_mod_index : base_clock_mod_index; }
|
||||
CvSource getCvSource() { return cv_source; }
|
||||
@ -144,7 +144,7 @@ class Channel {
|
||||
? constrain(base_offset + map(value, -512, 512, -50, 50), 0, 99)
|
||||
: base_offset;
|
||||
|
||||
cvmod_shuffle = (cv_destination == CV_DEST_SHUFFLE)
|
||||
cvmod_shuffle = (cv_destination == CV_DEST_SWING)
|
||||
? constrain(base_shuffle + map(value, -512, 512, -25, 25), 0, 50)
|
||||
: base_shuffle;
|
||||
}
|
||||
|
||||
@ -96,16 +96,16 @@ void drawRightAlignedText(const char* text, int y) {
|
||||
void drawSelectHero() {
|
||||
gravity.display.setDrawColor(1);
|
||||
const int tickSize = 3;
|
||||
const int heroWidth = SCREEN_WIDTH/2;
|
||||
const int heroWidth = SCREEN_WIDTH / 2;
|
||||
const int heroHeight = 49;
|
||||
gravity.display.drawLine(0, 0, tickSize, 0);
|
||||
gravity.display.drawLine(0, 0, 0, tickSize);
|
||||
gravity.display.drawLine(heroWidth, 0, heroWidth-tickSize, 0);
|
||||
gravity.display.drawLine(heroWidth, 0, heroWidth - tickSize, 0);
|
||||
gravity.display.drawLine(heroWidth, 0, heroWidth, tickSize);
|
||||
gravity.display.drawLine(heroWidth, heroHeight, heroWidth, heroHeight-tickSize);
|
||||
gravity.display.drawLine(heroWidth, heroHeight, heroWidth-tickSize, heroHeight);
|
||||
gravity.display.drawLine(heroWidth, heroHeight, heroWidth, heroHeight - tickSize);
|
||||
gravity.display.drawLine(heroWidth, heroHeight, heroWidth - tickSize, heroHeight);
|
||||
gravity.display.drawLine(0, heroHeight, tickSize, heroHeight);
|
||||
gravity.display.drawLine(0, heroHeight, 0, heroHeight-tickSize);
|
||||
gravity.display.drawLine(0, heroHeight, 0, heroHeight - tickSize);
|
||||
gravity.display.setDrawColor(2);
|
||||
}
|
||||
|
||||
@ -147,6 +147,24 @@ void drawMenuItems(const char* menu_items[], int menu_size) {
|
||||
}
|
||||
}
|
||||
|
||||
void swingDivisionMark() {
|
||||
auto& ch = GetSelectedChannel();
|
||||
switch (ch.getSwing() + 50) {
|
||||
case 58: // 1/32nd
|
||||
case 66: // 1/16th
|
||||
case 75: // 1/8th
|
||||
gravity.display.drawBox(56, 4, 4, 4);
|
||||
break;
|
||||
case 54: // 1/32nd tripplet
|
||||
case 62: // 1/16th tripplet
|
||||
case 71: // 1/8th tripplet
|
||||
gravity.display.drawBox(56, 4, 4, 4);
|
||||
gravity.display.drawBox(57, 5, 2, 2);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Main display functions
|
||||
|
||||
void DisplayMainPage() {
|
||||
@ -244,11 +262,12 @@ void DisplayChannelPage() {
|
||||
sprintf(mainText, "%d%%", ch.getOffset(withCvMod));
|
||||
subText = "SHIFT HIT";
|
||||
break;
|
||||
case PARAM_CH_SHUFFLE:
|
||||
ch.getShuffle() == 0
|
||||
case PARAM_CH_SWING:
|
||||
ch.getSwing() == 0
|
||||
? sprintf(mainText, "OFF")
|
||||
: sprintf(mainText, "%d%%", ch.getShuffle(withCvMod) + 50);
|
||||
subText = "SHUFFLE";
|
||||
: sprintf(mainText, "%d%%", ch.getSwing(withCvMod) + 50);
|
||||
subText = "DOWN BEAT";
|
||||
swingDivisionMark();
|
||||
break;
|
||||
case PARAM_CH_CV_SRC: {
|
||||
switch (ch.getCvSource()) {
|
||||
@ -289,9 +308,9 @@ void DisplayChannelPage() {
|
||||
sprintf(mainText, "DEST");
|
||||
subText = "OFFSET";
|
||||
break;
|
||||
case CV_DEST_SHUFFLE:
|
||||
case CV_DEST_SWING:
|
||||
sprintf(mainText, "DEST");
|
||||
subText = "SHUFFLE";
|
||||
subText = "SWING";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -303,7 +322,7 @@ void DisplayChannelPage() {
|
||||
|
||||
// Draw Channel Page menu items
|
||||
const char* menu_items[PARAM_CH_LAST] = {
|
||||
"MOD", "PROBABILITY", "DUTY", "OFFSET", "SHUFFLE", "CV SOURCE", "CV DEST"};
|
||||
"MOD", "PROBABILITY", "DUTY", "OFFSET", "SWING", "CV SOURCE", "CV DEST"};
|
||||
drawMenuItems(menu_items, PARAM_CH_LAST);
|
||||
}
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ bool StateManager::initialize(AppState& app) {
|
||||
ch.setProbability(saved_ch_state.base_probability);
|
||||
ch.setDutyCycle(saved_ch_state.base_duty_cycle);
|
||||
ch.setOffset(saved_ch_state.base_offset);
|
||||
ch.setShuffle(saved_ch_state.base_shuffle);
|
||||
ch.setSwing(saved_ch_state.base_shuffle);
|
||||
ch.setCvSource(static_cast<CvSource>(saved_ch_state.cv_source));
|
||||
ch.setCvDestination(static_cast<CvDestination>(saved_ch_state.cv_destination));
|
||||
}
|
||||
@ -106,7 +106,7 @@ void StateManager::_saveState(const AppState& app) {
|
||||
save_ch.base_probability = ch.getProbability(false);
|
||||
save_ch.base_duty_cycle = ch.getDutyCycle(false);
|
||||
save_ch.base_offset = ch.getOffset(false);
|
||||
save_ch.base_shuffle = ch.getShuffle();
|
||||
save_ch.base_shuffle = ch.getSwing();
|
||||
save_ch.cv_source = static_cast<byte>(ch.getCvSource());
|
||||
save_ch.cv_destination = static_cast<byte>(ch.getCvDestination());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user