For a test, with the current JUCE 6.x, I did a VST2 plugin that calls VstHostCallback().
In fact I use a variable “hostcb” of type std::function (VstHostCallbackType) && which is set in the function handleVstHostCallbackAvailable (std::function (VstHostCallbackType) && callback) that I override from JUCE. (I needed to write “(” instead of “<” here to avoid bad formatting…)
std::function(VstHostCallbackType) denotes a function of five parameters defined in “juce_VSTCllbachHandler.h” and in the documentation:
typedef pointer_sized_int (VstHostCallbackType) (int32 opcode, int32 index, pointer_sized_int value, void* ptr, float opt);
Appropriately, I call it with these five parameters (the meaning of those don’t matter here) such as:
result = hostcb(0xdeadbeef, 0xdeadf00d, 0, (void* ) funcname, 0.0);
and it works just fine when running the VST in a host.
Now I found two older source code snippets for JUCE 5.x or earlier and here that function is called with six parameters:
var cbvar = getProperties()[“audioMasterCallback”];
hostcb = (VstHostCallback)(int64)cbvar;
result = hostcb(NULL, 0xdeadbeef, 0xdeadf00d, 0, (void*)funcname, 0.0);
and in another location:
var aevar = getProperties()[“aeffect”];
ae = (VstEffectInterface*)(int64)aevar;
result = hostcb(ae, 0xDEADBEEF, 0xDEADF00E, 2, 0, 0.0);
Now I seem to suppose that “ae” (i.e. “aeffect”) might be a pointer to the instance of “this” effect plugin, hence the “this”-pointer of the instance of the JUCE “AudioProcessor” class.
Hence the first parameter in the (“flat”) six parameter version might be the “this” pointer that is automatically added by the compiler in for the class function, anyway, and the VST-host will see the same in both variants.
Is this assumption right and my code will work as expected ?
Did JUCE at some point in time update to have VstHostCallback() be a class function instead of flat ?
Thanks for any pointers,