VST3 Messages and Attributes

Hello everyone,

I’ve been using JUCE as a host for a while but somehow I fail to understand something about the Message management in VST3, juce_VST3PluginFormat.cpp. And we recently got a problem with a plugin that uses the messages similar to the following exmaple:

A dummy example calls from a plugin:

IMessage* message1 = pMyController->allocateMessage();   // Redirects to calling the host DAW 
	if (message1)
	{
		FReleaser msgReleaser(message1);

		// Step 2
		message1->setMessageID("BinaryMessage");

		// Step 3
		float fValue = 3.41593f;
		message1->getAttributes()->setFloat("Float", fValue);
	}

	// Step 4  msgReleaser releases Message1

	//Step 5 – create a completely new message
	IMessage* message2 = pMyController->allocateMessage();
	if (message2)
	{
		FReleaser msgReleaser(message2);

		// Step 6
		message2->setMessageID("BinaryMessage1");

		int nIntVal = 123456789;

		// Step 7 Set its attribute to "Int"...
		message2->getAttributes()->setInt("Int", nIntVal);

		double dValue;

		// ******* Bug*****   Message2 still has  the attribute of message 1 "Float". 
		if (message2->getAttributes()->getFloat("Float", dValue) == kResultOk)
		{
			char Out[256];
			sprintf(Out, "Invalid attribute in newly allocated message !!...%f\n", dValue);
			OutputDebugStringA(Out);
		}
	}

As far as I see while debugging, what setFloat does is really creating a new message with the ID “Float”
tresult PLUGIN_API setFloat (AttrID id, double value) override
{

addMessageToQueue (id, value);

}
Am I missing something or are the Attribute IDs and the Message IDs totally mixed here?

And later on, when the plugin does message2->getAttributes()->getFloat(“Float”, dValue) the getFloat function really just finds the message with the ID “Float” …

tresult PLUGIN_API getFloat (AttrID id, double& result) override
{

if (findMessageOnQueueWithID (id, result))

}

Many thanks in advance

Cheers
Milev