From 04b877178d0e6735409a9389eb82999b514d825d Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 17 Jun 2013 12:48:00 +0100 Subject: [PATCH] Remove features not needed in LV2 UI bridges --- source/bridges/CarlaBridgeUI-LV2.cpp | 103 +++++---------------------- source/bridges/Makefile | 3 +- source/utils/CarlaLv2Utils.hpp | 12 ++++ 3 files changed, 31 insertions(+), 87 deletions(-) diff --git a/source/bridges/CarlaBridgeUI-LV2.cpp b/source/bridges/CarlaBridgeUI-LV2.cpp index f1f4f1c55..68b3bc3c6 100644 --- a/source/bridges/CarlaBridgeUI-LV2.cpp +++ b/source/bridges/CarlaBridgeUI-LV2.cpp @@ -88,33 +88,24 @@ const uint32_t CARLA_URI_MAP_ID_PARAM_SAMPLE_RATE = 38; const uint32_t CARLA_URI_MAP_ID_COUNT = 39; // LV2 Feature Ids -const uint32_t kFeatureIdBufSizeBounded = 0; -const uint32_t kFeatureIdBufSizeFixed = 1; -const uint32_t kFeatureIdBufSizePowerOf2 = 2; -const uint32_t kFeatureIdEvent = 3; -const uint32_t kFeatureIdHardRtCapable = 4; -const uint32_t kFeatureIdInPlaceBroken = 5; -const uint32_t kFeatureIdIsLive = 6; -const uint32_t kFeatureIdLogs = 7; -const uint32_t kFeatureIdOptions = 8; -const uint32_t kFeatureIdPrograms = 9; -const uint32_t kFeatureIdRtMemPool = 10; -const uint32_t kFeatureIdStateMakePath = 11; -const uint32_t kFeatureIdStateMapPath = 12; -const uint32_t kFeatureIdStrictBounds = 13; -const uint32_t kFeatureIdUriMap = 14; -const uint32_t kFeatureIdUridMap = 15; -const uint32_t kFeatureIdUridUnmap = 16; -const uint32_t kFeatureIdUiIdle = 17; -const uint32_t kFeatureIdUiFixedSize = 18; -const uint32_t kFeatureIdUiMakeResident = 19; -const uint32_t kFeatureIdUiNoUserResize = 20; -const uint32_t kFeatureIdUiParent = 21; -const uint32_t kFeatureIdUiPortMap = 22; -const uint32_t kFeatureIdUiPortSubscribe = 23; -const uint32_t kFeatureIdUiResize = 24; -const uint32_t kFeatureIdUiTouch = 25; -const uint32_t kFeatureCount = 26; +const uint32_t kFeatureIdLogs = 0; +const uint32_t kFeatureIdOptions = 1; +const uint32_t kFeatureIdPrograms = 2; +const uint32_t kFeatureIdStateMakePath = 3; +const uint32_t kFeatureIdStateMapPath = 4; +const uint32_t kFeatureIdUriMap = 5; +const uint32_t kFeatureIdUridMap = 6; +const uint32_t kFeatureIdUridUnmap = 7; +const uint32_t kFeatureIdUiIdle = 8; +const uint32_t kFeatureIdUiFixedSize = 9; +const uint32_t kFeatureIdUiMakeResident = 10; +const uint32_t kFeatureIdUiNoUserResize = 11; +const uint32_t kFeatureIdUiParent = 12; +const uint32_t kFeatureIdUiPortMap = 13; +const uint32_t kFeatureIdUiPortSubscribe = 14; +const uint32_t kFeatureIdUiResize = 15; +const uint32_t kFeatureIdUiTouch = 16; +const uint32_t kFeatureCount = 17; // ------------------------------------------------------------------------- @@ -219,11 +210,6 @@ public: // --------------------------------------------------------------- // initialize features (part 1) - LV2_Event_Feature* const eventFt = new LV2_Event_Feature; - eventFt->callback_data = this; - eventFt->lv2_event_ref = carla_lv2_event_ref; - eventFt->lv2_event_unref = carla_lv2_event_unref; - LV2_Log_Log* const logFt = new LV2_Log_Log; logFt->handle = this; logFt->printf = carla_lv2_log_printf; @@ -242,9 +228,6 @@ public: programsFt->handle = this; programsFt->program_changed = carla_lv2_program_changed; - LV2_RtMemPool_Pool* const rtMemPoolFt = new LV2_RtMemPool_Pool; - lv2_rtmempool_init(rtMemPoolFt); - LV2_URI_Map_Feature* const uriMapFt = new LV2_URI_Map_Feature; uriMapFt->callback_data = this; uriMapFt->uri_to_id = carla_lv2_uri_to_id; @@ -271,27 +254,6 @@ public: for (uint32_t i=0; i < kFeatureCount; ++i) fFeatures[i] = new LV2_Feature; - fFeatures[kFeatureIdBufSizeBounded]->URI = LV2_BUF_SIZE__boundedBlockLength; - fFeatures[kFeatureIdBufSizeBounded]->data = nullptr; - - fFeatures[kFeatureIdBufSizeFixed]->URI = LV2_BUF_SIZE__fixedBlockLength; - fFeatures[kFeatureIdBufSizeFixed]->data = nullptr; - - fFeatures[kFeatureIdBufSizePowerOf2]->URI = LV2_BUF_SIZE__powerOf2BlockLength; - fFeatures[kFeatureIdBufSizePowerOf2]->data = nullptr; - - fFeatures[kFeatureIdEvent]->URI = LV2_EVENT_URI; - fFeatures[kFeatureIdEvent]->data = eventFt; - - fFeatures[kFeatureIdHardRtCapable]->URI = LV2_CORE__hardRTCapable; - fFeatures[kFeatureIdHardRtCapable]->data = nullptr; - - fFeatures[kFeatureIdInPlaceBroken]->URI = LV2_CORE__inPlaceBroken; - fFeatures[kFeatureIdInPlaceBroken]->data = nullptr; - - fFeatures[kFeatureIdIsLive]->URI = LV2_CORE__isLive; - fFeatures[kFeatureIdIsLive]->data = nullptr; - fFeatures[kFeatureIdLogs]->URI = LV2_LOG__log; fFeatures[kFeatureIdLogs]->data = logFt; @@ -301,18 +263,12 @@ public: fFeatures[kFeatureIdPrograms]->URI = LV2_PROGRAMS__Host; fFeatures[kFeatureIdPrograms]->data = programsFt; - fFeatures[kFeatureIdRtMemPool]->URI = LV2_RTSAFE_MEMORY_POOL__Pool; - fFeatures[kFeatureIdRtMemPool]->data = rtMemPoolFt; - fFeatures[kFeatureIdStateMakePath]->URI = LV2_STATE__makePath; fFeatures[kFeatureIdStateMakePath]->data = stateMakePathFt; fFeatures[kFeatureIdStateMapPath]->URI = LV2_STATE__mapPath; fFeatures[kFeatureIdStateMapPath]->data = stateMapPathFt; - fFeatures[kFeatureIdStrictBounds]->URI = LV2_PORT_PROPS__supportsStrictBounds; - fFeatures[kFeatureIdStrictBounds]->data = nullptr; - fFeatures[kFeatureIdUriMap]->URI = LV2_URI_MAP_URI; fFeatures[kFeatureIdUriMap]->data = uriMapFt; @@ -355,12 +311,10 @@ public: if (fRdfDescriptor != nullptr) delete fRdfDescriptor; - delete (LV2_Event_Feature*)fFeatures[kFeatureIdEvent]->data; delete (LV2_Log_Log*)fFeatures[kFeatureIdLogs]->data; delete (LV2_State_Make_Path*)fFeatures[kFeatureIdStateMakePath]->data; delete (LV2_State_Map_Path*)fFeatures[kFeatureIdStateMapPath]->data; delete (LV2_Programs_Host*)fFeatures[kFeatureIdPrograms]->data; - delete (LV2_RtMemPool_Pool*)fFeatures[kFeatureIdRtMemPool]->data; delete (LV2_URI_Map_Feature*)fFeatures[kFeatureIdUriMap]->data; delete (LV2_URID_Map*)fFeatures[kFeatureIdUridMap]->data; delete (LV2_URID_Unmap*)fFeatures[kFeatureIdUridUnmap]->data; @@ -755,27 +709,6 @@ private: programs(nullptr) {} } fExt; - // ------------------------------------------------------------------- - // Event Feature - - static uint32_t carla_lv2_event_ref(LV2_Event_Callback_Data callback_data, LV2_Event* event) - { - carla_debug("CarlaLv2Client::carla_lv2_event_ref(%p, %p)", callback_data, event); - CARLA_ASSERT(callback_data != nullptr); - CARLA_ASSERT(event != nullptr); - - return 0; - } - - static uint32_t carla_lv2_event_unref(LV2_Event_Callback_Data callback_data, LV2_Event* event) - { - carla_debug("CarlaLv2Client::carla_lv2_event_unref(%p, %p)", callback_data, event); - CARLA_ASSERT(callback_data != nullptr); - CARLA_ASSERT(event != nullptr); - - return 0; - } - // ------------------------------------------------------------------- // Logs Feature diff --git a/source/bridges/Makefile b/source/bridges/Makefile index 39b98adc4..24d2f2728 100644 --- a/source/bridges/Makefile +++ b/source/bridges/Makefile @@ -228,8 +228,7 @@ CarlaBridgeToolkitQt.moc: CarlaBridgeToolkitQt.cpp $(MOC) $< -DMOC_PARSING -o $@ OBJS_UI_LV2_LIBS = \ - ../libs/lilv.a \ - ../libs/rtmempool.a + ../libs/lilv.a # -------------------------------------------------------------- # ui_lv2-gtk2 diff --git a/source/utils/CarlaLv2Utils.hpp b/source/utils/CarlaLv2Utils.hpp index 15d0fe76a..ce648c5ac 100644 --- a/source/utils/CarlaLv2Utils.hpp +++ b/source/utils/CarlaLv2Utils.hpp @@ -1280,6 +1280,7 @@ bool is_lv2_feature_supported(const LV2_URI uri) if (uri == nullptr) return false; +#ifndef BRIDGE_LV2 if (std::strcmp(uri, LV2_CORE__hardRTCapable) == 0) return true; if (std::strcmp(uri, LV2_CORE__inPlaceBroken) == 0) @@ -1294,28 +1295,35 @@ bool is_lv2_feature_supported(const LV2_URI uri) return true; if (std::strcmp(uri, LV2_EVENT_URI) == 0) return true; +#endif if (std::strcmp(uri, LV2_LOG__log) == 0) return true; if (std::strcmp(uri, LV2_OPTIONS__options) == 0) return true; if (std::strcmp(uri, LV2_PROGRAMS__Host) == 0) return true; +#ifndef BRIDGE_LV2 if (std::strcmp(uri, LV2_RTSAFE_MEMORY_POOL__Pool) == 0) return true; +#endif if (std::strcmp(uri, LV2_STATE__makePath) == 0) return true; if (std::strcmp(uri, LV2_STATE__mapPath) == 0) return true; +#ifndef BRIDGE_LV2 if (std::strcmp(uri, LV2_PORT_PROPS__supportsStrictBounds) == 0) return true; +#endif if (std::strcmp(uri, LV2_URI_MAP_URI) == 0) return true; if (std::strcmp(uri, LV2_URID__map) == 0) return true; if (std::strcmp(uri, LV2_URID__unmap) == 0) return true; +#ifndef BRIDGE_LV2 if (std::strcmp(uri, LV2_WORKER__schedule) == 0) return false; // TODO +#endif return false; } @@ -1331,10 +1339,12 @@ bool is_lv2_ui_feature_supported(const LV2_URI uri) return false; if (is_lv2_feature_supported(uri)) return true; +#ifndef BRIDGE_LV2 if (std::strcmp(uri, LV2_DATA_ACCESS_URI) == 0) return true; if (std::strcmp(uri, LV2_INSTANCE_ACCESS_URI) == 0) return true; +#endif if (std::strcmp(uri, LV2_UI__fixedSize) == 0) return true; if (std::strcmp(uri, LV2_UI__idle) == 0) @@ -1353,10 +1363,12 @@ bool is_lv2_ui_feature_supported(const LV2_URI uri) return true; if (std::strcmp(uri, LV2_UI__touch) == 0) return true; +#ifndef BRIDGE_LV2 if (std::strcmp(uri, LV2_EXTERNAL_UI__Widget) == 0) return true; if (std::strcmp(uri, LV2_EXTERNAL_UI_DEPRECATED_URI) == 0) return true; +#endif return false; }