MCPcopy Create free account
hub / github.com/audacity/audacity / Load

Method Load

libraries/lib-vst/VSTWrapper.cpp:307–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307bool VSTWrapper::Load()
308{
309 vstPluginMain pluginMain;
310 bool success = false;
311
312 long effectID = 0;
313 wxString realPath = mPath.BeforeFirst(wxT(';'));
314 mPath.AfterFirst(wxT(';')).ToLong(&effectID);
315 mCurrentEffectID = (intptr_t) effectID;
316
317 mModule = NULL;
318 mAEffect = NULL;
319
320#if defined(__WXMAC__)
321 // Start clean
322 mBundleRef.reset();
323
324 mResource = ResourceHandle{};
325
326 // Convert the path to a CFSTring
327 wxCFStringRef path(realPath);
328
329 // Create the bundle using the URL
330 BundleHandle bundleRef{ CFBundleCreate(kCFAllocatorDefault,
331 // Convert the path to a URL
332 CF_ptr<CFURLRef>{
333 CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
334 path, kCFURLPOSIXPathStyle, true)
335 }.get()
336 )};
337
338 // Bail if the bundle wasn't created
339 if (!bundleRef)
340 return false;
341
342
343 // Convert back to path
344 UInt8 exePath[PLATFORM_MAX_PATH];
345 Boolean good = CFURLGetFileSystemRepresentation(
346 // Retrieve a reference to the executable
347 CF_ptr<CFURLRef>{ CFBundleCopyExecutableURL(bundleRef.get()) }.get(),
348 true, exePath, sizeof(exePath)
349 );
350
351 // Bail if we couldn't resolve the executable path
352 if (good == FALSE)
353 return false;
354
355 // Attempt to open it
356 mModule.reset((char*)dlopen((char *) exePath, RTLD_NOW | RTLD_LOCAL));
357 if (!mModule)
358 return false;
359
360 // Try to locate the NEW plugin entry point
361 pluginMain = (vstPluginMain) dlsym(mModule.get(), "VSTPluginMain");
362
363 // If not found, try finding the old entry point
364 if (pluginMain == NULL)

Callers 3

DiscoverPluginsAtPathMethod · 0.45
LoadComponentFunction · 0.45
resolveShellLinkFunction · 0.45

Calls 8

moveFunction · 0.85
GetStringFunction · 0.85
wxStringClass · 0.50
resetMethod · 0.45
getMethod · 0.45
GetSymbolMethod · 0.45
lengthMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected