How to compare XML from session data with current state?

We’re trying to compare the state information is the XML saved in session data with the current state of our plugin, for AAX’s Compare ability. I’m using this function to compare, but for some reason it doesn’t compare correctly. At first, it returns true (equal), but after changing one parameter and changing it back, it returns false.

			if (pParameterTreeXml->hasTagName(parameters.state.getType()))
		{
			ValueTree givenState = ValueTree::fromXml(*pParameterTreeXml);
			return (givenState.isEquivalentTo(parameters.state))

Also, it might be nice for some parameters to have more specific control over the comparison (such as a "slacK’ for how close a parameter needs to be, or the ability to ignore some parameters).

What I’m wondering is how I can compare, with more control, my value tree state with the state returned from ValueTree::fromXml?

What is AAX’s Compare ability.?

AAX has a function CompareActiveChunk() that lets the plugin check if there are any differences between the current plugin state and the currently loaded preset (which is the same as the initial state if no preset has been selected).

The JUCE AAX wrapper does not implement this function, unfortunately. I created my own wrapper class that I instantiate (derived from the JUCE AAX implementation), and in that class I implemented that function so that our plugin can tell Pro Tools whether to light (and enable) its Compare button or not.

One of the thing I love about JUCE is that we can step into the code, with the debugger, and figure out what is going on. If this were an issue I was looking into I would step into the call to isEquivalentTo in the failure case, to figure out why it is failing.

Thanks, but since it ended up that I needed more control over the comparison than that would give me anyway, I found a way to iterate over the data myself and compare what needed comparing, one item at a time.

1 Like