@@ -580,10 +580,13 @@ public: | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
bool lv2ui_instantiate(LV2UI_Write_Function writeFunction, LV2UI_Controller controller, LV2UI_Widget* widget, const LV2_Feature* const* features) | |||||
void lv2ui_instantiate(LV2UI_Write_Function writeFunction, LV2UI_Controller controller, LV2UI_Widget* widget, const LV2_Feature* const* features) | |||||
{ | { | ||||
const LV2_Options_Option* options = nullptr; | |||||
const char* windowTitle = nullptr; | |||||
fUI.writeFunction = writeFunction; | |||||
fUI.controller = controller; | |||||
// --------------------------------------------------------------- | |||||
// see if the host supports external-ui | |||||
for (int i=0; features[i] != nullptr; ++i) | for (int i=0; features[i] != nullptr; ++i) | ||||
{ | { | ||||
@@ -591,43 +594,42 @@ public: | |||||
std::strcmp(features[i]->URI, LV2_EXTERNAL_UI_DEPRECATED_URI) == 0) | std::strcmp(features[i]->URI, LV2_EXTERNAL_UI_DEPRECATED_URI) == 0) | ||||
{ | { | ||||
fUI.host = (const LV2_External_UI_Host*)features[i]->data; | fUI.host = (const LV2_External_UI_Host*)features[i]->data; | ||||
break; | |||||
} | } | ||||
else if (std::strcmp(features[i]->URI, LV2_OPTIONS__options) == 0) | |||||
options = (const LV2_Options_Option*)features[i]->data; | |||||
} | |||||
if (options == nullptr) | |||||
{ | |||||
carla_stderr("Host doesn't provides option feature"); | |||||
return false; | |||||
} | } | ||||
if (fUI.host != nullptr) | if (fUI.host != nullptr) | ||||
{ | { | ||||
windowTitle = carla_strdup(fUI.host->plugin_human_id); | |||||
fHost.uiName = carla_strdup(fUI.host->plugin_human_id); | |||||
*widget = this; | |||||
return; | |||||
} | } | ||||
else | |||||
// --------------------------------------------------------------- | |||||
// no external-ui support, use showInterface | |||||
for (int i=0; features[i] != nullptr; ++i) | |||||
{ | { | ||||
for (int i=0; options[i].key != 0; ++i) | |||||
if (std::strcmp(features[i]->URI, LV2_OPTIONS__options) == 0) | |||||
{ | { | ||||
if (options[i].key == fUridMap->map(fUridMap->handle, LV2_UI__windowTitle)) | |||||
const LV2_Options_Option* const options((const LV2_Options_Option*)features[i]->data); | |||||
for (int i=0; options[i].key != 0; ++i) | |||||
{ | { | ||||
windowTitle = carla_strdup((const char*)options[i].value); | |||||
break; | |||||
if (options[i].key == fUridMap->map(fUridMap->handle, LV2_UI__windowTitle)) | |||||
{ | |||||
fHost.uiName = carla_strdup((const char*)options[i].value); | |||||
break; | |||||
} | |||||
} | } | ||||
break; | |||||
} | } | ||||
} | } | ||||
if (windowTitle == nullptr) | |||||
return false; | |||||
fUI.writeFunction = writeFunction; | |||||
fUI.controller = controller; | |||||
fHost.uiName = windowTitle; | |||||
if (fHost.uiName == nullptr) | |||||
fHost.uiName = carla_strdup(fDescriptor->name); | |||||
*widget = (fUI.host != nullptr) ? this : nullptr; | |||||
return true; | |||||
*widget = nullptr; | |||||
} | } | ||||
void lv2ui_port_event(uint32_t portIndex, uint32_t bufferSize, uint32_t format, const void* buffer) const | void lv2ui_port_event(uint32_t portIndex, uint32_t bufferSize, uint32_t format, const void* buffer) const | ||||
@@ -1404,11 +1406,7 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char*, cons | |||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (! plugin->lv2ui_instantiate(writeFunction, controller, widget, features)) | |||||
{ | |||||
carla_stderr("Host doesn't support external UI"); | |||||
return nullptr; | |||||
} | |||||
plugin->lv2ui_instantiate(writeFunction, controller, widget, features); | |||||
return (LV2UI_Handle)plugin; | return (LV2UI_Handle)plugin; | ||||
} | } | ||||
@@ -27,6 +27,11 @@ | |||||
#include "CarlaBackendUtils.hpp" | #include "CarlaBackendUtils.hpp" | ||||
#include "CarlaEngineUtils.hpp" | #include "CarlaEngineUtils.hpp" | ||||
#include "ladspa_rdf.hpp" | |||||
#include "lv2_rdf.hpp" | |||||
#include "CarlaLadspaUtils.hpp" | |||||
// #include "CarlaBridgeUtils.hpp" | // #include "CarlaBridgeUtils.hpp" | ||||
// #include "CarlaDssiUtils.hpp" | // #include "CarlaDssiUtils.hpp" | ||||
// #include "CarlaJuceUtils.hpp" | // #include "CarlaJuceUtils.hpp" | ||||
@@ -34,26 +39,21 @@ | |||||
// #include "CarlaLibUtils.hpp" | // #include "CarlaLibUtils.hpp" | ||||
// #include "CarlaLv2Utils.hpp" | // #include "CarlaLv2Utils.hpp" | ||||
// #include "CarlaOscUtils.hpp" | // #include "CarlaOscUtils.hpp" | ||||
// #include "CarlaPipeUtils.hpp" | |||||
// #include "CarlaShmUtils.hpp" | // #include "CarlaShmUtils.hpp" | ||||
// #include "CarlaStateUtils.hpp" | // #include "CarlaStateUtils.hpp" | ||||
// #include "CarlaVstUtils.hpp" | // #include "CarlaVstUtils.hpp" | ||||
// #include "CarlaLibCounter.hpp" | // #include "CarlaLibCounter.hpp" | ||||
// #include "CarlaLogThread.hpp" | // #include "CarlaLogThread.hpp" | ||||
// #include "CarlaMutex.hpp" | |||||
// #include "CarlaRingBuffer.hpp" | // #include "CarlaRingBuffer.hpp" | ||||
// #include "CarlaString.hpp" | |||||
// #include "CarlaThread.hpp" | // #include "CarlaThread.hpp" | ||||
// #include "List.hpp" | |||||
// #include "Lv2AtomQueue.hpp" | // #include "Lv2AtomQueue.hpp" | ||||
// #include "RtList.hpp" | |||||
// #include "JucePluginWindow.hpp" | // #include "JucePluginWindow.hpp" | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
static void test_CarlaUtils() | |||||
static void test_CarlaUtils() noexcept | |||||
{ | { | ||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// misc functions | // misc functions | ||||
@@ -309,7 +309,7 @@ static void test_CarlaUtils() | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
static void test_CarlaMathUtils() | |||||
static void test_CarlaMathUtils() noexcept | |||||
{ | { | ||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// math functions (base) | // math functions (base) | ||||
@@ -460,7 +460,7 @@ static void test_CarlaMathUtils() | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
static void test_CarlaBackendUtils() | |||||
static void test_CarlaBackendUtils() noexcept | |||||
{ | { | ||||
CARLA_BACKEND_USE_NAMESPACE | CARLA_BACKEND_USE_NAMESPACE | ||||
carla_stdout(PluginOption2Str(PLUGIN_OPTION_FIXED_BUFFERS)); | carla_stdout(PluginOption2Str(PLUGIN_OPTION_FIXED_BUFFERS)); | ||||
@@ -482,7 +482,7 @@ static void test_CarlaBackendUtils() | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
static void test_CarlaEngineUtils() | |||||
static void test_CarlaEngineUtils() noexcept | |||||
{ | { | ||||
CARLA_BACKEND_USE_NAMESPACE | CARLA_BACKEND_USE_NAMESPACE | ||||
carla_stdout(EngineType2Str(kEngineTypeNull)); | carla_stdout(EngineType2Str(kEngineTypeNull)); | ||||
@@ -27,10 +27,10 @@ struct MyData { | |||||
CarlaString str; | CarlaString str; | ||||
int id; | int id; | ||||
MyData() | |||||
MyData() noexcept | |||||
: id(-1) {} | : id(-1) {} | ||||
MyData(int i) | |||||
MyData(int i) noexcept | |||||
: str(i), | : str(i), | ||||
id(i) {} | id(i) {} | ||||
}; | }; | ||||
@@ -41,22 +41,22 @@ struct PostRtEvents { | |||||
RtLinkedList<MyData> data; | RtLinkedList<MyData> data; | ||||
RtLinkedList<MyData> dataPendingRT; | RtLinkedList<MyData> dataPendingRT; | ||||
PostRtEvents() | |||||
PostRtEvents() noexcept | |||||
: dataPool(MIN_RT_EVENTS, MAX_RT_EVENTS), | : dataPool(MIN_RT_EVENTS, MAX_RT_EVENTS), | ||||
data(dataPool, true), | data(dataPool, true), | ||||
dataPendingRT(dataPool, true) {} | dataPendingRT(dataPool, true) {} | ||||
~PostRtEvents() | |||||
~PostRtEvents() noexcept | |||||
{ | { | ||||
clear(); | clear(); | ||||
} | } | ||||
void appendRT(const MyData& event) | |||||
void appendRT(const MyData& event) noexcept | |||||
{ | { | ||||
dataPendingRT.append(event); | dataPendingRT.append(event); | ||||
} | } | ||||
void clear() | |||||
void clear() noexcept | |||||
{ | { | ||||
mutex.lock(); | mutex.lock(); | ||||
data.clear(); | data.clear(); | ||||
@@ -64,7 +64,7 @@ struct PostRtEvents { | |||||
mutex.unlock(); | mutex.unlock(); | ||||
} | } | ||||
void trySplice() | |||||
void trySplice() noexcept | |||||
{ | { | ||||
if (mutex.tryLock()) | if (mutex.tryLock()) | ||||
{ | { | ||||