Callback events (which ones need to contact the plugin ? )

DSP, Plug-in and Host development discussion.
johne53
KVRer
17 posts since 27 Jul, 2012 from Manchester, UK

Post Sat Jul 07, 2018 11:19 pm

I work on some products which use a technology called VeSTige (a hosting library for VST plugins). I think it's quite a simple implementation - e.g. AFAIK it doesn't support VSTi - but the big advantage is that it seems to be cross-platform. It implements the usual callback mechanism so that plugins can notify various events to their host. As an example, one of these is audioMasterIdle which gets implemented like this (C/C++):-

Code: Select all

    case audioMasterIdle:
        SHOW_CALLBACK ("audioMasterIdle");
        if (effect) {
            effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
        }
        return 0
;

Notice that this simply calls a 'dispatcher' function, sending a message to the VST plugin itself. I'm assuming there must be other events which do the same thing (e.g. to query the plugin's name / or the number of inputs & outputs or whatever...)

AFAICT though, the vast majority of events don't need to contact the plugin. So is there a list anywhere which shows which events DO need to send something to the plugin (and which ones don't)?
Knowledge is knowing that a tomato is a fruit... Wisdom is knowing you don't put tomatoes in a fruit salad.!

mystran
KVRAF
5001 posts since 12 Feb, 2006 from Helsinki, Finland

Re: Callback events (which ones need to contact the plugin ? )

Post Sun Jul 08, 2018 11:06 am

Notice that this simply calls a 'dispatcher' function, sending a message to the VST plugin itself. I'm assuming there must be other events which do the same thing (e.g. to query the plugin's name / or the number of inputs & outputs or whatever...)

AFAICT though, the vast majority of events don't need to contact the plugin. So is there a list anywhere which shows which events DO need to send something to the plugin (and which ones don't)?
Well, basically anything that's not processing or set/get parameters goes through the dispatcher and the various dispatcher opcodes can be found in the official VST-SDK headers (assuming those are still available somewhere; no idea). I'm not quite sure what you mean by events that don't need to contact the plugin, since just about anything having to do with the plugin normally calls into the plugin.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

johne53
KVRer
17 posts since 27 Jul, 2012 from Manchester, UK

Re: Callback events (which ones need to contact the plugin ? )

Post Sun Jul 08, 2018 10:32 pm

Thanks mystran. The case that I quoted in my original post works okay - but a bit further down the list there's another event (called audioMasterUpdateDisplay) which is currently getting handled identically - i.e.

Code: Select all

case audioMasterUpdateDisplay:
        SHOW_CALLBACK ("audioMasterUpdateDisplay");
        // something has changed, update 'multi-fx' display
        if (effect) {
            effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f);
        }
        return 0;
Unfortunately, I'm finding that this particular code causes some plugins to crash - so I'm guessing that the call to effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f) isn't the right thing to do here?? I just wondered if there's anywhere where I can find out what's the correct response for this event?
Knowledge is knowing that a tomato is a fruit... Wisdom is knowing you don't put tomatoes in a fruit salad.!

mystran
KVRAF
5001 posts since 12 Feb, 2006 from Helsinki, Finland

Re: Callback events (which ones need to contact the plugin ? )

Post Sun Jul 08, 2018 11:29 pm

Oh... now I understand the question...

So basically when the host wants something from the plugin, it should call the dispatcher with a given effOpcode and when the plugin wants something from the host, it calls the audioMasterCallback with the given audioMasterOpcode.

I don't think you should ever really call the dispatcher in response to an audioMasterCallback, except when you specifically need something from the plugin.. like.. audioMasterUpdateDisplay for example tells the host to "update display" which I guess basically means to fetch the parameter information again if you're caching it somewhere or showing it on a GUI or whatever... but I'd imagine a plugin might reasonably expect to call audioMasterUpdateDisplay in response to effEditIdle (see below) so maybe that's why you're getting crashes?

As far as the first snippet, there's no such thing as audioMasterIdle in the official headers, so no idea what that's supposed to do. Maybe it maps to audioMasterNeedIdle which is legacy (deprecated in 2.4) and IIRC supposed to inform the host that the plugin expects effIdle calls (also deprecated in 2.4; can't remember if it's supposed to be called in audio thread or what, never used it and it's just legacy anyway), which are distinct from effEditIdle (which is supposed to be called in GUI thread at "regular intervals" for stuff like animation.. although many plugins draw on timer instead 'cos most hosts don't call the effEditIdle often enough for smooth animation).
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

johne53
KVRer
17 posts since 27 Jul, 2012 from Manchester, UK

Re: Callback events (which ones need to contact the plugin ? )

Post Mon Jul 09, 2018 3:49 am

That's a great explanation mystran - thanks for all your help.
Knowledge is knowing that a tomato is a fruit... Wisdom is knowing you don't put tomatoes in a fruit salad.!

Return to “DSP and Plug-in Development”