Send and receive custom messages to/from host

I’m working on a JUCE VST2 plugin and non-JUCE host. Since I’m writing both, I’d like to find a way to send custom messages between them.

I would like to have a function in my plugin that the host can call when it is loaded to retrieve a string, and a separate function which the host can use to send a string back to the plugin. I’ve been looking for a solution to this all day but I just can’t figure this one out!

I was looking into adding custom opcodes that my plugin can implement for my host dispatcher to send/receive messages. Is something like that possible?

If not, is there any simple way to send basic string messages (a “Hello World” example) between my 2 projects?

Any help would be greatly appreciated! Thank you!

You can use the chunk, which you receive in setStateInformation and send in getStateInformation to pass custom messages.

You could pass strings directly in that way, which would be the simplest way.

If you need a more direct way of interacting between your host and plugin, and you’re certain that your plugin and host would always run in the same process - you can even use that mechanism to pass a memory address that you can cast to an object on both sides and call methods on it.

Alternatively you can create you own VST3 extension (but that’s VST3 only).

Thanks Eyal this worked perfectly!

Adar