HISE Logo Forum
    • Categories
    • Register
    • Login

    Possible to communicate between plugins?

    Scheduled Pinned Locked Moved General Questions
    32 Posts 7 Posters 2.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ulrikU
      ulrik @Christoph Hart
      last edited by

      @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?

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

      1 Reply Last reply Reply Quote 3
      • ulrikU
        ulrik @Christoph Hart
        last edited by ulrik

        @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

        Hise Develop branch
        MacOs 15.3.1, Xcode 16.2
        http://musikboden.se

        1 Reply Last reply Reply Quote 0
        • ulrikU
          ulrik @Christoph Hart
          last edited by ulrik

          @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?

          Hise Develop branch
          MacOs 15.3.1, Xcode 16.2
          http://musikboden.se

          ulrikU 1 Reply Last reply Reply Quote 1
          • ulrikU
            ulrik @ulrik
            last edited by

            @ulrik and the data sent is an array, and that works great

            Hise Develop branch
            MacOs 15.3.1, Xcode 16.2
            http://musikboden.se

            ulrikU 1 Reply Last reply Reply Quote 0
            • ulrikU
              ulrik @ulrik
              last edited by

              @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);
              

              Hise Develop branch
              MacOs 15.3.1, Xcode 16.2
              http://musikboden.se

              ? lalalandsynthL 2 Replies Last reply Reply Quote 0
              • ?
                A Former User @ulrik
                last edited by

                @ulrik Does

                rm.connectToOSC({
                	"SourcePort": 6666,
                	"TargetPort":  [1234, 5678],
                	"Domain": "/ostinarp"
                }, 0);
                

                Work?

                1 Reply Last reply Reply Quote 0
                • lalalandsynthL
                  lalalandsynth @ulrik
                  last edited by

                  @ulrik I am not very familiar with OSC but I am assuming this would need a user to install OSC specifically to use this ?

                  https://lalalandaudio.com/

                  https://lalalandsynth.com/

                  https://www.facebook.com/lalalandsynth

                  https://www.facebook.com/lalalandsynth

                  Christoph HartC 1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart @lalalandsynth
                    last edited by

                    @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...

                    ulrikU 2 Replies Last reply Reply Quote 3
                    • ulrikU
                      ulrik @Christoph Hart
                      last edited by

                      @Christoph-Hart @lalalandsynth I've tried using an array but it will not work, at least not the way I've set it up

                      Hise Develop branch
                      MacOs 15.3.1, Xcode 16.2
                      http://musikboden.se

                      1 Reply Last reply Reply Quote 0
                      • ulrikU
                        ulrik @Christoph Hart
                        last edited by

                        @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?

                        Hise Develop branch
                        MacOs 15.3.1, Xcode 16.2
                        http://musikboden.se

                        1 Reply Last reply Reply Quote 0
                        • ?
                          A Former User
                          last edited by A Former User

                          Guys sorry about my ignorance.

                          What are the use cases of the communication between the plugins?
                          What does this feature stand for?

                          ulrikU 1 Reply Last reply Reply Quote 0
                          • ulrikU
                            ulrik @A Former User
                            last edited by

                            @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

                            Hise Develop branch
                            MacOs 15.3.1, Xcode 16.2
                            http://musikboden.se

                            lalalandsynthL 1 Reply Last reply Reply Quote 0
                            • lalalandsynthL
                              lalalandsynth @ulrik
                              last edited by

                              @ulrik Could I for example control a gain module on track 2, and having my main control module on track 1?

                              https://lalalandaudio.com/

                              https://lalalandsynth.com/

                              https://www.facebook.com/lalalandsynth

                              https://www.facebook.com/lalalandsynth

                              Christoph HartC ulrikU 2 Replies Last reply Reply Quote 0
                              • Christoph HartC
                                Christoph Hart @lalalandsynth
                                last edited by

                                @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).

                                1 Reply Last reply Reply Quote 1
                                • ulrikU
                                  ulrik @lalalandsynth
                                  last edited by ulrik

                                  @lalalandsynth
                                  If I understand you right, yes

                                  In 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);
                                  

                                  Hise Develop branch
                                  MacOs 15.3.1, Xcode 16.2
                                  http://musikboden.se

                                  ulrikU 1 Reply Last reply Reply Quote 0
                                  • ulrikU
                                    ulrik @ulrik
                                    last edited by ulrik

                                    @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?

                                    Hise Develop branch
                                    MacOs 15.3.1, Xcode 16.2
                                    http://musikboden.se

                                    Christoph HartC 1 Reply Last reply Reply Quote 0
                                    • Christoph HartC
                                      Christoph Hart @ulrik
                                      last edited by

                                      @ulrik I'm using the Realtime callback already (unless you specifically tell the OSC listener to be asynchronous).

                                      ulrikU 1 Reply Last reply Reply Quote 1
                                      • ulrikU
                                        ulrik @Christoph Hart
                                        last edited by

                                        @Christoph-Hart Great!

                                        Hise Develop branch
                                        MacOs 15.3.1, Xcode 16.2
                                        http://musikboden.se

                                        ulrikU 1 Reply Last reply Reply Quote 0
                                        • ulrikU
                                          ulrik @ulrik
                                          last edited by

                                          @ulrik I managed to have several listeners plugins, by forwarding the not consumed data to a new port it works.

                                          The downside is that if I want to listen to ch 4, I need to have ch 1 - 3 also up and running

                                          const var rm = Engine.getGlobalRoutingManager();
                                          
                                          inline function onChannelKnobControl(component, value)
                                          {
                                          	rm.connectToOSC({
                                          		"SourcePort": 6666+value, // incoming port
                                          		"TargetPort": 6667+value, // sending port
                                          		"Domain": "/ostarp"
                                          	}, function(error)
                                          	{
                                          		Console.print(error);
                                          	});
                                          };
                                          
                                          Content.getComponent("ChannelKnob").setControlCallback(onChannelKnobControl);
                                          
                                          
                                          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();
                                          	}
                                          	else
                                          		rm.sendOSCMessage(subdomains[ch-1], value);
                                          };
                                          
                                          for (i = 0; i < 4; i++)
                                          	rm.addOSCCallback(subdomains[i], OSCCallback);
                                          

                                          ostarpwlisteners.gif

                                          Hise Develop branch
                                          MacOs 15.3.1, Xcode 16.2
                                          http://musikboden.se

                                          ulrikU 1 Reply Last reply Reply Quote 1
                                          • ulrikU
                                            ulrik @ulrik
                                            last edited by ulrik

                                            @Christoph-Hart is there a way, in Hise, to count how many instances of the same plugin is loaded in a daw?

                                            The above solution is not optimal because the user will not be able to run more than 1 instance of the "mother plug" before it's get messy.

                                            I'm thinking maybe the second "mother plug" could sense if there is another loaded and automatically change the domain port and the listeners have a way to change the domain port (via the user)?

                                            Hise Develop branch
                                            MacOs 15.3.1, Xcode 16.2
                                            http://musikboden.se

                                            ulrikU 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            15

                                            Online

                                            1.7k

                                            Users

                                            11.8k

                                            Topics

                                            103.2k

                                            Posts