Possible to communicate between plugins?
-
-
I haven't got around to trying it myself yet but Christoph posted an example for me
https://forum.hise.audio/topic/6306/osc-has-arrived/13?_=1667038909341
-
@d-healey Ah yes, now I remember that was me :)
-
@Christoph-Hart I've got it working, from one vst3 plugin to another vst3 plugin in the same daw :)
I've set it up so I have one main plugin, sending information via OSC and a "receiver" plugin and it works nicely but if I use more than 1 instance of the receiver plugin, only 1 of them is receiving the data, why is that?
Is it possible to make all of them receive the data? -
@Christoph-Hart Do I need a "SourcePort" per instance maybe?
And set the port when it's already loaded..hmm... I'll try some things -
@Christoph-Hart I'm not able to have more than 1 instance of the receiver plugin, this is my setup
This is the "main" plugin that sends information to the receiver plugins
The "subdomains" array is working great, I'm able to switch between the sub domains while running.Also the callback works, it will receive data from the all the instances of the receiver plugin, and I can clearly see from which instance it comes.
But only 1 of the receivers get the send data, even though the "dead" instances can send back to the "main" plugin.
// Testing communiction between plugins const subdomains = ["/ch1", "/ch2", "/ch3", "/ch4"]; const var rm = Engine.getGlobalRoutingManager(); rm.connectToOSC({ "SourcePort": 6666, "TargetPort": 6667, "Domain": "/ostinarp" }, 0); inline function OSCCallback(id, value) { LogLbl1.set("text", value); }; for (i = 0; i < 4; i++) rm.addOSCCallback(subdomains[i], OSCCallback);
This is how I set up the receiver plugins
const var rm = Engine.getGlobalRoutingManager(); rm.connectToOSC({ "SourcePort": 6667, // Note how the source port and target port are "TargetPort": 6666, // reversed here to allow bidirectional communication "Domain": "/ostinarp" }, 0); inline function OSCCallback(id, value) { local ch = ChannelKnob.getValue(); if (value[0] == ch) { local ev = Synth.addNoteOn(value[0], value[1], value[2], 0); Synth.noteOffDelayedByEventId(ev, value[3]); LogPanel.setValue(value); LogPanel.repaint(); rm.sendOSCMessage(subdomains[ch-1], "Hi there from "+subdomains[ch-1]); } };
What have done wrong?
-
@ulrik and the data sent is an array, and that works great
-
@Christoph-Hart is it possible to send to more than 1 "TargetPort"
const var rm = Engine.getGlobalRoutingManager(); rm.connectToOSC({ "SourcePort": 6666, "TargetPort": several ports, "Domain": "/ostinarp" }, 0);
-
@ulrik Does
rm.connectToOSC({ "SourcePort": 6666, "TargetPort": [1234, 5678], "Domain": "/ostinarp" }, 0);
Work?
-
@ulrik I am not very familiar with OSC but I am assuming this would need a user to install OSC specifically to use this ?
-
@lalalandsynth Nope, OSC is a network protocol and doesn't need any 3rd party software.
However I don't have too much knowledge about OSC, I just implemented a wrapper around the JUCE classes so I can imagine that port numbers need to be exclusive in order to receive messages.
"TargetPort": [1234, 5678],
pretty sure this will not work, because I implemented this and the
TargetPort
property gets parsed as a single integer value, but I can try to take a look at this and create multiple OSC senders which send the same message to multiple target ports here. Not sure when I find the time for that though... -
@Christoph-Hart @lalalandsynth I've tried using an array but it will not work, at least not the way I've set it up
-
@Christoph-Hart Using only 1 sender and 1 receiver works great, also using using different sub domain.
When the first receiver instance has successfully connected and is receiving data, it is like this instance is blocking the senders port so the second instance is not able to connect.
If that is the case, it would be great if the sender could send on several ports.And as I understand it, you can't use
Engine.getGlobalRoutingManager();
for more than one time right?
-
Guys sorry about my ignorance.
What are the use cases of the communication between the plugins?
What does this feature stand for? -
@harris-rosendahl in my case I wan't to send midi information from a multichannel arpeggiator (which will not work in some daws), to several "receiver! plugins to control multi instruments
-
@ulrik Could I for example control a gain module on track 2, and having my main control module on track 1?
-
@lalalandsynth Be careful about "persistent" states in conjunction with OSC, this is one of the main drawbacks I found in this protocol because restoring these settings from a DAW project will not restore the values (especially because you can't guarantee that the gain module 2 exists already when the gain module 1 is created and restored).
-
@lalalandsynth
If I understand you right, yesIn you main plugin
const var rm = Engine.getGlobalRoutingManager(); rm.connectToOSC({ "SourcePort": 6666, "TargetPort": 6667, "Domain": "/receiver" }, function(printError) { Console.print(printError); }); // In you gain callback inline function onGainControl(component, value) { rm.sendOSCMessage("/gain", value); } Content.getComponent("Gain").setControlCallback(onGainControl);
In you receiver plugin
const var rm = Engine.getGlobalRoutingManager(); rm.connectToOSC({ "SourcePort": 6667, "TargetPort": 6666, "Domain": "/receiver" }, function(printError) { Console.print(printError); }); inline function OSCCallback(id, value) { Track2Gain.setValue(value); Track2Gain.changed(); }; rm.addOSCCallback("/gain", OSCCallback);
-
@Christoph-Hart while searching the juice files for a solution to the "locked port" issue, I found this:
taken from juice_OSCReceiver.h/** Use this struct as the template parameter for Listener and ListenerWithOSCAddress to receive incoming OSC data immediately after it arrives, called directly on the network thread that listens to incoming OSC traffic. This type can be used by OSC callbacks that don't do much, but are realtime-critical, for example, setting real-time audio parameters. */ struct JUCE_API RealtimeCallback {};
If this was implemented in Hise, would it be able to control midi messages accurate, in time?
-
@ulrik I'm using the Realtime callback already (unless you specifically tell the OSC listener to be asynchronous).