Browse Source

Quantizer: Add "Shift notes up/down" menu items.

tags/v2.5.0
Andrew Belt 1 year ago
parent
commit
aaab6233fa
1 changed files with 19 additions and 0 deletions
  1. +19
    -0
      src/Quantizer.cpp

+ 19
- 0
src/Quantizer.cpp View File

@@ -99,6 +99,12 @@ struct Quantizer : Module {
}
}

void rotateNotes(int delta) {
delta = eucMod(-delta, 12);
std::rotate(&enabledNotes[0], &enabledNotes[delta], &enabledNotes[12]);
updateRanges();
}

json_t* dataToJson() override {
json_t* rootJ = json_object();

@@ -253,6 +259,19 @@ struct QuantizerWidget : ModuleWidget {
quantizerDisplay->setModule(module);
addChild(quantizerDisplay);
}

void appendContextMenu(Menu* menu) override {
Quantizer* module = getModule<Quantizer>();

menu->addChild(new MenuSeparator);

menu->addChild(createMenuItem("Shift notes up", "", [=]() {
module->rotateNotes(1);
}));
menu->addChild(createMenuItem("Shift notes down", "", [=]() {
module->rotateNotes(-1);
}));
}
};



Loading…
Cancel
Save