Hi, I am updating an old plugin that still uses vst2.4 sdk…to the latest VSTGUI.
I’m debugging on MacOS for now…
I noticed the new VSTGUI::init(PlatformInstanceHandle) and VSTGUI::exit() requirements. And am calling them, but…
Can you tell me where I can obtain the correct PlatformInstanceHandle/CFBundle object to pass to the VSTGUI::init() ? CFBundleGetMainBundle() isn’t right, it’s my host (ableton).
I’m having problems finding bitmaps with CBitmap, of course, trying to use the old void* window ptr passed into VSTGUI::init() doesn’t work :-)… haha. it’s totally not a CFBundle of course. But absolute paths work great with CBitmap. “bmp00128.png” fails, and so does (int)128. Inside CGBitmap::load(), The CFBundleCopyResourceURL returns a null url, nothing found.
Also, if I try to use CFBundleGetMainBundle(), it gives me Ableton’s bundle (not my dynlib’s vst), that’s not right either. So that’s why the resource isn’t found. It’s looking in Ableton’s app bundle. Duh. And that’s why absolute path works fine.
Looks like vst24 sdk’s AEffEditor has void* systemWindow which is a WindowRef on MacOS… I’ve been googling to see how to lookup a CFBundle from that… no luck. Looks like the systemWindow comes from AudioEffect::dispatchEffectClass’s “void* ptr” arg…
I see the vst3 sdk usage which hides the VSTGUI::init call in some code called for those devs which uses getPlatformModuleHandle (); but seems proprietary to vst3 sdk… I further traced to macmain.cpp and saw the bundleEntry() and bundleExit(), which of course, I dont have in vst2.4 sdk.
this is my vst2.4 entrypoint… which doesn’t give anything:
extern AudioEffect* createEffectInstance (audioMasterCallback audioMaster);
extern "C" {
#if defined (__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#define VST_EXPORT __attribute__ ((visibility ("default")))
#else
#define VST_EXPORT
#endif
//------------------------------------------------------------------------
/** Prototype of the export function main */
//------------------------------------------------------------------------
VST_EXPORT AEffect* VSTPluginMain (audioMasterCallback audioMaster)
{
// Get VST Version of the Host
if (!audioMaster (0, audioMasterVersion, 0, 0, 0, 0))
return 0; // old version
// Create the AudioEffect
AudioEffect* effect = createEffectInstance (audioMaster);
if (!effect)
return 0;
// Return the VST AEffect structur
return effect->getAeffect ();
}
// support for old hosts not looking for VSTPluginMain
#if (TARGET_API_MAC_CARBON && __ppc__)
VST_EXPORT AEffect* main_macho (audioMasterCallback audioMaster) { return VSTPluginMain (audioMaster); }
#elif __GNUC__&&(WIN32||BEOS)
VST_EXPORT AEffect* main_plugin (audioMasterCallback audioMaster) { return VSTPluginMain (audioMaster); }
#elif WIN32
VST_EXPORT AEffect* MAIN (audioMasterCallback audioMaster) { return VSTPluginMain (audioMaster); }
#endif
} // extern "C"
//------------------------------------------------------------------------
#if WIN32
#include <windows.h>
void* hInstance;
extern "C" {
//static AudioEffect *effect = 0; // DEVCPP
BOOL WINAPI DllMain (HINSTANCE hInst, DWORD dwReason, LPVOID lpvReserved)
{
//effect = new VSTname (audioMaster);
hInstance = hInst;
return 1;
}
} // extern "C"
#endif