@@ -476,7 +476,7 @@ public: | |||||
void setTransientWinId(const intptr_t winId) | void setTransientWinId(const intptr_t winId) | ||||
{ | { | ||||
#if defined(DGL_OS_LINUX) | #if defined(DGL_OS_LINUX) | ||||
XSetTransientForHint(xDisplay, xWindow, static_cast<::Window>(winId)); | |||||
XSetTransientForHint(xDisplay, xWindow, static_cast< ::Window>(winId)); | |||||
#else | #else | ||||
return; | return; | ||||
// unused | // unused | ||||
@@ -19,6 +19,8 @@ | |||||
#include "lv2/atom.h" | #include "lv2/atom.h" | ||||
#include "lv2/atom-util.h" | #include "lv2/atom-util.h" | ||||
#include "lv2/buf-size.h" | #include "lv2/buf-size.h" | ||||
#include "lv2/data-access.h" | |||||
#include "lv2/instance-access.h" | |||||
#include "lv2/midi.h" | #include "lv2/midi.h" | ||||
#include "lv2/options.h" | #include "lv2/options.h" | ||||
#include "lv2/state.h" | #include "lv2/state.h" | ||||
@@ -556,6 +558,15 @@ public: | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||||
void* lv2_get_instance_pointer() | |||||
{ | |||||
return fPlugin.getInstancePointer(); | |||||
} | |||||
#endif | |||||
// ------------------------------------------------------------------- | |||||
private: | private: | ||||
PluginExporter fPlugin; | PluginExporter fPlugin; | ||||
@@ -824,6 +835,15 @@ LV2_Worker_Status lv2_work(LV2_Handle instance, LV2_Worker_Respond_Function, LV2 | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||||
static void* lv2_get_instance_pointer(LV2_Handle instance) | |||||
{ | |||||
return instancePtr->lv2_get_instance_pointer(); | |||||
} | |||||
#endif | |||||
// ----------------------------------------------------------------------- | |||||
static const void* lv2_extension_data(const char* uri) | static const void* lv2_extension_data(const char* uri) | ||||
{ | { | ||||
static const LV2_Options_Interface options = { lv2_get_options, lv2_set_options }; | static const LV2_Options_Interface options = { lv2_get_options, lv2_set_options }; | ||||
@@ -848,6 +868,19 @@ static const void* lv2_extension_data(const char* uri) | |||||
return &worker; | return &worker; | ||||
#endif | #endif | ||||
#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||||
# define DISTRHO_DIRECT_ACCESS_URI "urn:distrho:direct-access" | |||||
struct LV2_DirectAccess_Interface { | |||||
void* (*get_instance_pointer)(LV2_Handle handle); | |||||
}; | |||||
static const LV2_DirectAccess_Interface directaccess = { lv2_get_instance_pointer }; | |||||
if (std::strcmp(uri, DISTRHO_DIRECT_ACCESS_URI) == 0) | |||||
return &directaccess; | |||||
#endif | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
@@ -18,6 +18,7 @@ | |||||
#include "lv2/atom.h" | #include "lv2/atom.h" | ||||
#include "lv2/buf-size.h" | #include "lv2/buf-size.h" | ||||
#include "lv2/data-access.h" | |||||
#include "lv2/instance-access.h" | #include "lv2/instance-access.h" | ||||
#include "lv2/midi.h" | #include "lv2/midi.h" | ||||
#include "lv2/options.h" | #include "lv2/options.h" | ||||
@@ -87,7 +88,11 @@ void lv2_generate_ttl(const char* const basename) | |||||
# else | # else | ||||
manifestString += " a ui:X11UI ;\n"; | manifestString += " a ui:X11UI ;\n"; | ||||
# endif | # endif | ||||
# if ! DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||||
manifestString += " ui:binary <" + pluginLabel + "_ui." DISTRHO_DLL_EXTENSION "> ;\n"; | manifestString += " ui:binary <" + pluginLabel + "_ui." DISTRHO_DLL_EXTENSION "> ;\n"; | ||||
# else | |||||
manifestString += " ui:binary <" + pluginLabel + "." DISTRHO_DLL_EXTENSION "> ;\n"; | |||||
#endif | |||||
# if DISTRHO_PLUGIN_WANT_PROGRAMS | # if DISTRHO_PLUGIN_WANT_PROGRAMS | ||||
manifestString += " lv2:extensionData ui:idleInterface ,\n"; | manifestString += " lv2:extensionData ui:idleInterface ,\n"; | ||||
manifestString += " <" LV2_PROGRAMS__Interface "> ;\n"; | manifestString += " <" LV2_PROGRAMS__Interface "> ;\n"; | ||||
@@ -98,6 +103,7 @@ void lv2_generate_ttl(const char* const basename) | |||||
manifestString += " ui:touch ;\n"; | manifestString += " ui:touch ;\n"; | ||||
manifestString += " lv2:requiredFeature ui:resize ,\n"; | manifestString += " lv2:requiredFeature ui:resize ,\n"; | ||||
# if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | # if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | ||||
manifestString += " <" LV2_DATA_ACCESS_URI "> ,\n"; | |||||
manifestString += " <" LV2_INSTANCE_ACCESS_URI "> ,\n"; | manifestString += " <" LV2_INSTANCE_ACCESS_URI "> ,\n"; | ||||
# endif | # endif | ||||
manifestString += " <" LV2_OPTIONS__options "> ,\n"; | manifestString += " <" LV2_OPTIONS__options "> ,\n"; | ||||
@@ -18,6 +18,7 @@ | |||||
#include "lv2/atom.h" | #include "lv2/atom.h" | ||||
#include "lv2/atom-util.h" | #include "lv2/atom-util.h" | ||||
#include "lv2/data-access.h" | |||||
#include "lv2/instance-access.h" | #include "lv2/instance-access.h" | ||||
#include "lv2/options.h" | #include "lv2/options.h" | ||||
#include "lv2/ui.h" | #include "lv2/ui.h" | ||||
@@ -205,6 +206,15 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, | |||||
void* parentId = nullptr; | void* parentId = nullptr; | ||||
void* instance = nullptr; | void* instance = nullptr; | ||||
#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||||
# define DISTRHO_DIRECT_ACCESS_URI "urn:distrho:direct-access" | |||||
struct LV2_DirectAccess_Interface { | |||||
void* (*get_instance_pointer)(LV2_Handle handle); | |||||
}; | |||||
const LV2_Extension_Data_Feature* extData = nullptr; | |||||
#endif | |||||
for (int i=0; features[i] != nullptr; ++i) | for (int i=0; features[i] != nullptr; ++i) | ||||
{ | { | ||||
if (std::strcmp(features[i]->URI, LV2_OPTIONS__options) == 0) | if (std::strcmp(features[i]->URI, LV2_OPTIONS__options) == 0) | ||||
@@ -216,6 +226,8 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, | |||||
else if (std::strcmp(features[i]->URI, LV2_UI__parent) == 0) | else if (std::strcmp(features[i]->URI, LV2_UI__parent) == 0) | ||||
parentId = features[i]->data; | parentId = features[i]->data; | ||||
#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | ||||
else if (std::strcmp(features[i]->URI, LV2_DATA_ACCESS_URI) == 0) | |||||
extData = (const LV2_Extension_Data_Feature*)features[i]->data; | |||||
else if (std::strcmp(features[i]->URI, LV2_INSTANCE_ACCESS_URI) == 0) | else if (std::strcmp(features[i]->URI, LV2_INSTANCE_ACCESS_URI) == 0) | ||||
instance = features[i]->data; | instance = features[i]->data; | ||||
#endif | #endif | ||||
@@ -246,9 +258,19 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, | |||||
} | } | ||||
#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | ||||
if (instance == nullptr) | |||||
if (extData == nullptr || instance == nullptr) | |||||
{ | |||||
d_stderr("Data or instance access missing, cannot continue!"); | |||||
return nullptr; | |||||
} | |||||
if (const LV2_DirectAccess_Interface* const directAccess = (const LV2_DirectAccess_Interface*)extData->data_access(DISTRHO_DIRECT_ACCESS_URI)) | |||||
{ | |||||
instance = directAccess->get_instance_pointer(instance); | |||||
} | |||||
else | |||||
{ | { | ||||
d_stderr("Instance-access missing, cannot continue!"); | |||||
d_stderr("Failed to get direct access, cannot continue!"); | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
#endif | #endif | ||||
@@ -50,7 +50,6 @@ lv2: libs | |||||
$(MAKE) -C PingPongPan/LV2 | $(MAKE) -C PingPongPan/LV2 | ||||
$(MAKE) -C PingPongPan/LV2-UI | $(MAKE) -C PingPongPan/LV2-UI | ||||
$(MAKE) -C PowerJuice/LV2 | $(MAKE) -C PowerJuice/LV2 | ||||
$(MAKE) -C PowerJuice/LV2-UI | |||||
$(MAKE) -C SegmentJuice/LV2 | $(MAKE) -C SegmentJuice/LV2 | ||||
$(MAKE) -C SegmentJuice/LV2-UI | $(MAKE) -C SegmentJuice/LV2-UI | ||||
$(MAKE) -C VectorJuice/LV2 | $(MAKE) -C VectorJuice/LV2 | ||||
@@ -103,7 +102,6 @@ clean: | |||||
$(MAKE) clean -C PingPongPan/LV2 | $(MAKE) clean -C PingPongPan/LV2 | ||||
$(MAKE) clean -C PingPongPan/LV2-UI | $(MAKE) clean -C PingPongPan/LV2-UI | ||||
$(MAKE) clean -C PowerJuice/LV2 | $(MAKE) clean -C PowerJuice/LV2 | ||||
$(MAKE) clean -C PowerJuice/LV2-UI | |||||
$(MAKE) clean -C SegmentJuice/LV2 | $(MAKE) clean -C SegmentJuice/LV2 | ||||
$(MAKE) clean -C SegmentJuice/LV2-UI | $(MAKE) clean -C SegmentJuice/LV2-UI | ||||
$(MAKE) clean -C VectorJuice/LV2 | $(MAKE) clean -C VectorJuice/LV2 | ||||
@@ -1,18 +0,0 @@ | |||||
dofile("../../../scripts/make-project.lua") | |||||
package = make_distrho_lv2_ui_project("PowerJuice") | |||||
package.files = { | |||||
matchfiles ( | |||||
"../source/PowerJuiceArtwork.cpp", | |||||
"../source/PowerJuicePlugin.cpp", | |||||
"../source/PowerJuiceUI.cpp", | |||||
"../../../libs/distrho/DistrhoUIMain.cpp" | |||||
) | |||||
} | |||||
package.links = { | |||||
package.links, | |||||
"rt" | |||||
} |
@@ -1,16 +1,14 @@ | |||||
dofile("../../../scripts/make-project.lua") | dofile("../../../scripts/make-project.lua") | ||||
package = make_distrho_lv2_project("PowerJuice") | |||||
package = make_distrho_lv2_combined_project("PowerJuice") | |||||
package.files = { | package.files = { | ||||
matchfiles ( | matchfiles ( | ||||
"../source/PowerJuiceArtwork.cpp", | |||||
"../source/PowerJuicePlugin.cpp", | "../source/PowerJuicePlugin.cpp", | ||||
"../../../libs/distrho/DistrhoPluginMain.cpp" | |||||
"../source/PowerJuiceUI.cpp", | |||||
"../../../libs/distrho/DistrhoPluginMain.cpp", | |||||
"../../../libs/distrho/DistrhoUIMain.cpp" | |||||
) | ) | ||||
} | } | ||||
package.links = { | |||||
package.links, | |||||
"rt" | |||||
} |
@@ -221,6 +221,29 @@ function make_distrho_lv2_ui_project(name) | |||||
return package | return package | ||||
end | end | ||||
function make_distrho_lv2_combined_project(name) | |||||
package = make_plugin_project(name, "LV2") | |||||
package.config["Release"].links = { "dgl" } | |||||
package.config["Debug"].links = { "dgl_debug" } | |||||
package.includepaths = { | |||||
package.includepaths, | |||||
"../../../libs/distrho", | |||||
"../../../libs/dgl" | |||||
} | |||||
if (windows) then | |||||
package.links = { "opengl32", "gdi32" } | |||||
elseif (macosx) then | |||||
package.linkoptions = { package.linkoptions, "-framework OpenGL", "-framework Cocoa" } | |||||
else | |||||
package.linkoptions = { package.linkoptions, "`pkg-config --libs gl x11`" } | |||||
end | |||||
return package | |||||
end | |||||
function make_distrho_vst_project(name) | function make_distrho_vst_project(name) | ||||
package = make_plugin_project(name, "VST") | package = make_plugin_project(name, "VST") | ||||