vst3_public_sdk icon indicating copy to clipboard operation
vst3_public_sdk copied to clipboard

Feature Request: Support automation highlighting in AAXWrapper

Open raygit83 opened this issue 6 years ago • 1 comments

I didn't hear back from you, so here's my proposal regarding the above FR. The idea is to add an AAX specific function to the IVst3ToAAXWrapper interface so the plugin implementation can poll the control highlighting state whenever the developer wishes to. Another option would be to have a corresponding interface extension that may extend the IEditController implementation that an apropriate AAXWrapper_GUI::SetControlHighlightInfo() delegates to through your editor BaseWrapper. Please let me know whether this or a similar patch can be added in a future SDK update.

  1. Extend the IVst3ToAAXWrapper interface declaration in the following way:
class IVst3ToAAXWrapper : public FUnknown
{
public:
	virtual tresult PLUGIN_API getAutomationHighlight (int tag, int *color) = 0;

	//------------------------------------------------------------------------
	static const FUID iid;
};
DECLARE_CLASS_IID (IVst3ToAAXWrapper, 0x6D319DC6, 0x60C56242, 0xB32C951B, 0x93BEF4C6)

//------------------------------------------------------------------------

/**   Pro Tools automation highlighting colors
*/
enum AAXHighlightColor
{
	kHighlightColorNone = -1,
	kHighlightColorRed, // Corresponds to AAX_eHighlightColor_Red
	kHighlightColorBlue, // Corresponds to AAX_eHighlightColor_Blue
	kHighlightColorGreen, // Corresponds to AAX_eHighlightColor_Green
	kHighlightColorYellow // Corresponds to AAX_eHighlightColor_Yellow
};

This enables the plugin to retrieve the current highlighting color for all the controls corresponding to the parameter "tag".

  1. Add a map that keeps track of the highlights to the AAX Wrapper (aaxwrapper.h):
// static creation method
	static AAXWrapper* create (Steinberg::IPluginFactory* factory,
	                           const Steinberg::TUID vst3ComponentID, AAX_Plugin_Desc* desc,
	                           AAXWrapper_Parameters* p);

...
	// IVst3ToAAXWrapper
	Steinberg::tresult PLUGIN_API getAutomationHighlight (int tag, int *color) SMTG_OVERRIDE;
...

private:
...
	std::map<int, int> automationHighlights;
  1. Implement "getAutomationHighlight()" e.g. (aaxwrapper.cpp):
...
tresult PLUGIN_API AAXWrapper::getAutomationHighlight(int tag, int *color)
{
	if (color != nullptr)
	{
		auto it = automationHighlights.find(tag);
		if (it != automationHighlights.end())
		{
			*color = it->second;
			return kResultTrue;
		}
	}
	return kResultFalse;
}
...
  1. Override and implement "SetControlHighlightInfo()" in aaxwrapper_gui.h / aaxwrapper_gui.cpp so it fills the map with the currently active highlights:
...
AAX_Result AAXWrapper_GUI::SetControlHighlightInfo(AAX_CParamID aaxid, AAX_CBoolean iIsHighlighted, AAX_EHighlightColor iColor)
{
	AAXWrapper* wrapper =
		static_cast<AAXWrapper_Parameters*> (GetEffectParameters())->getWrapper();

	// NOTE: One could make getVstParamID() a static helper function in AAXWrapper instead
	if (aaxid[0] != 'p')
		return AAX_ERROR_INVALID_PARAMETER_ID;
	Vst::ParamID id;
	if (sscanf(aaxid + 1, "%x", &id) != 1)
		return AAX_ERROR_INVALID_PARAMETER_ID;

	int color = kHighlightColorNone;

	if (iIsHighlighted)
	{
		switch(iColor)
		{
		case AAX_eHighlightColor_Red: color = kHighlightColorRed; break;
		case AAX_eHighlightColor_Blue: color = kHighlightColorBlue; break;
		case AAX_eHighlightColor_Green: color = kHighlightColorGreen; break;
		case AAX_eHighlightColor_Yellow: color = kHighlightColorYellow; break;
		}
	}

	wrapper->automationHighlights[id] = color;

	return AAX_SUCCESS;
}
...

raygit83 avatar Nov 13 '18 12:11 raygit83

Any news on this? I know AAX/Pro Tools distinguishes between more automation states than VST3, but wouldn't it be feasible to use IAutomationState::setAutomationState() in order to implement this feature?

raygit83 avatar Aug 31 '21 06:08 raygit83