lv2export: Make sure to keep context valid during RT
This commit is contained in:
parent
5194a48628
commit
6c7f478515
3 changed files with 19 additions and 7 deletions
|
@ -34,7 +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
|
||||||
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
|
||||||
|
@ -189,3 +189,9 @@ $(BUILD_DIR)/plugin/ChowDSP/%.o: ../plugins/ChowDSP/src/%
|
||||||
@echo "Compiling $< (ChowDSP Chorus)"
|
@echo "Compiling $< (ChowDSP Chorus)"
|
||||||
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@ \
|
$(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -UPRIVATE -c -o $@ \
|
||||||
-DpluginInstance=pluginInstance__ChowDSP
|
-DpluginInstance=pluginInstance__ChowDSP
|
||||||
|
|
||||||
|
# --------------------------------------------------------------
|
||||||
|
|
||||||
|
-include $(BUILD_OBJS:%.o=%.d)
|
||||||
|
|
||||||
|
# --------------------------------------------------------------
|
||||||
|
|
|
@ -87,6 +87,7 @@ std::vector<Plugin*> plugins;
|
||||||
} // namespace rack
|
} // namespace rack
|
||||||
|
|
||||||
struct PluginLv2 {
|
struct PluginLv2 {
|
||||||
|
Context* context;
|
||||||
Plugin* plugin;
|
Plugin* plugin;
|
||||||
engine::Module* module;
|
engine::Module* module;
|
||||||
float sampleRate;
|
float sampleRate;
|
||||||
|
@ -97,7 +98,7 @@ 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 = new Context;
|
||||||
context->engine = new Engine;
|
context->engine = new Engine;
|
||||||
context->engine->internal->sampleRate = sr;
|
context->engine->internal->sampleRate = sr;
|
||||||
contextSet(context);
|
contextSet(context);
|
||||||
|
@ -126,12 +127,14 @@ struct PluginLv2 {
|
||||||
|
|
||||||
PluginLv2()
|
PluginLv2()
|
||||||
{
|
{
|
||||||
|
contextSet(context);
|
||||||
|
|
||||||
delete[] ports;
|
delete[] ports;
|
||||||
delete module;
|
delete module;
|
||||||
|
|
||||||
// FIXME shared instance for this
|
// FIXME shared instance for this
|
||||||
delete plugin;
|
delete plugin;
|
||||||
delete contextGet();
|
delete context;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv2_connect_port(const uint32_t port, void* const dataLocation)
|
void lv2_connect_port(const uint32_t port, void* const dataLocation)
|
||||||
|
@ -141,6 +144,7 @@ struct PluginLv2 {
|
||||||
|
|
||||||
void lv2_activate()
|
void lv2_activate()
|
||||||
{
|
{
|
||||||
|
contextSet(context);
|
||||||
module->onReset();
|
module->onReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +153,8 @@ struct PluginLv2 {
|
||||||
if (sampleCount == 0)
|
if (sampleCount == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
contextSet(context);
|
||||||
|
|
||||||
Module::ProcessArgs args = {
|
Module::ProcessArgs args = {
|
||||||
sampleRate,
|
sampleRate,
|
||||||
1.0f / sampleRate,
|
1.0f / sampleRate,
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "OpenGL.hpp"
|
#include "OpenGL.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "src/nanovg/nanovg.h"
|
#include "nanovg.h"
|
||||||
|
|
||||||
#ifdef HEADLESS
|
#ifdef HEADLESS
|
||||||
struct NVGLUframebuffer;
|
struct NVGLUframebuffer;
|
||||||
|
@ -29,8 +29,8 @@ void nvgluDeleteFramebuffer(NVGLUframebuffer* fb) {}
|
||||||
#else
|
#else
|
||||||
# define NANOVG_GLES2_IMPLEMENTATION
|
# define NANOVG_GLES2_IMPLEMENTATION
|
||||||
# define NANOVG_FBO_VALID 1
|
# define NANOVG_FBO_VALID 1
|
||||||
# include "src/nanovg/nanovg_gl.h"
|
# include "nanovg_gl.h"
|
||||||
# include "src/nanovg/nanovg_gl_utils.h"
|
# include "nanovg_gl_utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 6)
|
#if defined(__GNUC__) && (__GNUC__ >= 6)
|
||||||
|
@ -39,7 +39,7 @@ void nvgluDeleteFramebuffer(NVGLUframebuffer* fb) {}
|
||||||
# pragma GCC diagnostic ignored "-Wshift-negative-value"
|
# pragma GCC diagnostic ignored "-Wshift-negative-value"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "src/nanovg/nanovg.c"
|
#include "nanovg.c"
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 6)
|
#if defined(__GNUC__) && (__GNUC__ >= 6)
|
||||||
# pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue