Answer to message - which is better?

SDK for VST 3 audio plug-in and host development.
Post Reply
thirty
Posts: 8
Joined: Tue Feb 06, 2018 9:38 am

Answer to message - which is better?

Post by thirty » Mon Apr 06, 2020 12:02 pm

Hi

Which approach is better to respond to a message from for example Processor to Controller?

Code: Select all

tresult PLUGIN_API PlugProcessor::notify(Vst::IMessage* message) {

	const void* binaryData = nullptr;
	uint32 messageSize = 0;

	if (strcmp(message->getMessageID(), "MESSAGE") == 0) {
		if (message->getAttributes()->getBinary("MESSAGE", binaryData, messageSize) == kResultOk) {

			sendBackMessage(...) //<----- Respond here
			return kResultTrue;
		}

	}
	
}
or

Code: Select all

tresult PLUGIN_API PlugProcessor::notify(Vst::IMessage* message) {

	const void* binaryData = nullptr;
	uint32 messageSize = 0;

	if (strcmp(message->getMessageID(), "MESSAGE") == 0) {
		if (message->getAttributes()->getBinary("MESSAGE", binaryData, messageSize) == kResultOk) {

			setTimer(...); //<---- set timer here
			return kResultTrue;
		}

	}
	
}

tresult PLUGIN_API PlugProcessor::onTimer(...) { //<----- answer in timer callback
	sendBackMessage(...);
}


Post Reply