Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Support automation highlighting in AAXWrapper #7

Open
raygit83 opened this issue Nov 13, 2018 · 1 comment
Open

Feature Request: Support automation highlighting in AAXWrapper #7

raygit83 opened this issue Nov 13, 2018 · 1 comment

Comments

@raygit83
Copy link

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
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant