@@ -880,6 +880,7 @@ class JuceVST3EditController final : public Vst::EditController,
880880 #if JucePlugin_Enable_ARA
881881 public Presonus::IPlugInViewEmbedding,
882882 #endif
883+ public Presonus::IContextInfoHandler,
883884 public AudioProcessorListener,
884885 private ComponentRestarter::Listener
885886{
@@ -1135,6 +1136,48 @@ class JuceVST3EditController final : public Vst::EditController,
11351136 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ProgramChangeParameter)
11361137 };
11371138
1139+ void notifyContextInfoChange () override
1140+ {
1141+ if (! PluginHostType ().isStudioOne ())
1142+ return ;
1143+
1144+ if (auto * instance = getPluginInstance ())
1145+ {
1146+ bool hasUsableContextInfoChange = false ;
1147+ AudioProcessor::TrackProperties trackProperties;
1148+ FUnknownPtr<Presonus::IContextInfoProvider> contextInfoProvider (componentHandler);
1149+ Steinberg::int32 channelColour = 0 ;
1150+ if (contextInfoProvider->getContextInfoValue (channelColour, Presonus::ContextInfo::kColor )
1151+ == kResultTrue )
1152+ {
1153+ // PreSonus uses RGBA
1154+ uint8 r = (channelColour) &0x000000FF ;
1155+ uint8 g = (channelColour >> 8 ) & 0x000000FF ;
1156+ uint8 b = (channelColour >> 16 ) & 0x000000FF ;
1157+ uint8 a = (channelColour >> 24 ) & 0x000000FF ;
1158+ trackProperties.colour = std::make_optional (Colour (r, g, b, a));
1159+ hasUsableContextInfoChange = true ;
1160+ }
1161+
1162+ Vst::TChar channelName[128 ] = {0 };
1163+ if (contextInfoProvider->getContextInfoString (channelName, 128 , Presonus::ContextInfo::kName )
1164+ == kResultTrue )
1165+ {
1166+ trackProperties.name = std::make_optional (toString (channelName));
1167+ hasUsableContextInfoChange = true ;
1168+ }
1169+
1170+ if (! hasUsableContextInfoChange)
1171+ return ;
1172+
1173+ if (MessageManager::getInstance ()->isThisTheMessageThread ())
1174+ instance->updateTrackProperties (trackProperties);
1175+ else
1176+ MessageManager::callAsync ([trackProperties, instance]
1177+ { instance->updateTrackProperties (trackProperties); });
1178+ }
1179+ }
1180+
11381181 // ==============================================================================
11391182 tresult PLUGIN_API getCompatibleParamID (const TUID pluginToReplaceUID,
11401183 Vst::ParamID oldParamID,
@@ -1692,6 +1735,7 @@ class JuceVST3EditController final : public Vst::EditController,
16921735 UniqueBase<Vst::IUnitInfo>{},
16931736 UniqueBase<Vst::IRemapParamID>{},
16941737 UniqueBase<Vst::ChannelContext::IInfoListener>{},
1738+ UniqueBase<Presonus::IContextInfoHandler>{},
16951739 SharedBase<IPluginBase, Vst::IEditController>{},
16961740 UniqueBase<IDependent>{},
16971741 #if JucePlugin_Enable_ARA
0 commit comments