Attempt to fix LV2 Vstgui on macOS
This commit is contained in:
parent
166be3c843
commit
7417cd23ab
3 changed files with 48 additions and 0 deletions
|
|
@ -374,6 +374,9 @@ lv2ui_descriptor(uint32_t index)
|
|||
#if LINUX
|
||||
VSTGUI::initializeSoHandle();
|
||||
#endif
|
||||
#if MAC
|
||||
VSTGUI::initializeBundleRef();
|
||||
#endif
|
||||
|
||||
switch (index)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
#if WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if MAC
|
||||
#include "vstgui/plugin-bindings/getpluginbundle.h"
|
||||
#endif
|
||||
|
||||
#if LINUX
|
||||
void Lv2IdleRunLoop::execIdle()
|
||||
|
|
@ -184,3 +187,38 @@ BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID)
|
|||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
///
|
||||
#if MAC
|
||||
namespace VSTGUI
|
||||
{
|
||||
void* gBundleRef = nullptr;
|
||||
|
||||
static volatile bool gBundleRefInitialized = false;
|
||||
static std::mutex gBundleRefMutex;
|
||||
|
||||
struct CFBundle_deleter {
|
||||
void operator()(CFBundleRef x) const noexcept
|
||||
{
|
||||
CFRelease(x);
|
||||
}
|
||||
};
|
||||
static std::unique_ptr<__CFBundle, CFBundle_deleter> gBundleRefPointer;
|
||||
} // namespace VSTGUI
|
||||
|
||||
void VSTGUI::initializeBundleRef()
|
||||
{
|
||||
if (VSTGUI::gBundleRefInitialized)
|
||||
return;
|
||||
|
||||
std::lock_guard<std::mutex> lock(VSTGUI::gBundleRefMutex);
|
||||
if (VSTGUI::gBundleRefInitialized)
|
||||
return;
|
||||
|
||||
CFBundleRef bundleRef = GetPluginBundle();
|
||||
VSTGUI::gBundleRef = bundleRef;
|
||||
VSTGUI::gBundleRefPointer.reset(bundleRef);
|
||||
|
||||
VSTGUI::gBundleRefInitialized = true;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -66,3 +66,10 @@ namespace VSTGUI
|
|||
void initializeSoHandle();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if MAC
|
||||
namespace VSTGUI
|
||||
{
|
||||
void initializeBundleRef();
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue