Open cuikp opened 2 weeks ago
Never mind, figured out the proper way to navigate the different PluginFactory types without encountering crashing errors. Something like this:
auto f3 = Steinberg::FUnknownPtr<Steinberg::IPluginFactory3>(pluginFactory);
auto f2 = Steinberg::FUnknownPtr<Steinberg::IPluginFactory2>(pluginFactory);
PClassInfo ci;
PClassInfo2 ci2;
PClassInfoW ci3;
if (f3 && f3->getClassInfoUnicode(index, &ci3) == Steinberg::kResultTrue) {
std::cerr << "PluginFactory3" << std::endl;
//deal with PClassInfoW
}
else if (f2 && f2->getClassInfo2(index, &ci2) == Steinberg::kResultTrue) {
std::cerr << "PluginFactory2" << std::endl;
//deal with PClassInfo2
}
else if (pluginFactory->getClassInfo(index, &ci) == Steinberg::kResultTrue) {
std::cerr << "PluginFactory base" << std::endl;
//deal with PClassInfo;
}
Hi, in the meantime I've been attempting a P/Invoke approach for hosting, but when accessing an NPlug vst3 (specifically NPlug.SimpleDelay.vst3) I get an error (C++ crash) when attempting to obtain PClassInfo2. All other vst3s I've tried report their PClassInfo2 properties without crashing. Any idea why NPlug might result in crashing when trying to access this info?
Briefly, here's the series of methods I call:
In C#:
where the mirrored C# struct layout for PClassInfo2 is:
the C# Native method called is:
And at the C++ end :
The thrown exception is:
Exception thrown: read access violation. Steinberg::IPluginFactory2::getClassInfo2[virtual] was 0xFFFFFFFFFFFFFFFF.
As commented above, if I iuse:
EXPORTED_FUNCTION int GetClassInfo2(IPluginFactory* pluginFactory, int index, PClassInfo& classInfo) {
instead, then NPlug properly returns a PClassInfo object and properties without problem, but unfortunately PClassInfo provides less information compared to PClassInfo2.... (Most notably, subCategories is only in PClassInfo2).
Any idea what the problem is?