Track plug-in automation data over ethernet


i have a question regarding network connections. I just started with Juce and do not have a long background in programming so please be patient with me.

So i try to get remote control over network for plugins. The plugin is the client. The first thing i tried was to write a network class and create an instance in the PluginEditor. A buttonclick opened the socket connection and created a thread which checked for incoming or outgoing messages. Getting or setting the parameters was done in the thread with the messageManagerLock. Most of you will already know what happened then. When the Editor is closed in the DAW the destructor gets called and the socket connection is lost.

Then next idea was to write a static network class and create the instance to run the thread in the PluginProcessor. When the editor is open i use the onclick Listener functions to call the static write function of the network class. But i am not sure what happens when the editor is closed and how to handle incoming messages and update the parameters without the editor. Can i just call a button.setToggleState() function when the editor is closed? Can anybody give me a hint how to handle that kind of situation?
And how is automation handled when the editor is closed. Does the listener function of the button still get called?

I would love to have some kind of plan before i am lost in trial and error so any help is highly appreciated.

You need to decouple your state from your UI. The UI should reflect your state but not be the actual representation. JUCE offers ValueTrees for this kind of data management. Take a look at this video for example:


Oh wow what a powerful tool. I had the valueTree already implemented for presets but didn´t realize what kind of possibilities it has. Thank you very much!

Also if you’d like to save yourself some time. OSC which is supported in JUCE can abstract a lot for you and it is a standard.


Thanks for the hint ttg. I will look deeper into OSC but i would like to have a raw connection. At the moment everything is new to me and it seems easier to have a basic connection where i can somehow understand what is going on. Still have to master the basics.

I´ve done some homework on the value tree and i realised that of course it would be cool to set and get parameters over the ethernet connection.

So now the PluginProcessor inherits from the AudioProcessorValueTreeState::Listener.
The Streaming Socket is a member of the PluginProcessor.
A Button in the UI that is not attached to the apvts calls a function in the PluginProcessor to open the socket connection. So the connection should stay open when the GUI is closed.
When the PluginProcessor constructor is called a thread starts which reads a sendFlag set by the AudioProcessorValueTreeState::Listener. Is it ok then to do the parameter reading and writing in this thread regarding thread safety. Here´s a quick pseudo code example of what i have in mind.

void StaticSocketAudioProcessor::run()
	DBG("Thread started");
        char recv[10] = { 0 };
	int bytesRecv = 0;
        while (!threadShouldExit())
		if (connected) {
			if (sendFlag)
				auto a1Contr = parameters.getParameter("a1");
				auto a1Value = a1Contr->getValue();
				socketConnection->waitUntilReady(false, 10);
				socketConnection->write(&a1Value, sizeof(a1Value));
				sendFlag = false;

			if (socketConnection->waitUntilReady(true, 10)) {
				bytesRecv = socketConnection->read(recv, 10, false);
			if (bytesRecv > 0) {
				auto a1Contr = parameters.getParameter("a1");
				bytesRecv = 0;
	DBG("Thread closed");

The GUI buttons and sliders are managed through attachments to the apvts. Am i right that i don´t have to call button::Listener functions anymore because the attachment is doing the work of keeping track of the GUI?

Thanks for your help!