Tested to work with 3 plugins so far Signed-off-by: falkTX <falktx@falktx.com>tags/22.05
@@ -14,6 +14,7 @@ SYSDEPS ?= false | |||
# -------------------------------------------------------------- | |||
# Import base definitions | |||
USE_NANOVG_FBO = true | |||
include ../dpf/Makefile.base.mk | |||
# -------------------------------------------------------------- | |||
@@ -21,9 +22,6 @@ include ../dpf/Makefile.base.mk | |||
BUILD_DIR = ../build/lv2export | |||
BASE_FLAGS += -DHEADLESS | |||
BASE_FLAGS += -DPRIVATE= | |||
ifeq ($(MACOS),true) | |||
BASE_FLAGS += -DARCH_MAC | |||
else ifeq ($(WINDOWS),true) | |||
@@ -32,120 +30,77 @@ else | |||
BASE_FLAGS += -DARCH_LIN | |||
endif | |||
BASE_FLAGS += -fno-finite-math-only | |||
# BASE_FLAGS += -I../dpf/dgl | |||
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 += -DCARDINAL_SYSDEPS | |||
BASE_FLAGS += $(shell pkg-config --cflags jansson libarchive samplerate speexdsp) | |||
else | |||
BASE_FLAGS += -DZSTDLIB_VISIBILITY= | |||
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 | |||
ifeq ($(DEBUG),true) | |||
BASE_FLAGS += -UDEBUG | |||
endif | |||
# BASE_FLAGS += -DHEADLESS | |||
# BASE_FLAGS += -DPRIVATE= | |||
# | |||
# BASE_FLAGS += -fno-finite-math-only | |||
# # BASE_FLAGS += -I../dpf/dgl | |||
# 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 += -DCARDINAL_SYSDEPS | |||
# BASE_FLAGS += $(shell pkg-config --cflags jansson libarchive samplerate speexdsp) | |||
# else | |||
# BASE_FLAGS += -DZSTDLIB_VISIBILITY= | |||
# 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 | |||
# -------------------------------------------------------------- | |||
# lots of warnings from VCV side | |||
BASE_FLAGS += -Wno-unused-but-set-variable | |||
BASE_FLAGS += -Wno-unused-parameter | |||
BASE_FLAGS += -Wno-unused-result | |||
BASE_FLAGS += -Wno-unused-variable | |||
ifeq ($(MACOS),true) | |||
BASE_FLAGS += -Wno-unknown-warning-option | |||
endif | |||
# -------------------------------------------------------------- | |||
# extra linker flags | |||
LINK_FLAGS += -pthread | |||
# also from plugins | |||
ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true) | |||
LINK_FLAGS += -ldl | |||
endif | |||
BASE_FLAGS += -Wno-deprecated-declarations | |||
BASE_FLAGS += -Wno-implicit-fallthrough | |||
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) | |||
BASE_FLAGS += -Wno-unknown-warning-option | |||
endif | |||
# -------------------------------------------------------------- | |||
# Build files | |||
# BUILD_FILES += test.cpp | |||
# BUILD_FILES = dep.cpp | |||
BUILD_FILES += dep2.cpp | |||
BUILD_FILES += ../src/override/context.cpp | |||
BUILD_FILES += ../src/override/RemoteNanoVG.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/tinyexpr.c | |||
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 | |||
BUILD_FILES += ../src/Rack/dep/pffft/pffft.c | |||
BUILD_FILES += ../src/Rack/dep/pffft/fftpack.c | |||
BUILD_OBJS = $(BUILD_FILES:%=$(BUILD_DIR)/%.o) | |||
# ChowDSP Chorus | |||
BUILD_OBJS += $(BUILD_DIR)/lv2plugin/chowdsp-chorus.o | |||
BUILD_OBJS += $(BUILD_DIR)/plugin/ChowDSP/ChowChorus/ChowChorus.cpp.o | |||
BUILD_OBJS += $(BUILD_DIR)/plugin/ChowDSP/ChowChorus/BBDDelayLine.cpp.o | |||
BUILD_OBJS += $(BUILD_DIR)/plugin/ChowDSP/shared/SineWave.cpp.o | |||
BUILD_OBJS += $(BUILD_DIR)/plugin/ChowDSP/plugin.cpp.o | |||
# 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 | |||
# stuff to include | |||
BUILD_CXX_FLAGS += -I. | |||
BUILD_CXX_FLAGS += -Iincludes | |||
BUILD_CXX_FLAGS += -I../dpf/distrho | |||
BUILD_CXX_FLAGS += -I../plugins | |||
# -------------------------------------------------------------- | |||
# Build targets | |||
TARGETS = ../bin/CardinalModules.lv2/manifest.ttl | |||
TARGETS += ../bin/CardinalModules.lv2/plugins$(LIB_EXT) | |||
PLUGINS = $(subst plugins/,,$(subst .cpp,,$(wildcard plugins/*.cpp))) | |||
all: $(TARGETS) | |||
BINARIES = $(PLUGINS:%=../bin/cardinal-%.lv2/plugin$(LIB_EXT)) | |||
RESOURCES = $(PLUGINS:%=../bin/cardinal-%.lv2/manifest.ttl) | |||
RESOURCES += $(PLUGINS:%=../bin/cardinal-%.lv2/plugin.ttl) | |||
all: $(BINARIES) $(RESOURCES) | |||
clean: | |||
rm -f $(TARGETS) $(BUILD_OBJS) | |||
@@ -153,44 +108,31 @@ clean: | |||
# -------------------------------------------------------------- | |||
# Build commands | |||
../bin/CardinalModules.lv2/manifest.ttl: manifest.ttl.in | |||
-@mkdir -p $(shell dirname $@) | |||
sed -e "s/@LIB_EXT@/$(LIB_EXT)/" $< > $@ | |||
# FIXME wildcard install | |||
install -m 644 lv2ttl/* ../bin/CardinalModules.lv2/ | |||
../bin/CardinalModules.lv2/plugins$(LIB_EXT): $(BUILD_OBJS) | |||
../bin/cardinal-%.lv2/manifest.ttl: manifest.ttl.in | |||
-@mkdir -p $(shell dirname $@) | |||
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(SHARED) -o $@ | |||
sed -e "s/@LIB_EXT@/$(LIB_EXT)/" -e "s/@SLUG@/$*/" $< > $@ | |||
$(BUILD_DIR)/%.c.o: %.c | |||
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" | |||
@echo "Compiling $<" | |||
$(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@ | |||
../bin/cardinal-%.lv2/plugin.ttl: ../bin/cardinal-%.lv2/plugin$(LIB_EXT) | |||
../dpf/utils/lv2_ttl_generator$(APP_EXT) $^ | tail -n +2 > $@ | |||
$(BUILD_DIR)/%.cpp.o: %.cpp | |||
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" | |||
@echo "Compiling $<" | |||
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
../bin/cardinal-%.lv2/plugin$(LIB_EXT): $(BUILD_DIR)/%.cpp.o | |||
-@mkdir -p $(shell dirname $@) | |||
$(SILENT)$(CXX) $< $(LINK_FLAGS) $(SHARED) -o $@ | |||
# -------------------------------------------------------------- | |||
$(BUILD_DIR)/lv2plugin/chowdsp-chorus.o: lv2plugin.cpp | |||
-@mkdir -p "$(shell dirname $@)" | |||
@echo "Compiling $< (ChowDSP Chorus)" | |||
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@ \ | |||
-DPLUGIN_INSTANCE=pluginInstance__ChowDSP \ | |||
-DPLUGIN_MODEL=modelChowChorus \ | |||
-DPLUGIN_URI='"urn:cardinal:chow:chorus"' | |||
# $(BUILD_DIR)/valleyaudio-plateau.cpp.o: plugins/valleyaudio-plateau.cpp | |||
# -@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" | |||
# @echo "Compiling $<" | |||
# $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DSLUG='"$*"' -c -o $@ | |||
$(BUILD_DIR)/plugin/ChowDSP/%.o: ../plugins/ChowDSP/src/% | |||
-@mkdir -p "$(shell dirname $@)" | |||
@echo "Compiling $< (ChowDSP Chorus)" | |||
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@ \ | |||
-DpluginInstance=pluginInstance__ChowDSP | |||
$(BUILD_DIR)/%.cpp.o: plugins/%.cpp | |||
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)" | |||
@echo "Compiling $<" | |||
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DSLUG='"$*"' -c -o $@ | |||
# -------------------------------------------------------------- | |||
-include $(BUILD_OBJS:%.o=%.d) | |||
-include $(PLUGINS:%=$(BUILD_DIR)/%.cpp.d) | |||
# -------------------------------------------------------------- |
@@ -1,272 +0,0 @@ | |||
/* | |||
* 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. | |||
*/ | |||
#define PRIVATE | |||
#include <common.hpp> | |||
#undef PRIVATE | |||
#include <rack.hpp> | |||
using namespace rack; | |||
namespace rack { | |||
namespace settings { | |||
bool cpuMeter = false; | |||
} | |||
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 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 engine { | |||
std::string LightInfo::getName() { return name; } | |||
std::string LightInfo::getDescription() { return description; } | |||
} | |||
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 {}; } | |||
} | |||
} |
@@ -0,0 +1,115 @@ | |||
/* | |||
* DISTRHO Cardinal Plugin | |||
* 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 | |||
* 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. | |||
*/ | |||
#ifndef PLUGIN_MODEL | |||
# error PLUGIN_MODEL undefined | |||
#endif | |||
#ifndef PLUGIN_CV_INPUTS | |||
# error PLUGIN_CV_INPUTS undefined | |||
#endif | |||
#ifndef PLUGIN_CV_OUTPUTS | |||
# error PLUGIN_CV_OUTPUTS undefined | |||
#endif | |||
#include <cstdio> | |||
// ----------------------------------------------------------------------- | |||
DISTRHO_PLUGIN_EXPORT | |||
void lv2_generate_ttl() | |||
{ | |||
Context context; | |||
context._engine.sampleRate = 48000.f; | |||
contextSet(&context); | |||
engine::Module* module = PLUGIN_MODEL->createModule(); | |||
d_stdout("@prefix doap: <http://usefulinc.com/ns/doap#> ."); | |||
d_stdout("@prefix foaf: <http://xmlns.com/foaf/0.1/> ."); | |||
d_stdout("@prefix lv2: <http://lv2plug.in/ns/lv2core#> ."); | |||
d_stdout(""); | |||
d_stdout("<urn:cardinal:" SLUG ">"); | |||
d_stdout(" a lv2:Plugin, doap:Project ;"); | |||
d_stdout(" doap:name \"" SLUG "\" ;"); | |||
d_stdout(""); | |||
int index = 0; | |||
for (int i=0, numAudio=0, numCV=0; i<module->getNumInputs(); ++i) | |||
{ | |||
d_stdout(" lv2:port ["); | |||
if (kCvInputs[i]) | |||
{ | |||
d_stdout(" a lv2:InputPort, lv2:CVPort ;"); | |||
d_stdout(" lv2:symbol \"lv2_cv_in_%d\" ;", ++numCV); | |||
} | |||
else | |||
{ | |||
d_stdout(" a lv2:InputPort, lv2:AudioPort ;"); | |||
d_stdout(" lv2:symbol \"lv2_audio_in_%d\" ;", ++numAudio); | |||
} | |||
d_stdout(" lv2:name \"%s\" ;", module->getInputInfo(i)->getFullName().c_str()); | |||
d_stdout(" lv2:index %d ;", index++); | |||
d_stdout(" ] ;"); | |||
d_stdout(""); | |||
} | |||
for (int i=0, numAudio=0, numCV=0; i<module->getNumOutputs(); ++i) | |||
{ | |||
d_stdout(" lv2:port ["); | |||
if (kCvOutputs[i]) | |||
{ | |||
d_stdout(" a lv2:OutputPort, lv2:CVPort ;"); | |||
d_stdout(" lv2:symbol \"lv2_cv_out_%d\" ;", ++numCV); | |||
} | |||
else | |||
{ | |||
d_stdout(" a lv2:OutputPort, lv2:AudioPort ;"); | |||
d_stdout(" lv2:symbol \"lv2_audio_out_%d\" ;", ++numAudio); | |||
} | |||
d_stdout(" lv2:name \"%s\" ;", module->getOutputInfo(i)->getFullName().c_str()); | |||
d_stdout(" lv2:index %d ;", index++); | |||
d_stdout(" ] ;"); | |||
d_stdout(""); | |||
} | |||
for (int i=0; i<module->getNumParams(); ++i) | |||
{ | |||
ParamQuantity* q = module->getParamQuantity(i); | |||
d_stdout(" lv2:port ["); | |||
d_stdout(" a lv2:InputPort, lv2:ControlPort ;"); | |||
d_stdout(" lv2:index %d ;", index++); | |||
d_stdout(" lv2:symbol \"lv2_param_%d\" ;", i + 1); | |||
d_stdout(" lv2:name \"%s\" ;", q->name.c_str()); | |||
d_stdout(" lv2:default %f ;", q->defaultValue); | |||
d_stdout(" lv2:minimum %f ;", q->minValue); | |||
d_stdout(" lv2:maximum %f ;", q->maxValue); | |||
d_stdout(" ] ;"); | |||
d_stdout(""); | |||
// q->getDescription().c_str() | |||
// q->unit.c_str() | |||
} | |||
d_stdout(" ."); | |||
delete module; | |||
} | |||
// ----------------------------------------------------------------------- |
@@ -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 | |||
@@ -15,98 +15,55 @@ | |||
* For a full copy of the GNU General Public License see the LICENSE file. | |||
*/ | |||
#ifndef PLUGIN_INSTANCE | |||
# error PLUGIN_INSTANCE undefined | |||
#endif | |||
#ifndef PLUGIN_MODEL | |||
# error PLUGIN_MODEL undefined | |||
#endif | |||
#ifndef PLUGIN_URI | |||
# error PLUGIN_URI undefined | |||
#ifndef PLUGIN_CV_INPUTS | |||
# error PLUGIN_CV_INPUTS undefined | |||
#endif | |||
#define PRIVATE | |||
#include <common.hpp> | |||
#include <engine/Engine.hpp> | |||
#ifndef PLUGIN_CV_OUTPUTS | |||
# error PLUGIN_CV_OUTPUTS undefined | |||
#endif | |||
#undef PRIVATE | |||
#include <rack.hpp> | |||
static constexpr const bool kCvInputs[] = PLUGIN_CV_INPUTS; | |||
static constexpr const bool kCvOutputs[] = PLUGIN_CV_OUTPUTS; | |||
#include "src/lv2/buf-size.h" | |||
#include "src/lv2/options.h" | |||
#include "DistrhoUtils.hpp" | |||
using namespace rack; | |||
extern Model* PLUGIN_MODEL; | |||
extern Plugin* PLUGIN_INSTANCE; | |||
namespace rack { | |||
namespace engine { | |||
struct Engine::Internal { | |||
float sampleRate; | |||
}; | |||
static thread_local Context* threadContext = nullptr; | |||
Engine::Engine() | |||
{ | |||
internal = new Internal; | |||
Context* contextGet() { | |||
DISTRHO_SAFE_ASSERT(threadContext != nullptr); | |||
return threadContext; | |||
} | |||
Engine::~Engine() | |||
{ | |||
delete internal; | |||
} | |||
float Engine::getSampleRate() | |||
{ | |||
return internal->sampleRate; | |||
#ifdef ARCH_MAC | |||
__attribute__((optnone)) | |||
#endif | |||
void contextSet(Context* context) { | |||
threadContext = context; | |||
} | |||
} | |||
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 | |||
struct PluginLv2 { | |||
Context* context; | |||
Plugin* plugin; | |||
Context context; | |||
engine::Module* module; | |||
float sampleRate; | |||
int frameCount = 0; | |||
int numInputs, numOutputs, numParams, numLights; | |||
void** ports; | |||
PluginLv2(double sr) | |||
{ | |||
// FIXME shared instance for these 2 | |||
context = new Context; | |||
context->engine = new Engine; | |||
context->engine->internal->sampleRate = sr; | |||
contextSet(context); | |||
plugin = new Plugin; | |||
PLUGIN_INSTANCE = plugin; | |||
sampleRate = sr; | |||
plugin->addModel(PLUGIN_MODEL); | |||
context._engine.sampleRate = sr; | |||
contextSet(&context); | |||
module = PLUGIN_MODEL->createModule(); | |||
numInputs = module->getNumInputs(); | |||
@@ -115,26 +72,30 @@ struct PluginLv2 { | |||
numLights = module->getNumLights(); | |||
ports = new void*[numInputs+numOutputs+numParams+numLights]; | |||
Module::SampleRateChangeEvent e = { context._engine.sampleRate, 1.0f / context._engine.sampleRate }; | |||
module->onSampleRateChange(e); | |||
// FIXME for CV ports we need to detect if something is connected | |||
for (int i=numInputs; --i >=0;) | |||
module->inputs[i].channels = 1; | |||
{ | |||
if (!kCvInputs[i]) | |||
module->inputs[i].channels = 1; | |||
} | |||
for (int i=numOutputs; --i >=0;) | |||
module->outputs[i].channels = 1; | |||
{ | |||
if (!kCvOutputs[i]) | |||
module->outputs[i].channels = 1; | |||
} | |||
d_stdout("Loaded %s :: %i inputs, %i outputs, %i params and %i lights", | |||
PLUGIN_URI, numInputs, numOutputs, numParams, numLights); | |||
d_stdout("Loaded " SLUG " :: %i inputs, %i outputs, %i params and %i lights", | |||
numInputs, numOutputs, numParams, numLights); | |||
} | |||
PluginLv2() | |||
{ | |||
contextSet(context); | |||
contextSet(&context); | |||
delete[] ports; | |||
delete module; | |||
// FIXME shared instance for this | |||
delete plugin; | |||
delete context; | |||
} | |||
void lv2_connect_port(const uint32_t port, void* const dataLocation) | |||
@@ -144,7 +105,7 @@ struct PluginLv2 { | |||
void lv2_activate() | |||
{ | |||
contextSet(context); | |||
contextSet(&context); | |||
module->onReset(); | |||
} | |||
@@ -153,26 +114,32 @@ struct PluginLv2 { | |||
if (sampleCount == 0) | |||
return; | |||
contextSet(context); | |||
contextSet(&context); | |||
Module::ProcessArgs args = { | |||
sampleRate, | |||
1.0f / sampleRate, | |||
frameCount | |||
}; | |||
Module::ProcessArgs args = { context._engine.sampleRate, 1.0f / context._engine.sampleRate, frameCount }; | |||
for (int i=numParams; --i >=0;) | |||
module->params[i].setValue(*static_cast<float*>(ports[numInputs+numOutputs+i]) * 0.1f); // FIXME? | |||
module->params[i].setValue(*static_cast<const float*>(ports[numInputs+numOutputs+i])); | |||
for (uint32_t s=0; s<sampleCount; ++s) | |||
{ | |||
for (int i=numInputs; --i >=0;) | |||
module->inputs[i].setVoltage(static_cast<const float*>(ports[i])[s] * 5.0f); | |||
{ | |||
if (kCvInputs[i]) | |||
module->inputs[i].setVoltage(static_cast<const float*>(ports[i])[s]); | |||
else | |||
module->inputs[i].setVoltage(static_cast<const float*>(ports[i])[s] * 10.0f); | |||
} | |||
module->doProcess(args); | |||
for (int i=numOutputs; --i >=0;) | |||
static_cast<float*>(ports[numInputs+i])[s] = module->outputs[i].getVoltage() * 0.2f; | |||
{ | |||
if (kCvOutputs[i]) | |||
static_cast<float*>(ports[numInputs+i])[s] = module->outputs[i].getVoltage(); | |||
else | |||
static_cast<float*>(ports[numInputs+i])[s] = module->outputs[i].getVoltage() * 0.1f; | |||
} | |||
++args.frame; | |||
} | |||
@@ -205,10 +172,6 @@ static void lv2_run(LV2_Handle instance, uint32_t sampleCount) | |||
instancePtr->lv2_run(sampleCount); | |||
} | |||
static void lv2_deactivate(LV2_Handle instance) | |||
{ | |||
} | |||
static void lv2_cleanup(LV2_Handle instance) | |||
{ | |||
delete instancePtr; | |||
@@ -226,12 +189,12 @@ static const void* lv2_extension_data(const char* uri) | |||
// ----------------------------------------------------------------------- | |||
static const LV2_Descriptor sLv2Descriptor = { | |||
PLUGIN_URI, | |||
"urn:cardinal:" SLUG, | |||
lv2_instantiate, | |||
lv2_connect_port, | |||
lv2_activate, | |||
lv2_run, | |||
lv2_deactivate, | |||
NULL, // deactivate | |||
lv2_cleanup, | |||
lv2_extension_data | |||
}; | |||
@@ -1,64 +0,0 @@ | |||
@prefix doap: <http://usefulinc.com/ns/doap#> . | |||
@prefix foaf: <http://xmlns.com/foaf/0.1/> . | |||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||
@prefix mod: <http://moddevices.com/ns/mod#> . | |||
@prefix unit: <http://lv2plug.in/ns/extensions/units#> . | |||
<urn:cardinal:chow:chorus> | |||
a lv2:Plugin, doap:Project ; | |||
lv2:port [ | |||
a lv2:InputPort, lv2:AudioPort ; | |||
lv2:index 0 ; | |||
lv2:symbol "in" ; | |||
lv2:name "Input" ; | |||
] , [ | |||
a lv2:OutputPort, lv2:AudioPort ; | |||
lv2:index 1 ; | |||
lv2:symbol "left_out" ; | |||
lv2:name "Left output" ; | |||
] , [ | |||
a lv2:OutputPort, lv2:AudioPort ; | |||
lv2:index 2 ; | |||
lv2:symbol "right_out" ; | |||
lv2:name "Right output" ; | |||
] , [ | |||
a lv2:InputPort, lv2:ControlPort ; | |||
lv2:index 3 ; | |||
lv2:name "Rate" ; | |||
lv2:symbol "rate" ; | |||
lv2:default 50 ; | |||
lv2:minimum 0 ; | |||
lv2:maximum 100 ; | |||
unit:unit unit:pc; | |||
] , [ | |||
a lv2:InputPort, lv2:ControlPort ; | |||
lv2:index 4 ; | |||
lv2:name "Depth" ; | |||
lv2:symbol "depth" ; | |||
lv2:default 50 ; | |||
lv2:minimum 0 ; | |||
lv2:maximum 100 ; | |||
unit:unit unit:pc; | |||
] , [ | |||
a lv2:InputPort, lv2:ControlPort ; | |||
lv2:index 5 ; | |||
lv2:name "Feedback" ; | |||
lv2:symbol "Feedback" ; | |||
lv2:default 0 ; | |||
lv2:minimum 0 ; | |||
lv2:maximum 100 ; | |||
unit:unit unit:pc; | |||
] , [ | |||
a lv2:InputPort, lv2:ControlPort ; | |||
lv2:index 6 ; | |||
lv2:name "Mix" ; | |||
lv2:symbol "mix" ; | |||
lv2:default 50 ; | |||
lv2:minimum 0 ; | |||
lv2:maximum 100 ; | |||
unit:unit unit:pc; | |||
] ; | |||
mod:brand "ChowDSP" ; | |||
doap:name "ChowChorus" . |
@@ -1,7 +1,7 @@ | |||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> . | |||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |||
<urn:cardinal:chow:chorus> | |||
<urn:cardinal:@SLUG@> | |||
a lv2:Plugin ; | |||
lv2:binary <plugins@LIB_EXT@> ; | |||
rdfs:seeAlso <chow-chorus.ttl> . | |||
lv2:binary <plugin@LIB_EXT@> ; | |||
rdfs:seeAlso <plugin.ttl> . |
@@ -0,0 +1,25 @@ | |||
/* | |||
* DISTRHO Cardinal Plugin | |||
* 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 | |||
* 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 "MSM/src/Phaser.cpp" | |||
#define PLUGIN_MODEL modelPhaserModule | |||
#define PLUGIN_CV_INPUTS {1,1,1,0} | |||
#define PLUGIN_CV_OUTPUTS {0} | |||
#include "lv2plugin.cpp" | |||
#include "export.cpp" |
@@ -0,0 +1,25 @@ | |||
/* | |||
* DISTRHO Cardinal Plugin | |||
* 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 | |||
* 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 "rackwindows/src/mv.cpp" | |||
#define PLUGIN_MODEL modelMv | |||
#define PLUGIN_CV_INPUTS {1,1,1,1,0,0} | |||
#define PLUGIN_CV_OUTPUTS {0,0} | |||
#include "lv2plugin.cpp" | |||
#include "export.cpp" |
@@ -0,0 +1,25 @@ | |||
/* | |||
* DISTRHO Cardinal Plugin | |||
* 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 | |||
* 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 "rackwindows/src/vibrato.cpp" | |||
#define PLUGIN_MODEL modelVibrato | |||
#define PLUGIN_CV_INPUTS {1,1,1,1,1,0} | |||
#define PLUGIN_CV_OUTPUTS {1,0,1} | |||
#include "lv2plugin.cpp" | |||
#include "export.cpp" |
@@ -1,123 +0,0 @@ | |||
/* | |||
* 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; | |||
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); | |||
engine::Module* module = modelSpringReverb->createModule(); | |||
d_stdout("modelSpringReverb is %p %p", modelSpringReverb, module); | |||
d_stdout("modelSpringReverb has %d ins, %d outs, %d lights, %d params", | |||
module->getNumInputs(), module->getNumOutputs(), module->getNumLights(), module->getNumParams()); | |||
for (int i=0; i<module->getNumInputs(); ++i) | |||
d_stdout(" in %d has name '%s'; description '%s'", | |||
i+1, module->getInputInfo(i)->getFullName().c_str(), module->getInputInfo(i)->getDescription().c_str()); | |||
for (int i=0; i<module->getNumOutputs(); ++i) | |||
d_stdout(" out %d has name '%s'; description '%s'", | |||
i+1, module->getOutputInfo(i)->getFullName().c_str(), module->getOutputInfo(i)->getDescription().c_str()); | |||
// for (int i=0; i<module->getNumLights(); ++i) | |||
// { | |||
// LightInfo* l = module->getLightInfo(i); | |||
// DISTRHO_SAFE_ASSERT_CONTINUE(l != nullptr); | |||
// d_stdout(" light %d has name '%s'; description '%s'", | |||
// i+1, l->getName().c_str(), l->getDescription().c_str()); | |||
// } | |||
for (int i=0; i<module->getNumParams(); ++i) | |||
{ | |||
ParamQuantity* q = module->getParamQuantity(i); | |||
d_stdout(" param %d has name '%s'; description '%s'; unit '%s'; min %f; max %f; def %f", | |||
i+1, q->name.c_str(), q->getDescription().c_str(), q->unit.c_str(), | |||
q->minValue, q->maxValue, q->defaultValue); | |||
} | |||
Module::ProcessArgs args = { | |||
48000.0f, | |||
1.0f / 48000.0f, | |||
0 | |||
}; | |||
for (int i=0; i<96000; ++i) | |||
{ | |||
module->process(args); | |||
++args.frame; | |||
} | |||
return 0; | |||
} |