From cb266178905d99865a72af97be57b153852121c3 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 30 Jan 2022 00:33:54 +0000 Subject: [PATCH] Implement MIDI-Map, finishing all core replacements Signed-off-by: falkTX --- include/single-precision/algorithm | 2 - plugins/Cardinal/orig/HostMIDIMap.svg | 157 ++++++++++ plugins/Cardinal/plugin.json | 6 +- plugins/Cardinal/res/HostMIDIMap.svg | 216 +++++++++++++ plugins/Cardinal/src/HostMIDI-Map.cpp | 435 +++++++++++++++++++++----- plugins/Cardinal/src/plugin.hpp | 17 +- plugins/Core.json | 56 ---- plugins/Makefile | 9 +- plugins/plugins.cpp | 23 -- src/Makefile | 17 +- src/override/plugin.cpp | 4 + 11 files changed, 749 insertions(+), 193 deletions(-) create mode 100644 plugins/Cardinal/orig/HostMIDIMap.svg create mode 100644 plugins/Cardinal/res/HostMIDIMap.svg delete mode 100644 plugins/Core.json diff --git a/include/single-precision/algorithm b/include/single-precision/algorithm index b6f58d0..12cdd75 100644 --- a/include/single-precision/algorithm +++ b/include/single-precision/algorithm @@ -42,5 +42,3 @@ std::complex operator/(const std::complex& a, const std::complex< } } - -// std::complex diff --git a/plugins/Cardinal/orig/HostMIDIMap.svg b/plugins/Cardinal/orig/HostMIDIMap.svg new file mode 100644 index 0000000..e57f1e2 --- /dev/null +++ b/plugins/Cardinal/orig/HostMIDIMap.svg @@ -0,0 +1,157 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + Host MIDI CC Map + + diff --git a/plugins/Cardinal/plugin.json b/plugins/Cardinal/plugin.json index 8991d67..f6ffe6e 100644 --- a/plugins/Cardinal/plugin.json +++ b/plugins/Cardinal/plugin.json @@ -59,7 +59,7 @@ { "slug": "HostMIDIGate", "name": "Host MIDI Gate", - "description": "Exposes host-provided MIDI as gates in a module", + "description": "Exposes host-provided MIDI notes as gates in a module", "tags": [ "External", "MIDI" @@ -67,8 +67,8 @@ }, { "slug": "HostMIDIMap", - "name": "Host MIDI Map", - "description": "Allows host-provided MIDI to control other module parameters", + "name": "Host MIDI CC Map", + "description": "Allows host-provided MIDI CC to control other module parameters", "tags": [ "External", "MIDI" diff --git a/plugins/Cardinal/res/HostMIDIMap.svg b/plugins/Cardinal/res/HostMIDIMap.svg new file mode 100644 index 0000000..3d07139 --- /dev/null +++ b/plugins/Cardinal/res/HostMIDIMap.svg @@ -0,0 +1,216 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/Cardinal/src/HostMIDI-Map.cpp b/plugins/Cardinal/src/HostMIDI-Map.cpp index 126c23d..25bbe46 100644 --- a/plugins/Cardinal/src/HostMIDI-Map.cpp +++ b/plugins/Cardinal/src/HostMIDI-Map.cpp @@ -33,7 +33,7 @@ USE_NAMESPACE_DISTRHO; -static const int MAX_CHANNELS = 128; +static const int MAX_MIDI_CONTROL = 120; /* 0x77 + 1 */ struct HostMIDIMap : Module { enum ParamIds { @@ -55,6 +55,7 @@ struct HostMIDIMap : Module { uint32_t midiEventsLeft; uint32_t midiEventFrame; int64_t lastBlockFrame; + int nextLearningId; uint8_t channel; // from Rack @@ -62,9 +63,9 @@ struct HostMIDIMap : Module { /** Number of maps */ int mapLen = 0; /** The mapped CC number of each channel */ - int ccs[MAX_CHANNELS]; + int ccs[MAX_MIDI_CONTROL]; /** The mapped param handle of each channel */ - ParamHandle paramHandles[MAX_CHANNELS]; + ParamHandle paramHandles[MAX_MIDI_CONTROL]; /** Channel ID of the learning session */ int learningId; @@ -74,10 +75,10 @@ struct HostMIDIMap : Module { bool learnedParam; /** The value of each CC number */ - int8_t values[128]; + int8_t values[MAX_MIDI_CONTROL]; /** The smoothing processor (normalized between 0 and 1) of each channel */ - dsp::ExponentialFilter valueFilters[MAX_CHANNELS]; - bool filterInitialized[MAX_CHANNELS] = {}; + dsp::ExponentialFilter valueFilters[MAX_MIDI_CONTROL]; + bool filterInitialized[MAX_MIDI_CONTROL] = {}; dsp::ClockDivider divider; HostMIDIMap() @@ -88,13 +89,13 @@ struct HostMIDIMap : Module { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); - for (int id = 0; id < MAX_CHANNELS; ++id) - { - paramHandles[id].color = nvgRGB(0xff, 0xff, 0x40); + for (int id = 0; id < MAX_MIDI_CONTROL; ++id) +// { +// paramHandles[id].color = nvgRGB(0xff, 0xff, 0x40); pcontext->engine->addParamHandle(¶mHandles[id]); - } +// } - for (int i = 0; i < MAX_CHANNELS; i++) + for (int i = 0; i < MAX_MIDI_CONTROL; i++) valueFilters[i].setTau(1 / 30.f); divider.setDivision(32); @@ -106,7 +107,7 @@ struct HostMIDIMap : Module { if (pcontext == nullptr) return; - for (int id = 0; id < MAX_CHANNELS; ++id) + for (int id = 0; id < MAX_MIDI_CONTROL; ++id) pcontext->engine->removeParamHandle(¶mHandles[id]); } @@ -116,6 +117,7 @@ struct HostMIDIMap : Module { midiEventsLeft = 0; midiEventFrame = 0; lastBlockFrame = -1; + nextLearningId = -1; channel = 0; smooth = true; @@ -126,9 +128,6 @@ struct HostMIDIMap : Module { // We also might be in the MIDIMap() constructor, which could cause problems, but when constructing, all ParamHandles will point to no Modules anyway. clearMaps_NoLock(); mapLen = 1; - for (int i = 0; i < 128; i++) { - values[i] = -1; - } } void process(const ProcessArgs& args) override @@ -175,25 +174,24 @@ struct HostMIDIMap : Module { // adapted from Rack if ((data[0] & 0xF0) != 0xB0) continue; + if (data[1] >= MAX_MIDI_CONTROL) + continue; - uint8_t cc = data[1]; - int8_t value = data[2]; + const uint8_t cc = data[1]; + const int8_t value = data[2]; // Learn - if (0 <= learningId && values[cc] != value) + if (learningId >= 0 && values[cc] != value) { ccs[learningId] = cc; + filterInitialized[cc] = false; valueFilters[learningId].reset(); learnedCc = true; - commitLearn(); - updateMapLen(); + maybeCommitLearn(); refreshParamHandleText(learningId); + updateMapLen(); } - // Ignore negative values generated using the nonstandard 8-bit MIDI extension from the gamepad driver - if (value < 0) - continue; - values[cc] = value; } @@ -202,80 +200,144 @@ struct HostMIDIMap : Module { // Step channels for (int id = 0; id < mapLen; ++id) { - int cc = ccs[id]; + const int cc = ccs[id]; if (cc < 0) continue; + // Get Module - Module* module = paramHandles[id].module; + Module* const module = paramHandles[id].module; if (!module) continue; + // Get ParamQuantity from ParamHandle - int paramId = paramHandles[id].paramId; - ParamQuantity* paramQuantity = module->paramQuantities[paramId]; + const int paramId = paramHandles[id].paramId; + ParamQuantity* const paramQuantity = module->paramQuantities[paramId]; if (!paramQuantity) continue; if (!paramQuantity->isBounded()) continue; + // Set filter from param value if filter is uninitialized - if (!filterInitialized[id]) { + if (!filterInitialized[id]) + { valueFilters[id].out = paramQuantity->getScaledValue(); filterInitialized[id] = true; continue; } + // Check if CC has been set by the MIDI device if (values[cc] < 0) continue; - float value = values[cc] / 127.f; + + const float value = values[cc] / 127.f; + // Detect behavior from MIDI buttons. - if (smooth && std::fabs(valueFilters[id].out - value) < 1.f) { + if (smooth && std::fabs(valueFilters[id].out - value) < 1.f) + { // Smooth value with filter - valueFilters[id].process(args.sampleTime * divider.getDivision(), value); + if (d_isEqual(valueFilters[id].process(args.sampleTime * divider.getDivision(), value), value)) + { + values[cc] = -1; + continue; + } } - else { + else + { // Jump value + if (d_isEqual(valueFilters[id].out, value)) + { + values[cc] = -1; + continue; + } + valueFilters[id].out = value; } + paramQuantity->setScaledValue(valueFilters[id].out); } } void clearMap(int id) { + nextLearningId = -1; learningId = -1; + learnedCc = false; + learnedParam = false; + ccs[id] = -1; + values[id] = -1; pcontext->engine->updateParamHandle(¶mHandles[id], -1, 0, true); valueFilters[id].reset(); - updateMapLen(); refreshParamHandleText(id); + updateMapLen(); } + // ---------------------------------------------------------------------------------------------------------------- + // stuff for resetting state + void clearMaps_NoLock() { + nextLearningId = -1; learningId = -1; - for (int id = 0; id < MAX_CHANNELS; id++) { + learnedCc = false; + learnedParam = false; + + for (int id = 0; id < MAX_MIDI_CONTROL; ++id) + { ccs[id] = -1; + values[id] = -1; pcontext->engine->updateParamHandle_NoLock(¶mHandles[id], -1, 0, true); valueFilters[id].reset(); refreshParamHandleText(id); } - mapLen = 0; } - void updateMapLen() + void setChannel(uint8_t channel) { - // Find last nonempty map - int id; - for (id = MAX_CHANNELS - 1; id >= 0; id--) { - if (ccs[id] >= 0 || paramHandles[id].moduleId >= 0) - break; - } - mapLen = id + 1; - // Add an empty "Mapping..." slot - if (mapLen < MAX_CHANNELS) - mapLen++; + this->channel = channel; + + for (int i = 0; i < MAX_MIDI_CONTROL; ++i) + values[i] = -1; } - void commitLearn() + // ---------------------------------------------------------------------------------------------------------------- + // stuff called from panel side, must lock engine + + // called from onSelect + void enableLearn(const int id) + { + if (learningId == id) + return; + + ccs[id] = -1; + nextLearningId = -1; + learningId = id; + learnedCc = false; + learnedParam = false; + } + + // called from onDeselect + void disableLearn(const int id) + { + nextLearningId = -1; + + if (learningId == id) + learningId = -1; + } + + // called from onDeselect + void learnParam(const int id, const int64_t moduleId, const int paramId) + { + pcontext->engine->updateParamHandle(¶mHandles[id], moduleId, paramId, true); + learnedParam = true; + maybeCommitLearn(); + updateMapLen(); + } + + // ---------------------------------------------------------------------------------------------------------------- + // common utils + + void maybeCommitLearn() { if (learningId < 0) return; @@ -283,42 +345,27 @@ struct HostMIDIMap : Module { return; if (!learnedParam) return; + // Reset learned state learnedCc = false; learnedParam = false; + // Find next incomplete map - while (++learningId < MAX_CHANNELS) { + while (++learningId < MAX_MIDI_CONTROL) + { if (ccs[learningId] < 0 || paramHandles[learningId].moduleId < 0) + { + nextLearningId = learningId; return; + } } - learningId = -1; + + nextLearningId = learningId = -1; } - void enableLearn(int id) + // FIXME this allocates string during RT!! + void refreshParamHandleText(const int id) { - if (learningId != id) { - learningId = id; - learnedCc = false; - learnedParam = false; - } - } - - void disableLearn(int id) - { - if (learningId == id) { - learningId = -1; - } - } - - void learnParam(int id, int64_t moduleId, int paramId) - { - pcontext->engine->updateParamHandle(¶mHandles[id], moduleId, paramId, true); - learnedParam = true; - commitLearn(); - updateMapLen(); - } - - void refreshParamHandleText(int id) { std::string text; if (ccs[id] >= 0) text = string::f("CC%02d", ccs[id]); @@ -327,6 +374,26 @@ struct HostMIDIMap : Module { paramHandles[id].text = text; } + void updateMapLen() + { + // Find last nonempty map + int id; + for (id = MAX_MIDI_CONTROL; --id >= 0;) + { + if (ccs[id] >= 0 || paramHandles[id].moduleId >= 0) + break; + } + + mapLen = id + 1; + + // Add an empty "Mapping..." slot + if (mapLen < MAX_MIDI_CONTROL) + ++mapLen; + } + + // ---------------------------------------------------------------------------------------------------------------- + // save and load json stuff + json_t* dataToJson() override { json_t* const rootJ = json_object(); @@ -369,7 +436,7 @@ struct HostMIDIMap : Module { json_t* paramIdJ = json_object_get(mapJ, "paramId"); if (!(ccJ && moduleIdJ && paramIdJ)) continue; - if (mapIndex >= MAX_CHANNELS) + if (mapIndex >= MAX_MIDI_CONTROL) continue; ccs[mapIndex] = json_integer_value(ccJ); pcontext->engine->updateParamHandle_NoLock(¶mHandles[mapIndex], @@ -393,25 +460,229 @@ struct HostMIDIMap : Module { // -------------------------------------------------------------------------------------------------------------------- -struct HostMIDIMapWidget : ModuleWidget { - static constexpr const float startX_In = 14.0f; - static constexpr const float startX_Out = 96.0f; - 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; +struct MIDIMapChoice : CardinalLedDisplayChoice { + HostMIDIMap* const module; + const int id; + int disableLearnFrames = -1; + ParamWidget* lastTouchedParam = nullptr; + MIDIMapChoice(HostMIDIMap* const m, const int i) + : CardinalLedDisplayChoice(), + module(m), + id(i) + { + alignTextCenter = false; + } + + void draw(const DrawArgs& args) override + { + if (bgColor.a > 0.0) + { + nvgBeginPath(args.vg); + nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 4); + nvgFillColor(args.vg, bgColor); + nvgFill(args.vg); + } + + Widget::draw(args); + } + + void step() override + { + if (!module) + return; + + // Set bgColor and selected state + if (module->learningId == id) + { + bgColor = color; + bgColor.a = 0.125f; + + if (ParamWidget* const touchedParam = APP->scene->rack->touchedParam) + { + if (module->nextLearningId == id) + { + module->nextLearningId = -1; + lastTouchedParam = touchedParam; + } + else if (lastTouchedParam != touchedParam) + { + const int64_t moduleId = touchedParam->module->id; + const int paramId = touchedParam->paramId; + module->learnParam(id, moduleId, paramId); + lastTouchedParam = touchedParam; + } + } + else + { + lastTouchedParam = nullptr; + } + } + else + { + bgColor = nvgRGB(0, 0, 0); + } + + // Set text + text.clear(); + + // mapped + if (module->ccs[id] >= 0) + text += string::f("CC%02d: ", module->ccs[id]); + if (module->paramHandles[id].moduleId >= 0) + text += getParamName(); + + // Set text color + if (text.empty() && module->learningId != id) + color.a = 0.75f; + else + color.a = 1.0f; + + // unmapped + if (text.empty()) + { + if (module->learningId == id) + text = "Mapping..."; + else + text = module->mapLen == 1 ? "Click here to map" : "Unmapped"; + } + } + + void onButton(const ButtonEvent& e) override + { + DISTRHO_SAFE_ASSERT_RETURN(module != nullptr,); + + e.stopPropagating(); + + if (e.action != GLFW_PRESS) + return; + + switch (e.button) + { + case GLFW_MOUSE_BUTTON_RIGHT: + module->clearMap(id); + e.consume(this); + break; + // fall-through + case GLFW_MOUSE_BUTTON_LEFT: + APP->scene->rack->touchedParam = lastTouchedParam = nullptr; + module->enableLearn(id); + e.consume(this); + break; + } + } + + /* + void onSelect(const SelectEvent& e) override + { + DISTRHO_SAFE_ASSERT_RETURN(module != nullptr,); + + ScrollWidget* scroll = getAncestorOfType(); + scroll->scrollTo(box); + } + */ + + std::string getParamName() const + { + DISTRHO_SAFE_ASSERT_RETURN(module != nullptr, "error"); + DISTRHO_SAFE_ASSERT_RETURN(id < module->mapLen, "error"); + + ParamHandle* const paramHandle = &module->paramHandles[id]; + + Module* const paramModule = paramHandle->module; + DISTRHO_SAFE_ASSERT_RETURN(paramModule != nullptr, "error"); + + const int paramId = paramHandle->paramId; + DISTRHO_SAFE_ASSERT_RETURN(paramId < (int) paramModule->params.size(), "error"); + + ParamQuantity* const paramQuantity = paramModule->paramQuantities[paramId]; + std::string s = paramQuantity->name; + if (s.empty()) + s = "Unnamed"; + s += " ("; + s += paramModule->model->name; + s += ")"; + return s; + } +}; + +struct HostMIDIMapDisplay : Widget { + HostMIDIMap* module; + ScrollWidget* scroll; + MIDIMapChoice* choices[MAX_MIDI_CONTROL]; + LedDisplaySeparator* separators[MAX_MIDI_CONTROL]; + + void drawLayer(const DrawArgs& args, int layer) override + { + nvgScissor(args.vg, RECT_ARGS(args.clipBox)); + Widget::drawLayer(args, layer); + nvgResetScissor(args.vg); + } + + void setModule(HostMIDIMap* const module) + { + this->module = module; + + scroll = new ScrollWidget; + scroll->box.size = box.size; + addChild(scroll); + + float posY = 0.0f; + for (int id = 0; id < MAX_MIDI_CONTROL; ++id) + { + if (id != 0) + { + LedDisplaySeparator* separator = createWidget(Vec(0.0f, posY)); + separator->box.size = Vec(box.size.x, 1.0f); + scroll->container->addChild(separator); + separators[id] = separator; + } + + MIDIMapChoice* const choice = new MIDIMapChoice(module, id); + choice->box.pos = Vec(0.0f, posY); + choice->box.size = Vec(box.size.x, 20.0f); + scroll->container->addChild(choice); + choices[id] = choice; + + posY += choice->box.size.y; + } + } + + void step() override + { + if (module != nullptr) + { + const int mapLen = module->mapLen; + + for (int id = 1; id < MAX_MIDI_CONTROL; ++id) + { + separators[id]->visible = (id < mapLen); + choices[id]->visible = (id < mapLen); + } + } + + Widget::step(); + } +}; + +struct HostMIDIMapWidget : ModuleWidget { HostMIDIMap* const module; HostMIDIMapWidget(HostMIDIMap* const m) : module(m) { setModule(m); - setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDI.svg"))); + setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDIMap.svg"))); 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))); addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); + + HostMIDIMapDisplay* const display = createWidget(Vec(1.0f, 71.0f)); + display->box.size = Vec(box.size.x - 2.0f, box.size.y - 89.0f); + display->setModule(m); + addChild(display); } void draw(const DrawArgs& args) override diff --git a/plugins/Cardinal/src/plugin.hpp b/plugins/Cardinal/src/plugin.hpp index 9a05fe3..5ddfde7 100644 --- a/plugins/Cardinal/src/plugin.hpp +++ b/plugins/Cardinal/src/plugin.hpp @@ -26,6 +26,8 @@ using namespace rack; struct CardinalLedDisplayChoice : LedDisplayChoice { + bool alignTextCenter = true; + CardinalLedDisplayChoice(const char* const label = nullptr) { color = nvgRGBf(0.76f, 0.11f, 0.22f); @@ -35,14 +37,23 @@ struct CardinalLedDisplayChoice : LedDisplayChoice { text = label; } - void drawLayer(const DrawArgs& args, int layer) override + void drawLayer(const DrawArgs& args, const int layer) override { if (layer == 1) { nvgFillColor(args.vg, color); - nvgTextAlign(args.vg, NVG_ALIGN_CENTER); nvgTextLetterSpacing(args.vg, 0.0f); - nvgText(args.vg, box.size.x * 0.5f, textOffset.y, text.c_str(), NULL); + + if (alignTextCenter) + { + nvgTextAlign(args.vg, NVG_ALIGN_CENTER); + nvgText(args.vg, box.size.x * 0.5f, textOffset.y, text.c_str(), nullptr); + } + else + { + nvgTextAlign(args.vg, NVG_ALIGN_LEFT); + nvgText(args.vg, textOffset.x, textOffset.y, text.c_str(), nullptr); + } } Widget::drawLayer(args, layer); diff --git a/plugins/Core.json b/plugins/Core.json deleted file mode 100644 index cdec1fc..0000000 --- a/plugins/Core.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "slug": "Core", - "name": "Cardinal Core", - "version": "2.0.1", - "license": "GPL-3.0-or-later", - "author": "Vortico", - "brand": "Vortico", - "authorEmail": "support@vcvrack.com", - "authorUrl": "https://vcvrack.com/", - "manualUrl": "https://vcvrack.com/manual/Core", - "sourceUrl": "https://github.com/VCVRack/Rack", - "changelogUrl": "https://github.com/VCVRack/Rack/blob/v2/CHANGELOG.md", - "description": "Necessary modules built into Cardinal", - "modules": [ - { - "slug": "MIDITriggerToCVInterface", - "name": "MIDI to Gate", - "description": "Converts MIDI notes from an external device to gates", - "manualUrl": "https://vcvrack.com/manual/Core#MIDI-Gate", - "tags": [ - "External", - "MIDI" - ] - }, - { - "slug": "MIDI-Map", - "name": "MIDI Map", - "description": "Controls parameters (knobs, sliders, switches) directly with MIDI CC", - "manualUrl": "https://vcvrack.com/manual/Core#MIDI-Map", - "tags": [ - "External", - "MIDI" - ] - }, - { - "slug": "CV-Gate", - "name": "Gate to MIDI", - "description": "Converts gates to MIDI notes and sends to an external device", - "manualUrl": "https://vcvrack.com/manual/Core#CV-Gate", - "tags": [ - "External", - "MIDI" - ] - }, - { - "slug": "Blank", - "name": "Blank", - "description": "A resizable blank panel", - "manualUrl": "https://vcvrack.com/manual/Core#Blank", - "tags": [ - "Blank" - ], - "hidden": true - } - ] -} diff --git a/plugins/Makefile b/plugins/Makefile index 2241427..0adc690 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -826,28 +826,21 @@ else PLUGIN_LIST = $(subst /plugin.json,,$(wildcard */plugin.json)) endif -PLUGIN_RESOURCES = ../bin/CardinalFX.lv2/resources/PluginManifests/Core.json +PLUGIN_RESOURCES = PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/%) PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.lv2/resources/PluginManifests/%.json) ifeq ($(MACOS),true) -PLUGIN_RESOURCES += ../bin/CardinalFX.vst/Contents/Resources/PluginManifests/Core.json PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/Contents/Resources/%) PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/Contents/Resources/PluginManifests/%.json) else -PLUGIN_RESOURCES += ../bin/CardinalFX.vst/resources/PluginManifests/Core.json PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/resources/%) PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst/resources/PluginManifests/%.json) endif -PLUGIN_RESOURCES += ../bin/CardinalFX.vst3/Contents/Resources/PluginManifests/Core.json PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst3/Contents/Resources/%) PLUGIN_RESOURCES += $(PLUGIN_LIST:%=../bin/CardinalFX.vst3/Contents/Resources/PluginManifests/%.json) resources: $(PLUGIN_RESOURCES) -../bin/CardinalFX.%/Core.json: Core.json - -@mkdir -p "$(shell dirname $@)" - ln -sf $(abspath $<) $@ - ../bin/CardinalFX.lv2/resources/%: %/res -@mkdir -p "$(shell dirname $@)" ln -sf $(abspath $<) $@ diff --git a/plugins/plugins.cpp b/plugins/plugins.cpp index 3cec9ee..8cc8456 100644 --- a/plugins/plugins.cpp +++ b/plugins/plugins.cpp @@ -595,14 +595,6 @@ std::string pluginManifest(const std::string& dirname); std::string pluginPath(const std::string& dirname); } -// core plugins -namespace core { -extern Model* modelMIDI_Gate; -extern Model* modelMIDIMap; -extern Model* modelGate_MIDI; -extern Model* modelBlank; -} - // regular plugins namespace plugin { @@ -685,20 +677,6 @@ struct StaticPluginLoader { } }; -static void initStatic__Core() -{ - Plugin* const p = new Plugin; - - const StaticPluginLoader spl(p, "Core"); - if (spl.ok()) - { - p->addModel(rack::core::modelMIDI_Gate); - p->addModel(rack::core::modelMIDIMap); - p->addModel(rack::core::modelGate_MIDI); - p->addModel(rack::core::modelBlank); - } -} - static void initStatic__Cardinal() { Plugin* const p = new Plugin; @@ -1996,7 +1974,6 @@ static void initStatic__ZZC() void initStaticPlugins() { - initStatic__Core(); initStatic__Cardinal(); #ifndef NOPLUGINS initStatic__21kHz(); diff --git a/src/Makefile b/src/Makefile index 04227d4..047d856 100644 --- a/src/Makefile +++ b/src/Makefile @@ -127,15 +127,10 @@ IGNORED_FILES += Rack/src/rtmidi.cpp IGNORED_FILES += Rack/src/app/MenuBar.cpp IGNORED_FILES += Rack/src/app/Scene.cpp IGNORED_FILES += Rack/src/app/TipWindow.cpp -IGNORED_FILES += Rack/src/core/Audio.cpp -IGNORED_FILES += Rack/src/core/CV_MIDI.cpp -IGNORED_FILES += Rack/src/core/CV_MIDICC.cpp -IGNORED_FILES += Rack/src/core/MIDI_CV.cpp -IGNORED_FILES += Rack/src/core/MIDICC_CV.cpp -IGNORED_FILES += Rack/src/core/Notes.cpp IGNORED_FILES += Rack/src/engine/Engine.cpp IGNORED_FILES += Rack/src/plugin/Model.cpp IGNORED_FILES += Rack/src/window/Window.cpp +IGNORED_FILES += $(wildcard Rack/src/core/*.cpp) RACK_FILES += $(wildcard Rack/src/*.c) RACK_FILES += $(wildcard Rack/src/*/*.c) @@ -200,16 +195,6 @@ $(BUILD_DIR)/override/MIDI_CV.cpp.o: override/MIDI_CV.cpp @echo "Compiling $<" $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@ -$(BUILD_DIR)/Rack/src/core/Blank.cpp.o: Rack/src/core/Blank.cpp - -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" - @echo "Compiling $<" - $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -D'nvgRGB(r,g,b)=nvgRGBblank(r,g,b)' -c -o $@ - -$(BUILD_DIR)/Rack/src/core/%.cpp.o: Rack/src/core/%.cpp - -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" - @echo "Compiling $<" - $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@ - $(BUILD_DIR)/%.cpp.o: %.cpp -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" @echo "Compiling $<" diff --git a/src/override/plugin.cpp b/src/override/plugin.cpp index cd6cbc6..76d10aa 100644 --- a/src/override/plugin.cpp +++ b/src/override/plugin.cpp @@ -89,9 +89,13 @@ static const std::map moduleSlugFallbacks = {{"Core", "AudioInterface16"}, {"Cardinal", "HostAudio8"}}, {{"Core", "MIDIToCVInterface"}, {"Cardinal", "HostMIDI"}}, {{"Core", "MIDICCToCVInterface"}, {"Cardinal", "HostMIDICC"}}, + {{"Core", "MIDITriggerToCVInterface"}, {"Cardinal", "HostMIDIGate"}}, {{"Core", "CV-MIDI"}, {"Cardinal", "HostMIDI"}}, {{"Core", "CV-CC"}, {"Cardinal", "HostMIDICC"}}, + {{"Core", "CV-Gate"}, {"Cardinal", "HostMIDIGate"}}, + {{"Core", "MIDI-Map"}, {"Cardinal", "HostMIDIMap"}}, {{"Core", "Notes"}, {"Cardinal", "TextEditor"}}, + {{"Core", "Blank"}, {"Cardinal", "Blank"}}, {{"MindMeld-ShapeMasterPro", "ShapeMasterPro"}, {"MindMeldModular", "ShapeMaster"}}, // {{"", ""}, {"", ""}}, };