CarlaBridgeUI::~CarlaBridgeUI() /*noexcept*/ { carla_debug("CarlaBridgeUI::~CarlaBridgeUI()"); if (fLib != nullptr) { lib_close(fLib); fLib = nullptr; } if (isPipeRunning() && ! fQuitReceived) { const CarlaMutexLocker cml(getPipeLock()); writeMessage("exiting\n", 8); flushMessages(); } if (fToolkit != nullptr) { fToolkit->quit(); delete fToolkit; fToolkit = nullptr; } closePipeClient(); }
static void loadPluginLib(QFileInfo* fi, const PluginType t) { if (debugMsg) qWarning("looking up %s", fi->filePath().toAscii().constData()); void* handle = lib_open(fi->filePath().toAscii().constData()); if (handle == 0) { fprintf(stderr, "dlopen(%s) failed: %s\n", fi->filePath().toAscii().constData(), dlerror()); return; } if (t == PLUGIN_LADSPA) { LADSPA_Descriptor_Function ladspa = (LADSPA_Descriptor_Function) lib_symbol(handle, "ladspa_descriptor"); if (!ladspa) { const char *txt = dlerror(); if (txt) { fprintf(stderr, "Unable to find ladspa_descriptor() function in plugin " "library file \"%s\": %s.\n" "Are you sure this is a LADSPA plugin file?\n", fi->filePath().toAscii().constData(), txt); } lib_close(handle); return; } const LADSPA_Descriptor* descr; for (int i = 0;; ++i) { descr = ladspa(i); if (descr == NULL) break; // Make sure it doesn't already exist. if (plugins.find(fi->completeBaseName(), QString(descr->Label)) != 0) continue; #ifdef PLUGIN_DEBUGIN fprintf(stderr, "loadPluginLib: ladspa effect name:%s inPlaceBroken:%d\n", descr->Name, LADSPA_IS_INPLACE_BROKEN(descr->Properties)); #endif plugins.add(PLUGIN_LADSPA, fi->absoluteFilePath(), QString(descr->Label), descr); } } else if (t == PLUGIN_VST) { VST_Function vstfn = (VST_Function) lib_symbol(handle, "VSTPluginMain"); if (! vstfn) { vstfn = (VST_Function) lib_symbol(handle, "main"); #ifdef TARGET_API_MAC_CARBON if (! vstfn) vstfn = (VST_Function)lib_symbol(lib_handle, "main_macho"); #endif } if (! vstfn) { const char *txt = dlerror(); if (txt) { fprintf(stderr, "Unable to find vst entry function in plugin " "library file \"%s\": %s.\n" "Are you sure this is a VST plugin file?\n", fi->filePath().toAscii().constData(), txt); } lib_close(handle); return; } AEffect* effect = vstfn(VstHostCallback); if (effect && (effect->flags & effFlagsCanReplacing) > 0) { QString PluginLabel = fi->baseName(); char buf_str[255] = { 0 }; effect->dispatcher(effect, effOpen, 0, 0, 0, 0.0f); effect->dispatcher(effect, effGetProductString, 0, 0, buf_str, 0.0f); if (buf_str[0] != 0) PluginLabel = QString(buf_str); // Make sure it doesn't already exist. if (plugins.find(fi->completeBaseName(), QString(PluginLabel)) == 0) { plugins.add(PLUGIN_VST, fi->absoluteFilePath(), PluginLabel, effect); } effect->dispatcher(effect, effClose, 0, 0, 0, 0.0f); } } lib_close(handle); }
Library::~Library() { lib_close(handle); }