Support midi input expander in Carla; Cleanup

This commit is contained in:
falkTX 2022-02-03 01:48:32 +00:00
parent 4a629b46c3
commit c163b40b64
4 changed files with 40 additions and 11 deletions

View file

@ -0,0 +1,14 @@
../../../include
../../../carla/source/backend
../../../carla/source/includes
../../../carla/source/modules
../../../carla/source/utils
../../../dpf
../../../dpf/distrho
../../../dpf/dgl/src/nanovg
../../../src/Rack/include
../../../src/Rack/dep/include
../../../src/Rack/dep/filesystem/include
../../../src/Rack/dep/glfw/include
../../../src/Rack/dep/nanosvg/src
../../../src/Rack/dep/pffft

View file

@ -16,6 +16,7 @@
*/
#include "plugincontext.hpp"
#include "Expander.hpp"
#include "ModuleWidgets.hpp"
#include "CarlaNativePlugin.h"
@ -369,8 +370,25 @@ struct CarlaModule : Module {
}
}
NativeMidiEvent* midiEvents;
uint midiEventCount;
if (CardinalExpanderFromCVToCarlaMIDI* const midiInExpander = leftExpander.module != nullptr && leftExpander.module->model == modelExpanderInputMIDI
? static_cast<CardinalExpanderFromCVToCarlaMIDI*>(leftExpander.module)
: nullptr)
{
midiEvents = midiInExpander->midiEvents;
midiEventCount = midiInExpander->midiEventCount;
midiInExpander->midiEventCount = midiInExpander->frame = 0;
}
else
{
midiEvents = nullptr;
midiEventCount = 0;
}
audioDataFill = 0;
fCarlaPluginDescriptor->process(fCarlaPluginHandle, dataInPtr, dataOutPtr, BUFFER_SIZE, nullptr, 0);
fCarlaPluginDescriptor->process(fCarlaPluginHandle, dataInPtr, dataOutPtr, BUFFER_SIZE, midiEvents, midiEventCount);
}
}

View file

@ -220,14 +220,7 @@ struct CardinalExpanderForInputMIDIWidget : ModuleWidgetWithSideScrews<> {
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
for (int i=0; i<CardinalExpanderForInputMIDI::NUM_INPUTS; ++i)
addInput(createInput<PJ301MPort>(Vec(startX + 5.0f, startY + padding * i), module, i));
}
void drawOutputJacksArea(NVGcontext* const vg, const int numOutputs) {
nvgBeginPath(vg);
nvgRoundedRect(vg, 12.0f, startY - 2.0f, box.size.x - 12.0f, padding * numOutputs, 4);
nvgFillColor(vg, nvgRGB(0xd0, 0xd0, 0xd0));
nvgFill(vg);
addInput(createInput<PJ301MPort>(Vec(startX + 4.0f, startY + padding * i), module, i));
}
void draw(const DrawArgs& args) override
@ -235,6 +228,7 @@ struct CardinalExpanderForInputMIDIWidget : ModuleWidgetWithSideScrews<> {
drawBackground(args.vg);
nvgScissor(args.vg, startX, 0.0f, box.size.x - startX, box.size.y);
nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0));
for (int i=0; i<CardinalExpanderForInputMIDI::NUM_INPUTS; ++i)
{
@ -242,12 +236,15 @@ struct CardinalExpanderForInputMIDIWidget : ModuleWidgetWithSideScrews<> {
nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, startX, y - 19.0f, box.size.x, padding - 4.0f, 4);
nvgFillColor(args.vg, nvgRGB(0xd0, 0xd0, 0xd0));
nvgFill(args.vg);
}
nvgResetScissor(args.vg);
nvgBeginPath(args.vg);
nvgRoundedRect(args.vg, 6.5f, startY - 19.0f, 3.0f, padding * 6.0f - 4.0f, 1);
nvgFill(args.vg);
nvgBeginPath(args.vg);
nvgRect(args.vg, box.size.x * 0.5f, 0, box.size.x, box.size.y);
nvgFillColor(args.vg, color::BLACK);

View file

@ -1,6 +1,6 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as