From ee7ce3b8e295b9f1999f1dce1687fcd4181b378e Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 5 Feb 2022 18:07:29 +0000 Subject: [PATCH] Cleanup; Separate ildaeil jacks Signed-off-by: falkTX --- plugins/Cardinal/src/Expanders.cpp | 6 +++--- plugins/Cardinal/src/HostAudio.cpp | 2 ++ plugins/Cardinal/src/HostMIDI.cpp | 2 +- plugins/Cardinal/src/Ildaeil.cpp | 20 +++++++++----------- plugins/Cardinal/src/ModuleWidgets.hpp | 19 +++++++++---------- 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/plugins/Cardinal/src/Expanders.cpp b/plugins/Cardinal/src/Expanders.cpp index 34e3097..dc3dff0 100644 --- a/plugins/Cardinal/src/Expanders.cpp +++ b/plugins/Cardinal/src/Expanders.cpp @@ -53,11 +53,11 @@ struct CardinalExpanderForInputMIDI : CardinalExpanderFromCVToCarlaMIDI { CardinalExpanderForInputMIDI() { static_assert(NUM_INPUTS == kNumInputs, "Invalid input configuration"); config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - configInput(PITCH_INPUT, "Pitch (1V/oct)"); + configInput(PITCH_INPUT, "1V/octave pitch"); configInput(GATE_INPUT, "Gate"); configInput(VEL_INPUT, "Velocity"); configInput(AFT_INPUT, "Aftertouch"); - configInput(PW_INPUT, "Pitch wheel"); + configInput(PW_INPUT, "Pitchbend"); configInput(MW_INPUT, "Mod wheel"); onReset(); } @@ -258,7 +258,7 @@ struct CardinalExpanderForInputMIDIWidget : ModuleWidgetWithSideScrews<> { nvgText(args.vg, box.size.x * 0.666f, startY + padding * 1 - 4.0f, "Gate", nullptr); nvgText(args.vg, box.size.x * 0.666f, startY + padding * 2 - 4.0f, "Vel", nullptr); nvgText(args.vg, box.size.x * 0.666f, startY + padding * 3 - 4.0f, "Aft", nullptr); - nvgText(args.vg, box.size.x * 0.666f, startY + padding * 4 - 4.0f, "PW", nullptr); + nvgText(args.vg, box.size.x * 0.666f, startY + padding * 4 - 4.0f, "Pb", nullptr); nvgText(args.vg, box.size.x * 0.666f, startY + padding * 5 - 4.0f, "MW", nullptr); ModuleWidgetWithSideScrews::draw(args); diff --git a/plugins/Cardinal/src/HostAudio.cpp b/plugins/Cardinal/src/HostAudio.cpp index 7511930..7272b51 100644 --- a/plugins/Cardinal/src/HostAudio.cpp +++ b/plugins/Cardinal/src/HostAudio.cpp @@ -224,6 +224,8 @@ struct HostAudioWidget : ModuleWidgetWith8HP { if (numIO == 2) { + // FIXME + const float middleX = box.size.x * 0.5f; addParam(createParamCentered(Vec(middleX, 310.0f), m, 0)); HostAudioNanoMeter* const meter = new HostAudioNanoMeter(m); diff --git a/plugins/Cardinal/src/HostMIDI.cpp b/plugins/Cardinal/src/HostMIDI.cpp index 05a0d9c..067ea8f 100644 --- a/plugins/Cardinal/src/HostMIDI.cpp +++ b/plugins/Cardinal/src/HostMIDI.cpp @@ -705,7 +705,7 @@ struct HostMIDIWidget : ModuleWidgetWith9HP { drawTextLine(args.vg, 2, "Velocity"); drawTextLine(args.vg, 3, "Aftertouch"); drawTextLine(args.vg, 4, "Pitchbend"); - drawTextLine(args.vg, 5, "ModWheel"); + drawTextLine(args.vg, 5, "Mod Wheel"); drawTextLine(args.vg, 6, "Start"); drawTextLine(args.vg, 7, "Stop"); drawTextLine(args.vg, 8, "Cont"); diff --git a/plugins/Cardinal/src/Ildaeil.cpp b/plugins/Cardinal/src/Ildaeil.cpp index 43c5639..49c85fa 100644 --- a/plugins/Cardinal/src/Ildaeil.cpp +++ b/plugins/Cardinal/src/Ildaeil.cpp @@ -1520,7 +1520,7 @@ static void projectLoadedFromDSP(void* const ui) // -------------------------------------------------------------------------------------------------------------------- -struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<> { +struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<26> { bool hasLeftSideExpander = false; IldaeilWidget* ildaeilWidget = nullptr; @@ -1528,29 +1528,27 @@ struct IldaeilModuleWidget : ModuleWidgetWithSideScrews<> { { setModule(module); setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Ildaeil.svg"))); + createAndAddScrews(); if (module == nullptr || module->pcontext != nullptr) { ildaeilWidget = new IldaeilWidget(module); - ildaeilWidget->box.pos = Vec(2 * RACK_GRID_WIDTH, 0); - ildaeilWidget->box.size = Vec(box.size.x - 2 * RACK_GRID_WIDTH, box.size.y); + ildaeilWidget->box.pos = Vec(3 * RACK_GRID_WIDTH, 0); + ildaeilWidget->box.size = Vec(box.size.x - 6 * RACK_GRID_WIDTH, box.size.y); addChild(ildaeilWidget); } - addChild(createWidget(Vec(0, 0))); - addChild(createWidget(Vec(0, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); - addChild(createWidget(Vec(RACK_GRID_WIDTH, 0))); - addChild(createWidget(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); + for (uint i=0; i(Vec(3, 54), module, IldaeilModule::INPUT1)); - addInput(createInput(Vec(3, 54 + 30), module, IldaeilModule::INPUT2)); - addOutput(createOutput(Vec(3, 54 + 60), module, IldaeilModule::OUTPUT1)); - addOutput(createOutput(Vec(3, 54 + 90), module, IldaeilModule::OUTPUT2)); + for (uint i=0; i +template struct ModuleWidgetWithSideScrews : ModuleWidget { - static constexpr const float startX_In = 14.0f; + static constexpr const float startX_In = 10.65f; + static constexpr const float startX_Out = (hp - 3) * 15 + startX_In; static constexpr const float startY = 74.0f; static constexpr const float padding = 29.0f; - static constexpr const float middleX = startX_In + (startX_Out - startX_In) * 0.5f + padding * 0.35f; + static constexpr const float middleX = startX_In + (startX_Out - startX_In) * 0.5f /*+ padding * 0.35f*/; void createAndAddInput(const uint paramId) { createAndAddInput(paramId, paramId); @@ -49,7 +50,7 @@ struct ModuleWidgetWithSideScrews : ModuleWidget { } void createAndAddScrews() { - if (box.size.x > RACK_GRID_WIDTH * 3) { + if (hp > 3) { addChild(createWidget(Vec(RACK_GRID_WIDTH, 0))); addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); addChild(createWidget(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); @@ -81,18 +82,16 @@ struct ModuleWidgetWithSideScrews : ModuleWidget { const float y = startY + posY * padding; nvgBeginPath(vg); nvgFillColor(vg, color::WHITE); - nvgText(vg, middleX, y + 16, text, nullptr); + nvgText(vg, box.size.x * 0.5f, y + 16, text, nullptr); } void setupTextLines(NVGcontext* const vg) { - nvgBeginPath(vg); - nvgRect(vg, startX_Out - 2.5f, startY - 2.0f, padding, padding); nvgFontFaceId(vg, 0); nvgFontSize(vg, 11); nvgTextAlign(vg, NVG_ALIGN_CENTER); } }; -typedef ModuleWidgetWithSideScrews<0> ModuleWidgetWith3HP; -typedef ModuleWidgetWithSideScrews<81> ModuleWidgetWith8HP; -typedef ModuleWidgetWithSideScrews<96> ModuleWidgetWith9HP; +typedef ModuleWidgetWithSideScrews<3> ModuleWidgetWith3HP; +typedef ModuleWidgetWithSideScrews<8> ModuleWidgetWith8HP; +typedef ModuleWidgetWithSideScrews<9> ModuleWidgetWith9HP;