diff --git a/libs/ardour/ardour/vst_types.h b/libs/ardour/ardour/vst_types.h index 22ad936431..d97e1df8c3 100644 --- a/libs/ardour/ardour/vst_types.h +++ b/libs/ardour/ardour/vst_types.h @@ -25,10 +25,6 @@ #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 */ @@ -66,17 +62,16 @@ typedef AEffect * (* main_entry_t) (audioMasterCallback); struct LIBARDOUR_API _VSTHandle { -#ifdef MACVST_SUPPORT - CFBundleRef bundleRef; - CFBundleRefNum res_file_id; -#else - void* dll; -#endif - + void* dll; 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 9c18e625af..e9a7f48951 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; } - fhandle->bundleRef = CFBundleCreate (kCFAllocatorDefault, url); + CFBundleRef bundleRef = CFBundleCreate (kCFAllocatorDefault, url); CFRelease (url); - if (fhandle->bundleRef == 0) { + if (bundleRef == 0) { return 0; } - if (!CFBundleLoadExecutable (fhandle->bundleRef)) { - CFRelease (fhandle->bundleRef); + if (!CFBundleLoadExecutable (bundleRef)) { + CFRelease (bundleRef); return 0; } fhandle->name = strdup (path); + fhandle->dll = (void*) &bundleRef; fhandle->main_entry = (main_entry_t) - CFBundleGetFunctionPointerForName (fhandle->bundleRef, CFSTR("main_macho")); + CFBundleGetFunctionPointerForName (bundleRef, CFSTR("main_macho")); if (!fhandle->main_entry) { fhandle->main_entry = (main_entry_t) - CFBundleGetFunctionPointerForName (fhandle->bundleRef, CFSTR("VSTPluginMain")); + CFBundleGetFunctionPointerForName (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 (fhandle->bundleRef); + fhandle->res_file_id = CFBundleOpenBundleResourceMap (bundleRef); /*return the handle of the plugin*/ return fhandle; @@ -152,7 +152,7 @@ mac_vst_unload (VSTHandle* fhandle) /*Valid plugin loaded?*/ - if (fhandle->bundleRef) + if (fhandle->dll) { CFBundleRef* bundleRefPtr = (CFBundleRef*) fhandle->dll; CFBundleCloseBundleResourceMap (*bundleRefPtr, (CFBundleRefNum)fhandle->res_file_id);