More work for lv2 export, test with chow chorus
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
1304a16f73
commit
866fd16b10
4 changed files with 71 additions and 27 deletions
|
@ -22,7 +22,7 @@ include ../dpf/Makefile.base.mk
|
||||||
|
|
||||||
BUILD_DIR = ../build/lv2export
|
BUILD_DIR = ../build/lv2export
|
||||||
|
|
||||||
# BASE_FLAGS += -DHEADLESS
|
BASE_FLAGS += -DHEADLESS
|
||||||
BASE_FLAGS += -DPRIVATE=
|
BASE_FLAGS += -DPRIVATE=
|
||||||
|
|
||||||
ifeq ($(MACOS),true)
|
ifeq ($(MACOS),true)
|
||||||
|
@ -34,6 +34,7 @@ BASE_FLAGS += -DARCH_LIN
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BASE_FLAGS += -fno-finite-math-only
|
BASE_FLAGS += -fno-finite-math-only
|
||||||
|
BASE_FLAGS += -I../dpf/dgl
|
||||||
BASE_FLAGS += -I../dpf/dgl/src/nanovg
|
BASE_FLAGS += -I../dpf/dgl/src/nanovg
|
||||||
BASE_FLAGS += -I../dpf/distrho
|
BASE_FLAGS += -I../dpf/distrho
|
||||||
BASE_FLAGS += -I../include
|
BASE_FLAGS += -I../include
|
||||||
|
@ -100,8 +101,10 @@ endif
|
||||||
# Build files
|
# Build files
|
||||||
|
|
||||||
# BUILD_FILES += test.cpp
|
# BUILD_FILES += test.cpp
|
||||||
BUILD_FILES = dep.cpp
|
# BUILD_FILES = dep.cpp
|
||||||
BUILD_FILES += dep2.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/logger.cpp
|
||||||
BUILD_FILES += ../src/Rack/src/random.cpp
|
BUILD_FILES += ../src/Rack/src/random.cpp
|
||||||
BUILD_FILES += ../src/Rack/src/string.cpp
|
BUILD_FILES += ../src/Rack/src/string.cpp
|
||||||
|
@ -115,9 +118,15 @@ BUILD_FILES += ../src/Rack/dep/pffft/pffft.c
|
||||||
BUILD_FILES += ../src/Rack/dep/pffft/fftpack.c
|
BUILD_FILES += ../src/Rack/dep/pffft/fftpack.c
|
||||||
|
|
||||||
BUILD_OBJS = $(BUILD_FILES:%=$(BUILD_DIR)/%.o)
|
BUILD_OBJS = $(BUILD_FILES:%=$(BUILD_DIR)/%.o)
|
||||||
BUILD_OBJS += $(BUILD_DIR)/lv2plugin/chowdsp-chorus.o
|
|
||||||
|
|
||||||
EXTRA_LIBS = ../plugins/plugins.a
|
# 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)
|
ifneq ($(SYSDEPS),true)
|
||||||
EXTRA_LIBS += ../src/Rack/dep/lib/libjansson.a
|
EXTRA_LIBS += ../src/Rack/dep/lib/libjansson.a
|
||||||
|
@ -139,6 +148,9 @@ TARGETS += ../bin/CardinalModules.lv2/plugins$(LIB_EXT)
|
||||||
|
|
||||||
all: $(TARGETS)
|
all: $(TARGETS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(TARGETS) $(BUILD_OBJS)
|
||||||
|
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Build commands
|
# Build commands
|
||||||
|
|
||||||
|
@ -162,10 +174,18 @@ $(BUILD_DIR)/%.cpp.o: %.cpp
|
||||||
@echo "Compiling $<"
|
@echo "Compiling $<"
|
||||||
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
|
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
|
||||||
|
|
||||||
|
# --------------------------------------------------------------
|
||||||
|
|
||||||
$(BUILD_DIR)/lv2plugin/chowdsp-chorus.o: lv2plugin.cpp
|
$(BUILD_DIR)/lv2plugin/chowdsp-chorus.o: lv2plugin.cpp
|
||||||
-@mkdir -p "$(shell dirname $@)"
|
-@mkdir -p "$(shell dirname $@)"
|
||||||
@echo "Compiling $< (ChowDSP Chorus)"
|
@echo "Compiling $< (ChowDSP Chorus)"
|
||||||
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@ \
|
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@ \
|
||||||
-DPLUGIN_INSTANCE=pluginInstance__ChowDSP \
|
-DPLUGIN_INSTANCE=pluginInstance__ChowDSP \
|
||||||
-DPLUGIN_MODEL=modelChowChorus \
|
-DPLUGIN_MODEL=modelChowChorus \
|
||||||
-DPLUGIN_URI='"modelChowChorus"'
|
-DPLUGIN_URI='"urn:cardinal:chow:chorus"'
|
||||||
|
|
||||||
|
$(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
|
||||||
|
|
|
@ -15,8 +15,11 @@
|
||||||
* For a full copy of the GNU General Public License see the LICENSE file.
|
* For a full copy of the GNU General Public License see the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define PRIVATE
|
||||||
|
#include <common.hpp>
|
||||||
|
|
||||||
|
#undef PRIVATE
|
||||||
#include <rack.hpp>
|
#include <rack.hpp>
|
||||||
#include <context.hpp>
|
|
||||||
|
|
||||||
using namespace rack;
|
using namespace rack;
|
||||||
|
|
||||||
|
@ -24,21 +27,6 @@ namespace rack {
|
||||||
namespace settings {
|
namespace settings {
|
||||||
bool cpuMeter = false;
|
bool cpuMeter = false;
|
||||||
}
|
}
|
||||||
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, ...)
|
Exception::Exception(const char* format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
|
@ -27,8 +27,11 @@
|
||||||
# error PLUGIN_URI undefined
|
# error PLUGIN_URI undefined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define PRIVATE
|
||||||
|
#include <common.hpp>
|
||||||
|
#include <engine/Engine.hpp>
|
||||||
|
|
||||||
#undef PRIVATE
|
#undef PRIVATE
|
||||||
// #include <common.hpp>
|
|
||||||
#include <rack.hpp>
|
#include <rack.hpp>
|
||||||
|
|
||||||
#include "src/lv2/buf-size.h"
|
#include "src/lv2/buf-size.h"
|
||||||
|
@ -39,10 +42,34 @@
|
||||||
using namespace rack;
|
using namespace rack;
|
||||||
|
|
||||||
extern Model* PLUGIN_MODEL;
|
extern Model* PLUGIN_MODEL;
|
||||||
Plugin* PLUGIN_INSTANCE;
|
extern Plugin* PLUGIN_INSTANCE;
|
||||||
|
|
||||||
namespace rack {
|
namespace rack {
|
||||||
|
namespace engine {
|
||||||
|
|
||||||
|
struct Engine::Internal {
|
||||||
|
float sampleRate;
|
||||||
|
};
|
||||||
|
|
||||||
|
Engine::Engine()
|
||||||
|
{
|
||||||
|
internal = new Internal;
|
||||||
|
}
|
||||||
|
|
||||||
|
Engine::~Engine()
|
||||||
|
{
|
||||||
|
delete internal;
|
||||||
|
}
|
||||||
|
|
||||||
|
float Engine::getSampleRate()
|
||||||
|
{
|
||||||
|
return internal->sampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
namespace plugin {
|
namespace plugin {
|
||||||
|
|
||||||
void Plugin::addModel(Model* model)
|
void Plugin::addModel(Model* model)
|
||||||
{
|
{
|
||||||
// Check that the model is not added to a plugin already
|
// Check that the model is not added to a plugin already
|
||||||
|
@ -55,6 +82,7 @@ Model* modelFromJson(json_t* moduleJ) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
std::vector<Plugin*> plugins;
|
std::vector<Plugin*> plugins;
|
||||||
|
|
||||||
} // namespace plugin
|
} // namespace plugin
|
||||||
} // namespace rack
|
} // namespace rack
|
||||||
|
|
||||||
|
@ -69,6 +97,10 @@ struct PluginLv2 {
|
||||||
PluginLv2(double sr)
|
PluginLv2(double sr)
|
||||||
{
|
{
|
||||||
// FIXME shared instance for these 2
|
// FIXME shared instance for these 2
|
||||||
|
Context* const context = new Context;
|
||||||
|
context->engine = new Engine;
|
||||||
|
context->engine->internal->sampleRate = sr;
|
||||||
|
contextSet(context);
|
||||||
plugin = new Plugin;
|
plugin = new Plugin;
|
||||||
PLUGIN_INSTANCE = plugin;
|
PLUGIN_INSTANCE = plugin;
|
||||||
|
|
||||||
|
@ -87,6 +119,9 @@ struct PluginLv2 {
|
||||||
module->inputs[i].channels = 1;
|
module->inputs[i].channels = 1;
|
||||||
for (int i=numOutputs; --i >=0;)
|
for (int i=numOutputs; --i >=0;)
|
||||||
module->outputs[i].channels = 1;
|
module->outputs[i].channels = 1;
|
||||||
|
|
||||||
|
d_stdout("Loaded %s :: %i inputs, %i outputs, %i params and %i lights",
|
||||||
|
PLUGIN_URI, numInputs, numOutputs, numParams, numLights);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginLv2()
|
PluginLv2()
|
||||||
|
@ -96,6 +131,7 @@ struct PluginLv2 {
|
||||||
|
|
||||||
// FIXME shared instance for this
|
// FIXME shared instance for this
|
||||||
delete plugin;
|
delete plugin;
|
||||||
|
delete contextGet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv2_connect_port(const uint32_t port, void* const dataLocation)
|
void lv2_connect_port(const uint32_t port, void* const dataLocation)
|
||||||
|
@ -120,17 +156,17 @@ struct PluginLv2 {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i=numParams; --i >=0;)
|
for (int i=numParams; --i >=0;)
|
||||||
module->params[i].setValue(*static_cast<float*>(ports[numInputs+numOutputs+i]));
|
module->params[i].setValue(*static_cast<float*>(ports[numInputs+numOutputs+i]) * 0.1f); // FIXME?
|
||||||
|
|
||||||
for (uint32_t s=0; s<sampleCount; ++s)
|
for (uint32_t s=0; s<sampleCount; ++s)
|
||||||
{
|
{
|
||||||
for (int i=numInputs; --i >=0;)
|
for (int i=numInputs; --i >=0;)
|
||||||
module->inputs[i].setVoltage(static_cast<float*>(ports[i])[s] * 10.0f);
|
module->inputs[i].setVoltage(static_cast<const float*>(ports[i])[s] * 5.0f);
|
||||||
|
|
||||||
module->doProcess(args);
|
module->doProcess(args);
|
||||||
|
|
||||||
for (int i=numOutputs; --i >=0;)
|
for (int i=numOutputs; --i >=0;)
|
||||||
static_cast<float*>(ports[numInputs+i])[s] = module->outputs[i].getVoltage() * 0.1f;
|
static_cast<float*>(ports[numInputs+i])[s] = module->outputs[i].getVoltage() * 0.2f;
|
||||||
|
|
||||||
++args.frame;
|
++args.frame;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
|
|
||||||
<urn:cardinal:chow:chorus>
|
<urn:cardinal:chow:chorus>
|
||||||
a lv2:Plugin ;
|
a lv2:Plugin ;
|
||||||
lv2:binary <plugins.dylib> ;
|
lv2:binary <plugins@LIB_EXT@> ;
|
||||||
rdfs:seeAlso <chow-chorus.ttl> .
|
rdfs:seeAlso <chow-chorus.ttl> .
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue