Login / Register 0 items | $0.00 New @ KVR
johne53
KVRer
 
17 posts since 27 Jul, 2012, from Manchester, UK

Postby johne53; Sat Jul 07, 2018 11:19 pm Callback events (which ones need to contact the plugin ? )

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
 
4927 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Sun Jul 08, 2018 11:06 am Re: Callback events (which ones need to contact the plugin ? )

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.
Image <- plugins | forum
johne53
KVRer
 
17 posts since 27 Jul, 2012, from Manchester, UK

Postby johne53; Sun Jul 08, 2018 10:32 pm Re: Callback events (which ones need to contact the plugin ? )

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
 
4927 posts since 11 Feb, 2006, from Helsinki, Finland

Postby mystran; Sun Jul 08, 2018 11:29 pm Re: Callback events (which ones need to contact the plugin ? )

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).
Image <- plugins | forum
johne53
KVRer
 
17 posts since 27 Jul, 2012, from Manchester, UK

Postby johne53; Mon Jul 09, 2018 3:49 am Re: Callback events (which ones need to contact the plugin ? )

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.!

Moderator: Moderators (Main)

Return to DSP and Plug-in Development