From 9ea9083a194fad2ecf84337d4d4c5a0e111a381e Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 29 Mar 2013 09:51:04 +0000 Subject: [PATCH] Misc changes --- source/carla_shared.py | 2 +- source/discovery/carla-discovery.cpp | 54 +++++++++++++--------------- source/utils/CarlaLv2Utils.hpp | 8 +++++ source/utils/CarlaUtils.hpp | 9 ----- 4 files changed, 33 insertions(+), 40 deletions(-) diff --git a/source/carla_shared.py b/source/carla_shared.py index dd0964f90..6c38be5b6 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -1001,7 +1001,7 @@ def runCarlaDiscovery(itype, stype, filename, tool, isWine=False): if prop == "name": pinfo['name'] = value if value else fakeLabel - elif prop == "label": + elif prop in ("label", "uri"): pinfo['label'] = value if value else fakeLabel elif prop == "maker": pinfo['maker'] = value diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index f4a847ece..af1e86937 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -111,7 +111,7 @@ intptr_t vstHostCanDo(const char* const feature) if (std::strcmp(feature, "acceptIOChanges") == 0) return 1; if (std::strcmp(feature, "sizeWindow") == 0) - return 1; + return -1; if (std::strcmp(feature, "offline") == 0) return -1; if (std::strcmp(feature, "openFileSelector") == 0) @@ -251,7 +251,7 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode break; default: - carla_debug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt); + carla_stdout("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt); break; } @@ -857,9 +857,9 @@ void do_lv2_check(const char* const bundle, const bool init) for (int i=0; i < URIs.count(); i++) { const LV2_RDF_Descriptor* const rdfDescriptor = lv2_rdf_new(URIs.at(i).toUtf8().constData()); - CARLA_ASSERT(rdfDescriptor && rdfDescriptor->URI); + CARLA_ASSERT(rdfDescriptor != nullptr && rdfDescriptor->URI != nullptr); - if (! (rdfDescriptor && rdfDescriptor->URI)) + if (rdfDescriptor == nullptr || rdfDescriptor->URI == nullptr) { DISCOVERY_OUT("error", "Failed to find LV2 plugin '" << URIs.at(i).toUtf8().constData() << "'"); continue; @@ -868,25 +868,27 @@ void do_lv2_check(const char* const bundle, const bool init) if (init) { // test if DLL is loadable, twice - bool isLoadable = true; + void* const libHandle1 = lib_open(rdfDescriptor->Binary); - for (int j=0; j < 2; j++) + if (libHandle1 == nullptr) { - void* const libHandle = lib_open(rdfDescriptor->Binary); + print_lib_error(rdfDescriptor->Binary); + delete rdfDescriptor; + continue; + } - if (! libHandle) - { - isLoadable = false; - print_lib_error(rdfDescriptor->Binary); - delete rdfDescriptor; - break; - } + lib_close(libHandle1); - lib_close(libHandle); - } + void* const libHandle2 = lib_open(rdfDescriptor->Binary); - if (! isLoadable) + if (libHandle2 == nullptr) + { + print_lib_error(rdfDescriptor->Binary); + delete rdfDescriptor; continue; + } + + lib_close(libHandle2); } // test if we support all required ports and features @@ -1011,12 +1013,12 @@ void do_lv2_check(const char* const bundle, const bool init) hints |= PLUGIN_HAS_GUI; DISCOVERY_OUT("init", "-----------"); - DISCOVERY_OUT("label", rdfDescriptor->URI); - if (rdfDescriptor->Name) + DISCOVERY_OUT("uri", rdfDescriptor->URI); + if (rdfDescriptor->Name != nullptr) DISCOVERY_OUT("name", rdfDescriptor->Name); - if (rdfDescriptor->Author) + if (rdfDescriptor->Author != nullptr) DISCOVERY_OUT("maker", rdfDescriptor->Author); - if (rdfDescriptor->License) + if (rdfDescriptor->License != nullptr) DISCOVERY_OUT("copyright", rdfDescriptor->License); DISCOVERY_OUT("unique_id", rdfDescriptor->UniqueID); DISCOVERY_OUT("hints", hints); @@ -1154,12 +1156,6 @@ void do_vst_check(void* const libHandle, const bool init) effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, kSampleRate); effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); - effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f); - effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f); - - if (gVstNeedsIdle) - effect->dispatcher(effect, effIdle, 0, 0, nullptr, 0.0f); - effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f); effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f); @@ -1192,16 +1188,14 @@ void do_vst_check(void* const libHandle, const bool init) intptr_t reserved; VstEvent* data[2]; -#ifndef QTCREATOR_TEST VstEventsFixed() : numEvents(0), reserved(0), data{0} {} -#endif } events; VstMidiEvent midiEvents[2]; - carla_zeroMem(midiEvents, sizeof(VstMidiEvent)*2); + carla_zeroStruct(midiEvents, 2); midiEvents[0].type = kVstMidiType; midiEvents[0].byteSize = sizeof(VstMidiEvent); diff --git a/source/utils/CarlaLv2Utils.hpp b/source/utils/CarlaLv2Utils.hpp index dd95a8620..aa3434795 100644 --- a/source/utils/CarlaLv2Utils.hpp +++ b/source/utils/CarlaLv2Utils.hpp @@ -1170,6 +1170,10 @@ bool is_lv2_port_supported(const LV2_Property types) static inline bool is_lv2_feature_supported(const LV2_URI uri) { + CARLA_ASSERT(uri != nullptr); + + if (uri == nullptr) + return false; if (std::strcmp(uri, LV2_CORE__hardRTCapable) == 0) return true; if (std::strcmp(uri, LV2_CORE__inPlaceBroken) == 0) @@ -1215,6 +1219,10 @@ bool is_lv2_feature_supported(const LV2_URI uri) static inline bool is_lv2_ui_feature_supported(const LV2_URI uri) { + CARLA_ASSERT(uri != nullptr); + + if (uri == nullptr) + return false; if (is_lv2_feature_supported(uri)) return true; if (std::strcmp(uri, LV2_DATA_ACCESS_URI) == 0) diff --git a/source/utils/CarlaUtils.hpp b/source/utils/CarlaUtils.hpp index 342c54f8c..25bbd77cd 100644 --- a/source/utils/CarlaUtils.hpp +++ b/source/utils/CarlaUtils.hpp @@ -354,15 +354,6 @@ void carla_zeroStruct(T& structure) std::memset(&structure, 0, sizeof(T)); } -template -static inline -void carla_zeroStruct(T& structure, const size_t count) -{ - CARLA_ASSERT(count > 1); - - std::memset(&structure, 0, sizeof(T)*count); -} - template static inline void carla_zeroStruct(T* const structure, const size_t count)