1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

VST3 Client: Add support for IParameterFinder interface

This allows hosts such as Cubase and MultitrackStudio to locate
parameters based on the current mouse position.

Users must override and implement getControlParameterIndex in order for
the parameter to be reported to the host.

The DSPModulePluginDemo shows one possible strategy for implementing
this function.
This commit is contained in:
reuk 2024-04-29 18:07:17 +01:00
parent c4652ef7bc
commit c5b428dfe9
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
3 changed files with 78 additions and 3 deletions

View file

@ -1620,6 +1620,15 @@ public:
ladderControls);
}
/* Called by VST3 and AAX hosts to determine which parameter is under the mouse. */
int getControlParameterIndex (Component& comp) override
{
if (auto* parent = findParentComponentWithParamMenu (&comp))
return parent->getParameterIndex();
return -1;
}
private:
class ComponentWithParamMenu : public Component
{
@ -1636,11 +1645,27 @@ private:
.withMousePosition());
}
int getParameterIndex() const
{
return param.getParameterIndex();
}
private:
AudioProcessorEditor& editor;
RangedAudioParameter& param;
};
static ComponentWithParamMenu* findParentComponentWithParamMenu (Component* c)
{
if (c == nullptr)
return nullptr;
if (auto* derived = dynamic_cast<ComponentWithParamMenu*> (c))
return derived;
return findParentComponentWithParamMenu (c->getParentComponent());
}
class AttachedSlider final : public ComponentWithParamMenu
{
public: