MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / appendContextMenu

Method appendContextMenu

plugins/Cardinal/src/HostMIDI.cpp:829–912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827 }
828
829 void appendContextMenu(Menu* const menu) override
830 {
831 menu->addChild(new MenuSeparator);
832 menu->addChild(createMenuLabel("MIDI Input"));
833
834 menu->addChild(createBoolPtrMenuItem("Force gate gaps between notes", "", &module->midiInput.gateForceGaps));
835
836 menu->addChild(createBoolPtrMenuItem("Smooth pitch/mod wheel", "", &module->midiInput.smooth));
837
838 static const std::vector<float> pwRanges = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 24, 36, 48};
839 menu->addChild(createSubmenuItem("Pitch bend range", string::f("%g", module->midiInput.pwRange), [=](Menu* menu) {
840 for (size_t i = 0; i < pwRanges.size(); i++) {
841 menu->addChild(createCheckMenuItem(string::f("%g", pwRanges[i]), "",
842 [=]() {return module->midiInput.pwRange == pwRanges[i];},
843 [=]() {module->midiInput.pwRange = pwRanges[i];}
844 ));
845 }
846 }));
847
848 struct InputChannelItem : MenuItem {
849 HostMIDI* module;
850 Menu* createChildMenu() override {
851 Menu* menu = new Menu;
852 for (int c = 0; c <= 16; c++) {
853 menu->addChild(createCheckMenuItem((c == 0) ? "All" : string::f("%d", c), "",
854 [=]() {return module->midiInput.channel == c;},
855 [=]() {module->midiInput.channel = c;}
856 ));
857 }
858 return menu;
859 }
860 };
861 InputChannelItem* const inputChannelItem = new InputChannelItem;
862 inputChannelItem->text = "MIDI channel";
863 inputChannelItem->rightText = (module->midiInput.channel ? string::f("%d", module->midiInput.channel) : "All")
864 + " " + RIGHT_ARROW;
865 inputChannelItem->module = module;
866 menu->addChild(inputChannelItem);
867
868 menu->addChild(createSubmenuItem("Polyphony channels", string::f("%d", module->midiInput.channels), [=](Menu* menu) {
869 for (int c = 1; c <= 16; c++) {
870 menu->addChild(createCheckMenuItem((c == 1) ? "Monophonic" : string::f("%d", c), "",
871 [=]() {return module->midiInput.channels == c;},
872 [=]() {module->midiInput.setChannels(c);}
873 ));
874 }
875 }));
876
877 menu->addChild(createIndexPtrSubmenuItem("Polyphony mode", {
878 "Rotate",
879 "Reuse",
880 "Reset",
881 "MPE",
882 }, &module->midiInput.polyMode));
883
884 menu->addChild(new MenuSeparator);
885 menu->addChild(createMenuLabel("MIDI Output"));
886

Callers

nothing calls this directly

Calls 11

createMenuLabelFunction · 0.85
createBoolPtrMenuItemFunction · 0.85
createSubmenuItemFunction · 0.85
fFunction · 0.85
createCheckMenuItemFunction · 0.85
createMenuItemFunction · 0.85
addChildMethod · 0.80
sizeMethod · 0.45
setChannelsMethod · 0.45
panicMethod · 0.45

Tested by

no test coverage detected