1
Fork 0

Start test code to load individual modules

This commit is contained in:
falkTX 2021-10-31 00:20:23 +01:00
parent 9eb1583671
commit 9d7221dd50
4 changed files with 517 additions and 0 deletions

159
lv2export/Makefile Normal file
View File

@ -0,0 +1,159 @@
#!/usr/bin/make -f
# Makefile for DISTRHO Plugins #
# ---------------------------- #
# Created by falkTX
#
# --------------------------------------------------------------
# Build config
PREFIX ?= /usr/local
DESTDIR ?=
SYSDEPS ?= false
# --------------------------------------------------------------
# List of modules to build, based on their C++ model name
MODULES += SpringReverb
# --------------------------------------------------------------
# Import base definitions
USE_NANOVG_FBO = true
include ../dpf/Makefile.base.mk
# --------------------------------------------------------------
# Build setup
BUILD_DIR = ../build/lv2export
ifeq ($(MACOS),true)
BASE_FLAGS += -DARCH_MAC
else ifeq ($(WINDOWS),true)
BASE_FLAGS += -DARCH_WIN
else
BASE_FLAGS += -DARCH_LIN
endif
BASE_FLAGS += -fno-finite-math-only
BASE_FLAGS += -I../dpf/dgl/src/nanovg
BASE_FLAGS += -I../dpf/distrho
BASE_FLAGS += -I../include
BASE_FLAGS += -I../include/neon-compat
BASE_FLAGS += -I../src/Rack/include
ifeq ($(SYSDEPS),true)
BASE_FLAGS += $(shell pkg-config --cflags jansson libarchive samplerate speexdsp)
else
BASE_FLAGS += -I../src/Rack/dep/include
endif
BASE_FLAGS += -I../src/Rack/dep/filesystem/include
BASE_FLAGS += -I../src/Rack/dep/fuzzysearchdatabase/src
BASE_FLAGS += -I../src/Rack/dep/glfw/include
BASE_FLAGS += -I../src/Rack/dep/nanosvg/src
# BASE_FLAGS += -IRack/dep/osdialog
BASE_FLAGS += -I../src/Rack/dep/oui-blendish
BASE_FLAGS += -I../src/Rack/dep/pffft
BASE_FLAGS += -pthread
ifeq ($(WINDOWS),true)
BASE_FLAGS += -D_USE_MATH_DEFINES
BASE_FLAGS += -DWIN32_LEAN_AND_MEAN
BASE_FLAGS += -I../include/mingw-compat
BASE_FLAGS += -I../include/mingw-std-threads
endif
ifeq ($(HEADLESS),true)
BASE_FLAGS += -DHEADLESS
endif
ifeq ($(WITH_LTO),true)
BASE_FLAGS += -fno-strict-aliasing -flto
endif
# --------------------------------------------------------------
# FIXME lots of warnings from VCV side
BASE_FLAGS += -Wno-unused-parameter
BASE_FLAGS += -Wno-unused-variable
# --------------------------------------------------------------
# extra linker flags
LINK_FLAGS += -pthread
ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true)
LINK_FLAGS += -ldl
endif
ifeq ($(MACOS),true)
LINK_FLAGS += -framework IOKit
else ifeq ($(WINDOWS),true)
# needed by VCVRack
EXTRA_LIBS += -ldbghelp -lshlwapi
# needed by JW-Modules
EXTRA_LIBS += -lws2_32 -lwinmm
endif
ifeq ($(SYSDEPS),true)
EXTRA_LIBS += $(shell pkg-config --libs jansson libarchive samplerate speexdsp)
endif
ifeq ($(WITH_LTO),true)
LINK_FLAGS += -fno-strict-aliasing -flto -Werror=odr -Werror=lto-type-mismatch
endif
# --------------------------------------------------------------
# Build targets
BUILD_FILES = test.cpp
BUILD_FILES += dep.cpp
BUILD_FILES += dep2.cpp
BUILD_FILES += ../src/Rack/src/logger.cpp
BUILD_FILES += ../src/Rack/src/random.cpp
BUILD_FILES += ../src/Rack/src/string.cpp
BUILD_FILES += ../src/Rack/src/system.cpp
BUILD_FILES += ../src/Rack/src/Quantity.cpp
BUILD_FILES += ../src/Rack/src/engine/Module.cpp
BUILD_FILES += ../src/Rack/src/engine/ParamQuantity.cpp
BUILD_FILES += ../src/Rack/src/engine/PortInfo.cpp
ifneq ($(SYSDEPS),true)
BUILD_FILES += ../src/Rack/dep/pffft/pffft.c
BUILD_FILES += ../src/Rack/dep/pffft/fftpack.c
endif
TARGET = test
all: $(TARGET)
EXTRA_LIBS = ../plugins/plugins.a
ifneq ($(SYSDEPS),true)
EXTRA_LIBS += ../src/Rack/dep/lib/libjansson.a
EXTRA_LIBS += ../src/Rack/dep/lib/libsamplerate.a
EXTRA_LIBS += ../src/Rack/dep/lib/libspeexdsp.a
ifeq ($(WINDOWS),true)
EXTRA_LIBS += ../src/Rack/dep/lib/libarchive_static.a
else
EXTRA_LIBS += ../src/Rack/dep/lib/libarchive.a
endif
EXTRA_LIBS += ../src/Rack/dep/lib/libzstd.a
endif
# --------------------------------------------------------------
# Build commands
OBJS = $(BUILD_FILES:%=$(BUILD_DIR)/%.o)
$(TARGET): $(OBJS)
-@mkdir -p $(shell dirname $@)
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) -o $@
$(BUILD_DIR)/%.c.o: %.c
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Compiling $<"
$(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@
$(BUILD_DIR)/%.cpp.o: %.cpp
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Compiling $<"
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@

35
lv2export/dep.cpp Normal file
View File

@ -0,0 +1,35 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021 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
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
*/
#include "nanovg.h"
struct NVGLUframebuffer;
void nvgluBindFramebuffer(NVGLUframebuffer* fb) {}
NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imageFlags) { return nullptr; }
void nvgluDeleteFramebuffer(NVGLUframebuffer* fb) {}
#if defined(__GNUC__) && (__GNUC__ >= 6)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wmisleading-indentation"
# pragma GCC diagnostic ignored "-Wshift-negative-value"
#endif
#include "nanovg.c"
#if defined(__GNUC__) && (__GNUC__ >= 6)
# pragma GCC diagnostic pop
#endif

238
lv2export/dep2.cpp Normal file
View File

@ -0,0 +1,238 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021 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
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
*/
#include <rack.hpp>
using namespace rack;
namespace rack {
namespace app {
Knob::Knob() {}
Knob::~Knob() {}
void Knob::initParamQuantity() {}
void Knob::onHover(const HoverEvent& e) {}
void Knob::onButton(const ButtonEvent& e) {}
void Knob::onDragStart(const DragStartEvent& e) {}
void Knob::onDragEnd(const DragEndEvent& e) {}
void Knob::onDragMove(const DragMoveEvent& e) {}
void Knob::onDragLeave(const DragLeaveEvent& e) {}
void Knob::onHoverScroll(const HoverScrollEvent& e) {}
void Knob::onLeave(const LeaveEvent& e) {}
void LightWidget::draw(const DrawArgs& args) {}
void LightWidget::drawLayer(const DrawArgs& args, int layer) {}
void LightWidget::drawBackground(const DrawArgs& args) {}
void LightWidget::drawLight(const DrawArgs& args) {}
void LightWidget::drawHalo(const DrawArgs& args) {}
ModuleLightWidget::~ModuleLightWidget() {}
engine::Light* ModuleLightWidget::getLight(int colorId) { return nullptr; }
engine::LightInfo* ModuleLightWidget::getLightInfo() { return nullptr; }
void ModuleLightWidget::createTooltip() {}
void ModuleLightWidget::destroyTooltip() {}
void ModuleLightWidget::step() {}
void ModuleLightWidget::onHover(const HoverEvent& e) {}
void ModuleLightWidget::onEnter(const EnterEvent& e) {}
void ModuleLightWidget::onLeave(const LeaveEvent& e) {}
ModuleWidget::ModuleWidget() {}
ModuleWidget::~ModuleWidget() {}
plugin::Model* ModuleWidget::getModel() { return nullptr; }
void ModuleWidget::setModel(plugin::Model* model) {}
engine::Module* ModuleWidget::getModule() { return nullptr; }
void ModuleWidget::setModule(engine::Module* module) {}
widget::Widget* ModuleWidget::getPanel() { return nullptr; }
void ModuleWidget::setPanel(widget::Widget* panel) {}
void ModuleWidget::setPanel(std::shared_ptr<window::Svg> svg) {}
void ModuleWidget::addParam(ParamWidget* param) {}
void ModuleWidget::addInput(PortWidget* input) {}
void ModuleWidget::addOutput(PortWidget* output) {}
ParamWidget* ModuleWidget::getParam(int paramId) { return nullptr; }
PortWidget* ModuleWidget::getInput(int portId) { return nullptr; }
PortWidget* ModuleWidget::getOutput(int portId) { return nullptr; }
std::vector<ParamWidget*> ModuleWidget::getParams() { return {}; }
std::vector<PortWidget*> ModuleWidget::getPorts() { return {}; }
std::vector<PortWidget*> ModuleWidget::getInputs() { return {}; }
std::vector<PortWidget*> ModuleWidget::getOutputs() { return {}; }
void ModuleWidget::draw(const DrawArgs& args) {}
void ModuleWidget::drawLayer(const DrawArgs& args, int layer) {}
void ModuleWidget::onHover(const HoverEvent& e) {}
void ModuleWidget::onHoverKey(const HoverKeyEvent& e) {}
void ModuleWidget::onButton(const ButtonEvent& e) {}
void ModuleWidget::onDragStart(const DragStartEvent& e) {}
void ModuleWidget::onDragEnd(const DragEndEvent& e) {}
void ModuleWidget::onDragMove(const DragMoveEvent& e) {}
void ModuleWidget::onDragHover(const DragHoverEvent& e) {}
json_t* ModuleWidget::toJson() { return nullptr; }
void ModuleWidget::fromJson(json_t* rootJ) {}
bool ModuleWidget::pasteJsonAction(json_t* rootJ) { return false; }
void ModuleWidget::copyClipboard() {}
bool ModuleWidget::pasteClipboardAction() { return false; }
void ModuleWidget::load(std::string filename) {}
void ModuleWidget::loadAction(std::string filename) {}
void ModuleWidget::loadTemplate() {}
void ModuleWidget::loadDialog() {}
void ModuleWidget::save(std::string filename) {}
void ModuleWidget::saveTemplate() {}
void ModuleWidget::saveTemplateDialog() {}
bool ModuleWidget::hasTemplate() { return false; }
void ModuleWidget::clearTemplate() {}
void ModuleWidget::clearTemplateDialog() {}
void ModuleWidget::saveDialog() {}
void ModuleWidget::disconnect() {}
void ModuleWidget::resetAction() {}
void ModuleWidget::randomizeAction() {}
void ModuleWidget::appendDisconnectActions(history::ComplexAction* complexAction) {}
void ModuleWidget::disconnectAction() {}
void ModuleWidget::cloneAction(bool cloneCables) {}
void ModuleWidget::bypassAction(bool bypassed) {}
void ModuleWidget::removeAction() {}
void ModuleWidget::createContextMenu() {}
math::Vec& ModuleWidget::dragOffset() { static math::Vec r; return r; }
bool& ModuleWidget::dragEnabled() { static bool r; return r; }
math::Vec& ModuleWidget::oldPos() { static math::Vec r; return r; }
engine::Module* ModuleWidget::releaseModule() { return nullptr; }
int MultiLightWidget::getNumColors() { return 0; }
void MultiLightWidget::addBaseColor(NVGcolor baseColor) {}
void MultiLightWidget::setBrightnesses(const std::vector<float>& brightnesses) {}
ParamWidget::ParamWidget() {}
ParamWidget::~ParamWidget() {}
engine::ParamQuantity* ParamWidget::getParamQuantity() { return nullptr; }
void ParamWidget::createTooltip() {}
void ParamWidget::destroyTooltip() {}
void ParamWidget::step() {}
void ParamWidget::draw(const DrawArgs& args) {}
void ParamWidget::onButton(const ButtonEvent& e) {}
void ParamWidget::onDoubleClick(const DoubleClickEvent& e) {}
void ParamWidget::onEnter(const EnterEvent& e) {}
void ParamWidget::onLeave(const LeaveEvent& e) {}
void ParamWidget::createContextMenu() {}
void ParamWidget::resetAction() {}
PortWidget::PortWidget() {}
PortWidget::~PortWidget() {}
engine::Port* PortWidget::getPort() { return nullptr; }
engine::PortInfo* PortWidget::getPortInfo() { return nullptr; }
void PortWidget::createTooltip() {}
void PortWidget::destroyTooltip() {}
void PortWidget::createContextMenu() {}
void PortWidget::deleteTopCableAction() {}
void PortWidget::step() {}
void PortWidget::draw(const DrawArgs& args) {}
void PortWidget::onButton(const ButtonEvent& e) {}
void PortWidget::onEnter(const EnterEvent& e) {}
void PortWidget::onLeave(const LeaveEvent& e) {}
void PortWidget::onDragStart(const DragStartEvent& e) {}
void PortWidget::onDragEnd(const DragEndEvent& e) {}
void PortWidget::onDragDrop(const DragDropEvent& e) {}
void PortWidget::onDragEnter(const DragEnterEvent& e) {}
void PortWidget::onDragLeave(const DragLeaveEvent& e) {}
SliderKnob::SliderKnob() {}
void SliderKnob::onHover(const HoverEvent& e) {}
void SliderKnob::onButton(const ButtonEvent& e) {}
SvgKnob::SvgKnob() {}
void SvgKnob::setSvg(std::shared_ptr<window::Svg> svg) {}
void SvgKnob::onChange(const ChangeEvent& e) {}
SvgPort::SvgPort() {}
void SvgPort::setSvg(std::shared_ptr<window::Svg> svg) {}
SvgScrew::SvgScrew() {}
void SvgScrew::setSvg(std::shared_ptr<window::Svg> svg) {}
SvgSlider::SvgSlider() {}
void SvgSlider::setBackgroundSvg(std::shared_ptr<window::Svg> svg) {}
void SvgSlider::setHandleSvg(std::shared_ptr<window::Svg> svg) {}
void SvgSlider::setHandlePos(math::Vec minHandlePos, math::Vec maxHandlePos) {}
void SvgSlider::setHandlePosCentered(math::Vec minHandlePosCentered, math::Vec maxHandlePosCentered) {}
void SvgSlider::onChange(const ChangeEvent& e) {}
}
namespace widget {
FramebufferWidget::FramebufferWidget() {}
FramebufferWidget::~FramebufferWidget() {}
void FramebufferWidget::setDirty(bool dirty) {}
int FramebufferWidget::getImageHandle() { return 0; }
NVGLUframebuffer* FramebufferWidget::getFramebuffer() { return nullptr; }
math::Vec FramebufferWidget::getFramebufferSize() { return {}; }
void FramebufferWidget::deleteFramebuffer() {}
void FramebufferWidget::step() {}
void FramebufferWidget::draw(const DrawArgs& args) {}
void FramebufferWidget::render(math::Vec scale, math::Vec offsetF, math::Rect clipBox) {}
void FramebufferWidget::drawFramebuffer() {}
void FramebufferWidget::onDirty(const DirtyEvent& e) {}
void FramebufferWidget::onContextCreate(const ContextCreateEvent& e) {}
void FramebufferWidget::onContextDestroy(const ContextDestroyEvent& e) {}
SvgWidget::SvgWidget() {}
void SvgWidget::wrap() {}
void SvgWidget::setSvg(std::shared_ptr<window::Svg> svg) {}
void SvgWidget::draw(const DrawArgs& args) {}
Widget::~Widget() {}
math::Rect Widget::getBox() { return {}; }
void Widget::setBox(math::Rect box) {}
math::Vec Widget::getPosition() { return {}; }
void Widget::setPosition(math::Vec pos) {}
math::Vec Widget::getSize() { return {}; }
void Widget::setSize(math::Vec size) {}
widget::Widget* Widget::getParent() { return nullptr; }
bool Widget::isVisible() { return false; }
void Widget::setVisible(bool visible) {}
void Widget::requestDelete() {}
math::Rect Widget::getChildrenBoundingBox() { return {}; }
math::Rect Widget::getVisibleChildrenBoundingBox() { return {}; }
bool Widget::isDescendantOf(Widget* ancestor) { return false; }
math::Vec Widget::getRelativeOffset(math::Vec v, Widget* ancestor) { return {}; }
float Widget::getRelativeZoom(Widget* ancestor) { return 0.0f; }
math::Rect Widget::getViewport(math::Rect r) { return {}; }
bool Widget::hasChild(Widget* child) { return false; }
void Widget::addChild(Widget* child) {}
void Widget::addChildBottom(Widget* child) {}
void Widget::addChildBelow(Widget* child, Widget* sibling) {}
void Widget::addChildAbove(Widget* child, Widget* sibling) {}
void Widget::removeChild(Widget* child) {}
void Widget::clearChildren() {}
void Widget::step() {}
void Widget::draw(const DrawArgs& args) {}
void Widget::drawLayer(const DrawArgs& args, int layer) {}
void Widget::drawChild(Widget* child, const DrawArgs& args, int layer) {}
}
namespace window {
Svg::~Svg() {}
void Svg::loadFile(const std::string& filename) {}
void Svg::loadString(const std::string& str) {}
math::Vec Svg::getSize() { return {}; }
int Svg::getNumShapes() { return 0; }
int Svg::getNumPaths() { return 0; }
int Svg::getNumPoints() { return 0; }
void Svg::draw(NVGcontext* vg) {}
std::shared_ptr<Svg> Svg::load(const std::string& filename) { return {}; }
}
}

85
lv2export/test.cpp Normal file
View File

@ -0,0 +1,85 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021 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
* published by the Free Software Foundation; either version 3 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the LICENSE file.
*/
#include <rack.hpp>
#include <context.hpp>
#include "DistrhoUtils.hpp"
using namespace rack;
extern Model* modelSpringReverb;
Plugin* pluginInstance__Befaco;
namespace rack {
Context::~Context() {
}
static thread_local Context* threadContext = nullptr;
Context* contextGet() {
DISTRHO_SAFE_ASSERT(threadContext != nullptr);
return threadContext;
}
// Apple's clang incorrectly compiles this function when -O2 or higher is enabled.
#ifdef ARCH_MAC
__attribute__((optnone))
#endif
void contextSet(Context* const context) {
// DISTRHO_SAFE_ASSERT(threadContext == nullptr);
threadContext = context;
}
Exception::Exception(const char* format, ...)
{
va_list args;
va_start(args, format);
msg = string::fV(format, args);
va_end(args);
}
namespace asset {
std::string plugin(plugin::Plugin* plugin, std::string filename) { return {}; }
std::string system(std::string filename) { return {}; }
}
namespace engine {
float Engine::getParamValue(Module* module, int paramId) { return 0.0f; }
float Engine::getParamSmoothValue(Module* module, int paramId) { return 0.0f; }
void Engine::setParamValue(Module* module, int paramId, float value) {}
void Engine::setParamSmoothValue(Module* module, int paramId, float value) {}
}
namespace plugin {
void Plugin::addModel(Model* model)
{
// Check that the model is not added to a plugin already
DISTRHO_SAFE_ASSERT_RETURN(model != nullptr,);
DISTRHO_SAFE_ASSERT_RETURN(model->plugin == nullptr,);
model->plugin = this;
models.push_back(model);
}
Model* modelFromJson(json_t* moduleJ) {
return nullptr;
}
std::vector<Plugin*> plugins;
} // namespace plugin
} // namespace rack
int main()
{
Plugin* const p = new Plugin;
pluginInstance__Befaco = p;
p->addModel(modelSpringReverb);
d_stdout("modelSpringReverb is %p", modelSpringReverb);
return 0;
}