Override handleCanPlugInDo?


#1

We’re working on supporting a feature from a major manufacturer, but an NDA is preventing me from disclosing more. In the SDK that they sent us, we need to be able to respond to a canDo call with a special String from their host.

The VSTCallbackHandler allows us to easily handle the rest of the SDK. canDo is our only roadblock.

Can we have a similar function in the VSTWrapper’s handleCanPlugInDo so that we can respond to some other String?

EDIT: Just for clarification, I’m looking at this function. I would need to be able to add a “if (matches(“foo”)) return 1;”


#2

We ended up modifying our local copies. Is this something that can make its way into a future release?


#3

Also had to do the same here, and modify our local copy. Would like to see this in a future release as well.


#4

Same here, we had to patch our local copy for the canDo stuff.


#5

How did you get to override the AudioEffectX?


#6

Make Plugin Processor inherit from “public VSTCallbackHandler”. Override

virtual pointer_sized_int handleVstManufacturerSpecific(int32 index, pointer_sized_int value, void *ptr, float opt) override;

We’re under NDA, so I’ve obscured the code. I assume that you’re working on integrating the same library. Feel free to message me if that’s the case.

pointer_sized_int UAPluginProcessor::handleVstManufacturerSpecific(int32 index, pointer_sized_int value, void *ptr, float opt)
{
#ifdef SUPPORTS_VOLDEMORT
	return voldemortResponse(index, value, ptr, opt);
#else
	return 0;
#endif
}

EDIT: The other part involves editing juce_VST_Wrapper.cpp. Line 1954:

pointer_sized_int handleCanPlugInDo (VstOpCodeArguments args)
    {
        auto text = (const char*) args.ptr;
        auto matches = [=](const char* s) { return strcmp (text, s) == 0; };
        ...
        #if SUPPORTS_VOLDEMORT
        if (matches("VOLDEMORTCallbacks")) return 1;
        #endif

        return 0;
    }

#7

It looks like I can’t message you directly, so I’m going to tell you here: Thanks a lot!

I did already implement this but, it still doesn’t work on runtime…

Again thanks a lot, I’ll keep looking.
Cheers


#8

Just sent you a message!


#9

As a heads up to everyone else in this thread, JUCE 5.3.2 now has handleVstPluginCanDo in the VSTCallbackHandler class:
https://docs.juce.com/master/structVSTCallbackHandler.html

One less hack in our local branches! :champagne:

@ohmforce, @tlongabaugh, @jpo


#10

And it works like a charm :slight_smile:
Here some code snippets as an example implementation:

PluginProcessor.h:
Inheriting from VSTCallbackHandler:
class StereoEncoderAudioProcessor : public AudioProcessor, public VSTCallbackHandler

overriding methods:

pointer_sized_int handleVstManufacturerSpecific (int32 index, pointer_sized_int value,
                                                     void* ptr, float opt) override { return 0; };
pointer_sized_int handleVstPluginCanDo (int32 index, pointer_sized_int value,
                                            void* ptr, float opt) override;

PluginProcessor.cpp:

E.g. implementing Reaper’s recently supported wantsChannelCountNotifications canDo

pointer_sized_int StereoEncoderAudioProcessor::handleVstPluginCanDo (int32 index,
                                        pointer_sized_int value, void* ptr, float opt)
{
    auto text = (const char*) ptr;
    auto matches = [=](const char* s) { return strcmp (text, s) == 0; };

    if (matches ("wantsChannelCountNotifications"))
        return 1;
    return 0;
}

VST does not receive update in channel count with Reaper
#11

Hello!

I’m using JUCE 5.2.1 and I have cherry-picked the commit

Added a “plug-in can do” callback to the VSTCallbackHandler interface

so I can handle vendor specific vst host->plugin “can do” callbacks.

I have implemented (override) the virtual methods of the VSTCallbackHandler ( handleVstPluginCanDo and handleVstManufacturerSpecific ) as public methods of my PluginProcessor.

When the handleCanPlugInDo method of the JuceVSTWrapper class receives unhandled plug-in “can do” calls from the host, the

auto callbackHandler = dynamic_cast<VSTCallbackHandler*> (processor)

returns a NULL pointer, so the

if (auto callbackHandler = dynamic_cast<VSTCallbackHandler*> (processor)) return callbackHandler->handleVstPluginCanDo (args.index, args.value, args.ptr, args.opt);

doesn’t call the handleVstPluginCanDo method.

Any idea why? Maybe I’ve missed some other commits after the tag 5.2.1 that I need to cherry pick before the Added a "plug-in can do" callback to the VSTCallbackHandler interface commit?

Thanks!


#12

I found the problem! My code was:

PluginProcessor.h:
Inheriting from VSTCallbackHandler:
class MyAudioProcessor : public AudioProcessor, VSTCallbackHandler

and it needs to be:

PluginProcessor.h:
Inheriting from VSTCallbackHandler:
class MyAudioProcessor : public AudioProcessor, public VSTCallbackHandler