2

我在正在编写的 VST 主机插件中加载 VST 插件时遇到问题。我已经成功加载了我发现的大多数插件,但似乎有一个给我带来了奇怪的问题。我可以在 adobe 试听和使用 JUCE 框架的主机中加载它。

调用 dlopen 时出现此错误,我似乎在互联网上找不到类似的东西:

dlopen(/Library/Audio/Plug-Ins/VST/Plugin Alliance/SPL De-Verb.vst/Contents/MacOS/SPL De-Verb, 9):找不到合适的图像。确实找到了:Library/Audio/Plug-Ins/VST/Plugin Alliance/SPL De-Verb.vst/Contents/MacOS/SPL De-Verb: malformed mach-o image: __TEXT segment maps start of file but is writable

在其上运行文件显示它是具有两种架构的通用二进制文件:

$ 文件 ./SPL\ 去动词

SPL De-Verb: Mach-O universal binary with 2 architectures: [i386: Mach-O bundle i386] [x86_64]
SPL De-Verb (for architecture i386):    Mach-O bundle i386
SPL De-Verb (for architecture x86_64):  Mach-O 64-bit bundle x86_64

这是插件的网站: https ://www.plugin-alliance.com/en/products/spl_de-verb.html

这是我用来加载它的代码:

AEffect* newEffect = NULL;

// Create a path to the bundle
CFStringRef pluginPathStringRef = CFStringCreateWithCString(NULL,
        pluginPath.c_str(), kCFStringEncodingUTF8);
CFURLRef bundleUrl = CFURLCreateWithFileSystemPath
        (kCFAllocatorDefault, pluginPathStringRef,
        kCFURLPOSIXPathStyle, true);

if (bundleUrl == NULL)
{
    blog(LOG_WARNING, "Couldn't make URL reference for VST plug-in");
    return NULL;
}

// Open the bundle
bundle = CFBundleCreate(kCFAllocatorDefault, bundleUrl);
if (bundle == NULL)
{
    blog(LOG_WARNING, "Couldn't create VST bundle reference.");
    CFRelease(pluginPathStringRef);
    CFRelease(bundleUrl);
    return NULL;
}

vstPluginMain mainEntryPoint = NULL;
mainEntryPoint = (vstPluginMain) CFBundleGetFunctionPointerForName
        (bundle, CFSTR("VSTPluginMain"));

// VST plugins previous to the 2.4 SDK used main_macho for the
// entry point name.
if (mainEntryPoint == NULL)
{
    mainEntryPoint = (vstPluginMain)
            CFBundleGetFunctionPointerForName(bundle,
            CFSTR("main_macho"));
}

if (mainEntryPoint == NULL)
{
    blog(LOG_WARNING, "Couldn't get a pointer to plug-in's main()");
    CFBundleUnloadExecutable(bundle);
    CFRelease(bundle);
    return NULL;
}

newEffect = mainEntryPoint(hostCallback_static);
if (newEffect == NULL)
{
    blog(LOG_WARNING, "VST Plug-in's main() returns null.");
    CFBundleUnloadExecutable(bundle);
    CFRelease(bundle);
    return NULL;
}
4

0 回答 0