diff --git a/libs/ardour/ardour/vst_types.h b/libs/ardour/ardour/vst_types.h index d97e1df8c3..22ad936431 100644 --- a/libs/ardour/ardour/vst_types.h +++ b/libs/ardour/ardour/vst_types.h @@ -25,6 +25,10 @@ #include "ardour/libardour_visibility.h" #include "ardour/vestige/vestige.h" +#ifdef MACVST_SUPPORT +#include +#endif + struct LIBARDOUR_API _VSTKey { /** virtual-key code, or 0 if this _VSTFXKey is a `character' key */ @@ -62,16 +66,17 @@ typedef AEffect * (* main_entry_t) (audioMasterCallback); struct LIBARDOUR_API _VSTHandle { - void* dll; +#ifdef MACVST_SUPPORT + CFBundleRef bundleRef; + CFBundleRefNum res_file_id; +#else + void* dll; +#endif + char* name; char* path; - main_entry_t main_entry; - int plugincnt; -#ifdef MACVST_SUPPORT - int32_t res_file_id; -#endif }; typedef struct _VSTHandle VSTHandle; diff --git a/libs/ardour/mac_vst_support.cc b/libs/ardour/mac_vst_support.cc index 45d23248e0..344e4adc3d 100644 --- a/libs/ardour/mac_vst_support.cc +++ b/libs/ardour/mac_vst_support.cc @@ -97,33 +97,33 @@ mac_vst_load (const char *path) fhandle = mac_vst_handle_new (); fhandle->dll = NULL; + fhandle->bundleRef = 0; CFURLRef url; if (!(url = CFURLCreateFromFileSystemRepresentation (0, (const UInt8*)path, (CFIndex) strlen (path), true))) { return 0; } - CFBundleRef bundleRef = CFBundleCreate (kCFAllocatorDefault, url); + fhandle->bundleRef = CFBundleCreate (kCFAllocatorDefault, url); CFRelease (url); - if (bundleRef == 0) { + if (fhandle->bundleRef == 0) { return 0; } - if (!CFBundleLoadExecutable (bundleRef)) { - CFRelease (bundleRef); + if (!CFBundleLoadExecutable (fhandle->bundleRef)) { + CFRelease (fhandle->bundleRef); return 0; } fhandle->name = strdup (path); - fhandle->dll = (void*) &bundleRef; fhandle->main_entry = (main_entry_t) - CFBundleGetFunctionPointerForName (bundleRef, CFSTR("main_macho")); + CFBundleGetFunctionPointerForName (fhandle->bundleRef, CFSTR("main_macho")); if (!fhandle->main_entry) { fhandle->main_entry = (main_entry_t) - CFBundleGetFunctionPointerForName (bundleRef, CFSTR("VSTPluginMain")); + CFBundleGetFunctionPointerForName (fhandle->bundleRef, CFSTR("VSTPluginMain")); } if (fhandle->main_entry == 0) { @@ -131,7 +131,7 @@ mac_vst_load (const char *path) return 0; } - fhandle->res_file_id = CFBundleOpenBundleResourceMap (bundleRef); + fhandle->res_file_id = CFBundleOpenBundleResourceMap (fhandle->bundleRef); /*return the handle of the plugin*/ return fhandle; @@ -150,7 +150,7 @@ mac_vst_unload (VSTHandle* fhandle) /*Valid plugin loaded?*/ - if (fhandle->dll) + if (fhandle->bundleRef) { CFBundleRef* bundleRefPtr = (CFBundleRef*) fhandle->dll; CFBundleCloseBundleResourceMap (*bundleRefPtr, (CFBundleRefNum)fhandle->res_file_id);