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:
parent
c4652ef7bc
commit
c5b428dfe9
3 changed files with 78 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue