|
|
|
@@ -26,6 +26,7 @@ |
|
|
|
*/ |
|
|
|
|
|
|
|
#include "plugincontext.hpp" |
|
|
|
#include "ModuleWidgets.hpp" |
|
|
|
#include "Widgets.hpp" |
|
|
|
|
|
|
|
#include <algorithm> |
|
|
|
@@ -34,7 +35,7 @@ |
|
|
|
|
|
|
|
USE_NAMESPACE_DISTRHO; |
|
|
|
|
|
|
|
static const int MAX_MIDI_CONTROL = 120; /* 0x77 + 1 */ |
|
|
|
static constexpr const int MAX_MIDI_CONTROL = 120; /* 0x77 + 1 */ |
|
|
|
|
|
|
|
struct HostMIDIMap : TerminalModule { |
|
|
|
enum ParamIds { |
|
|
|
@@ -93,6 +94,7 @@ struct HostMIDIMap : TerminalModule { |
|
|
|
for (int id = 0; id < MAX_MIDI_CONTROL; ++id) |
|
|
|
{ |
|
|
|
paramHandles[id].color = nvgRGBf(0.76f, 0.11f, 0.22f); |
|
|
|
paramHandles[id].text.reserve(25); |
|
|
|
pcontext->engine->addParamHandle(¶mHandles[id]); |
|
|
|
} |
|
|
|
|
|
|
|
@@ -366,15 +368,17 @@ struct HostMIDIMap : TerminalModule { |
|
|
|
nextLearningId = learningId = -1; |
|
|
|
} |
|
|
|
|
|
|
|
// FIXME this allocates string during RT!! |
|
|
|
// this is called during RT!! |
|
|
|
void refreshParamHandleText(const int id) |
|
|
|
{ |
|
|
|
std::string text; |
|
|
|
char textBuf[25]; |
|
|
|
|
|
|
|
if (ccs[id] >= 0) |
|
|
|
text = string::f("CC%02d", ccs[id]); |
|
|
|
std::sprintf(textBuf, "CC%02d", ccs[id]); |
|
|
|
else |
|
|
|
text = "MIDI-Map"; |
|
|
|
paramHandles[id].text = text; |
|
|
|
std::strcpy(textBuf, "MIDI-Map"); |
|
|
|
|
|
|
|
paramHandles[id].text.assign(textBuf); |
|
|
|
} |
|
|
|
|
|
|
|
void updateMapLen() |
|
|
|
@@ -679,7 +683,7 @@ struct HostMIDIMapDisplay : Widget { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
struct HostMIDIMapWidget : ModuleWidget { |
|
|
|
struct HostMIDIMapWidget : ModuleWidgetWith11HP { |
|
|
|
HostMIDIMap* const module; |
|
|
|
|
|
|
|
HostMIDIMapWidget(HostMIDIMap* const m) |
|
|
|
@@ -687,11 +691,7 @@ struct HostMIDIMapWidget : ModuleWidget { |
|
|
|
{ |
|
|
|
setModule(m); |
|
|
|
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDIMap.svg"))); |
|
|
|
|
|
|
|
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, 0))); |
|
|
|
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); |
|
|
|
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); |
|
|
|
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); |
|
|
|
createAndAddScrews(); |
|
|
|
|
|
|
|
HostMIDIMapDisplay* const display = createWidget<HostMIDIMapDisplay>(Vec(1.0f, 71.0f)); |
|
|
|
display->box.size = Vec(box.size.x - 2.0f, box.size.y - 89.0f); |
|
|
|
@@ -701,13 +701,8 @@ struct HostMIDIMapWidget : ModuleWidget { |
|
|
|
|
|
|
|
void draw(const DrawArgs& args) override |
|
|
|
{ |
|
|
|
nvgBeginPath(args.vg); |
|
|
|
nvgRect(args.vg, 0, 0, box.size.x, box.size.y); |
|
|
|
nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 0, box.size.y, |
|
|
|
nvgRGB(0x18, 0x19, 0x19), nvgRGB(0x21, 0x22, 0x22))); |
|
|
|
nvgFill(args.vg); |
|
|
|
|
|
|
|
ModuleWidget::draw(args); |
|
|
|
drawBackground(args.vg); |
|
|
|
ModuleWidgetWith11HP::draw(args); |
|
|
|
} |
|
|
|
|
|
|
|
void appendContextMenu(Menu* const menu) override |
|
|
|
|