Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions modules/juce_audio_plugin_client/juce_audio_plugin_client_VST3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ class JuceVST3EditController final : public Vst::EditController,
#if JucePlugin_Enable_ARA
public Presonus::IPlugInViewEmbedding,
#endif
public Presonus::IContextInfoHandler,
public AudioProcessorListener,
private ComponentRestarter::Listener
{
Expand Down Expand Up @@ -1135,6 +1136,48 @@ class JuceVST3EditController final : public Vst::EditController,
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProgramChangeParameter)
};

void notifyContextInfoChange() override
{
if (! PluginHostType().isStudioOne())
return;

if (auto* instance = getPluginInstance())
{
bool hasUsableContextInfoChange = false;
AudioProcessor::TrackProperties trackProperties;
FUnknownPtr<Presonus::IContextInfoProvider> contextInfoProvider (componentHandler);
Steinberg::int32 channelColour = 0;
if (contextInfoProvider->getContextInfoValue (channelColour, Presonus::ContextInfo::kColor)
== kResultTrue)
{
// PreSonus uses RGBA
uint8 r = (channelColour) &0x000000FF;
uint8 g = (channelColour >> 8) & 0x000000FF;
uint8 b = (channelColour >> 16) & 0x000000FF;
uint8 a = (channelColour >> 24) & 0x000000FF;
trackProperties.colour = std::make_optional (Colour (r, g, b, a));
hasUsableContextInfoChange = true;
}

Vst::TChar channelName[128] = {0};
if (contextInfoProvider->getContextInfoString (channelName, 128, Presonus::ContextInfo::kName)
== kResultTrue)
{
trackProperties.name = std::make_optional (toString (channelName));
hasUsableContextInfoChange = true;
}

if (! hasUsableContextInfoChange)
return;

if (MessageManager::getInstance()->isThisTheMessageThread())
instance->updateTrackProperties (trackProperties);
else
MessageManager::callAsync ([trackProperties, instance]
{ instance->updateTrackProperties (trackProperties); });
}
}

//==============================================================================
tresult PLUGIN_API getCompatibleParamID (const TUID pluginToReplaceUID,
Vst::ParamID oldParamID,
Expand Down Expand Up @@ -1692,6 +1735,7 @@ class JuceVST3EditController final : public Vst::EditController,
UniqueBase<Vst::IUnitInfo>{},
UniqueBase<Vst::IRemapParamID>{},
UniqueBase<Vst::ChannelContext::IInfoListener>{},
UniqueBase<Presonus::IContextInfoHandler>{},
SharedBase<IPluginBase, Vst::IEditController>{},
UniqueBase<IDependent>{},
#if JucePlugin_Enable_ARA
Expand Down
4 changes: 4 additions & 0 deletions modules/juce_audio_processors/format_types/juce_VST3Headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-W#warnings",
#include <public.sdk/source/vst/vstpresetfile.h>

#include "pslextensions/ipslviewembedding.h"
#include "pslextensions/ipslcontextinfo.h"
#else
// needed for VST_VERSION
#include <pluginterfaces/vst/vsttypes.h>
Expand Down Expand Up @@ -211,6 +212,7 @@ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-W#warnings",
#endif

#include "pslextensions/ipslviewembedding.h"
#include "pslextensions/ipslcontextinfo.h"

//==============================================================================
namespace Steinberg
Expand Down Expand Up @@ -238,6 +240,8 @@ namespace Steinberg
namespace Presonus
{
DEF_CLASS_IID (IPlugInViewEmbedding)
DEF_CLASS_IID (IContextInfoHandler)
DEF_CLASS_IID (IContextInfoProvider)
}

#endif // JUCE_VST3HEADERS_INCLUDE_HEADERS_ONLY
Expand Down