Named Pipe idea
-
Ive been asking about how to design something like this as I have only been using HISe for about a week and I didn't get any responses. Anyway here is a preliminary design I came up with for taking in a JUCE named pipe for cross instance communication, the named pipe and RNBO nodes are compile nodes on my end and you won't be able to load them. I will share the repo address when I'm done so anyone can build it or look at the code.
HiseSnippet 1699.3oc2Y0sTabCEVKFQBN.SRaZldounWPlICCNP9axzIFavodZL3gkPycLhckwpnUZ6tx.tc588wKOJY5KP6QR65cWigXbfzjRlICRGIc9z47c9QKchjdz3XYDxY98FDRQNKfcGHT8ZzivDnVahbtEVH8oqgpOHjDGS8QNNkdsVny7yhL+7gWUmvIBOZ1THz9RlG8Mr.lJa1N09YFm2j3S2iEja0qWqkmTzPxk8AfTBuJJj3cL4H51D8xlAiblaKelRF4pHJZLxY15R+At8jmJrqeeVL6PNUOnJxENH6zMkbeMh0yhZziw86jdgiQHGbmrqeI60+931Le1v4yLC20HnR1NxaObloH7JU.dUyCuUyAuw.ImbPZVKjtG10KhEpxjnwycvsDJZTWBX1yCE6ZQN+MtgDVfPsR.4XZyHXvvMr7SWc0GUA9uG9xxkAKerpxIjnJQAU9wJaINhInqbDU8Zt7PBeWYeESbTah.7GQK+vW1suvSwjhJRw1REcGwxOr7eTd9x+Y4JiJpa2wJSCrHImqOtwHVyMhtrMtrnevgznGAfl2mNbgfAqnW.ewdg7jDOqcJ2BkhVBlZmPp3hnNnDiq1ikfJXoJi+5tI9qFxfCk0kmgX9Z2U5vpHCryEqTC81VaRTjzCCNWPWgzHESeMb1jdBDKYICyi2jFerRFZVaPnTnQgyBSnpOanZeeXsACGTiUiE2g2Gb8cHQPPGPTrWcVbaphLxjgoVhVvwuH1RTZPz11vzUpEcab.IVuKE8LkdXa6PlhF.WrkRFW1kSNghBH.5vNy.3wm1kzmq1eDCEjA4bQGPbozuOmnJFrpyPkH.3NEhPzgAhXlZP9LXWaQvSJDuGtCS40a7XblwfQfcbSfwj7dKh2paWpmJCfyha9taljb4U+RV0eGrKj0wT4wn7GXFW4W.dQkW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YSmjzUxMe5qbD7QzUZXVh7qqzIST0qx3lTp+g5GHUr.1Ekonr0r8EBut5+M75KQRgb.6tc8c.yiWuOa0Pl8pWCI2xexWbYFpKkGGPLstOUeH3OKOz3ygNBHdQxC7ruOSa.usYFftHL+cflG2VOtx4+B5n.lO6.OuhG0413im1Mt1ztw0m1M9jociOcZ23yl1M97O9F0etvj9zz8CAuvoyVFhtiyVB8SrLe1.z+BWXWwWC
-
I had the routing all wrong my offline container didn't do what I thought it did so that last snippet was trash. I copied the sidechain2 snippet because it does exactly what I need it to
HiseSnippet 1738.3oc6Y80TabCDWGfbBNPZRZZe1ORll5w2YCFl9PiMFm5.FbroLIOkQbmLV36jtb2Y.mN8g9V+X0OR8aP6p6O1m.avwAnsyTyLLVZWIsZ2e6OsRtkmvj56K7PZKe3PWJRaEbmg7fda2iv3nF0PZOBGP8C3BK55npCcI99TKjl1huVpf1xKgB+7m+XUhMgaRG2EBcjfYR2i4vBF2aqWsKy1tNwhdHyIk1kdUCSAeagsX.XLKhKfbIl8ImP2mHUaALRKyNVr.gWm.BXQHskpJrF1om3bdj9Gw7YGaSkMzQcfIJp65BaKoEK6EscOlsUqjMsOBlkVicAKF4BdNtIyhMp+wthmDJH23Qj1ensfp4snh4om17Jjx7lfIokxjVJxjdJtioGyMXrjnPSCd.0qKAb6oMkHcQZ+AdaAn.OHuCoOstGzXz.VaiBEdYN3eu3G5NfaFvD7bB99h.5A70dQ1eI6xY+0r4trntcmnL4x3IrsodSTrLR6ccCbM9.mioduL2YD6AzQJBaeUeJd59zzgbynccJEE7FbVvAtT9z.BnXWE7setQMR.QFHh6Czyk5EvjlfVM5Y.pNJrrLtF0uefvEv0WIlAnEg0.aRfJDRl2DK.7AJwMYvg6yBFlNu5VCWMql3SwsXAl8lrMtvDrQvScWXiwYiqh2oaWpYvXCbIb82cOj5giV+rwodvZJW7Uhalq96zULh8G3Ti46ZSFVc.XvdR3p1BvVJIa72wiQ9tdTWhG8PQKP+07INt1z1fw+xbGaK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ZBIyzrjI7dnISxpR8LJVzXSci0mdlbVruM4Lpj.6ebtsvajLS7OYv9PU2pV7iGUQanraw5YWQ9lKbZ3UwRbuYwdQ0UcE13awCteD1mYQmPIieSJ1uwp7ky.FyqabevqK7Xmv.L1cBu9sZX3oiNCxaR0ReacTjlh6YD75RqUBHOwTtkpZelXXxhqSoVGSL6eYBu6+RPxhaue0CB6395lMyjOR8lKoT+ZHgeLN9cfnV+qnHynKY8ObMlKG+tE5++CWL8SXTu4cDEdzsUPeIWCO7wxJnqlkG914wGC5iTZFys2vZhu7vHSTJWM+XtfOUEh9Njv29a9dX+6423T1dpuwYhvwuwoCwzS7AynG7U5VdXXO.9lG96lsLDgg14zQmEWT9nGs2gYw9foo5TckAZLuCr37NvRy6.WedG3Fy6.KOuCbyadfxepw32xRlzfPMasSziQnsCmbrczu5.5uAGIxKxB
-
The idea is to take in signal from another instance but not from a sidechain. You can communicate anything really but osc may be a simpler design if you’re just looking to pass around parameters and such. To take in an actual signal block by block interprocess connection is perfect. My plugin already uses osc to communicate with a daemon I run and it also communicates via osc to a networked mixed reality app. I am worried about delay as I haven’t put my named pipe code(I have it in non HISE JUCE app) to use yet but I think the sidechain2 snippet I modeled after is the perfect setup if it will work at all. Any ideas are more than welcome.
-
@jdurnil my issue with OSC in hise is that while you can use it to communicate between different plugins, you cannot communicate between the instances of the same plugin as you have to sort of hard code the ports.
Some sort of crosstalk is definitely a good thing. My current implementation using the HISE API is to write to a file in APPDATA, and for all instances to have a listener timer that checks for new files. If it finds any, it checks for id of the instance to make sure it was sent from another instance, a few other checks as well.
Works pretty well for sending parameter data, you can even create crosstalk groups (using strings) so that only some instances exchange data like this. I just don't know the performance implications of constantly being on the lookout for external json files (except during transport playback).
-
But if you did hard code the ports wouldn’t it work between instances, I read callback does not function for globalrouting in same instance so in theory if you hard coded the ports it should work
-
-
Thank you. I read through the post and it sounds like there is one osc scenario in there that worked for you, I am only concerned with two instances communicating and I have a decision tree that sets one to master and one to slave, any other instances have code that ignores running any code in a callback. If I can have one send port and one receive port and run code according to the instance designation as master or slave it might work for me. I don’t know if not I’ll roll my own with named pipe.
-
@jdurnil yes the master/slave case should work using OSC.
my issue was that I wanted all instances to be able to send as well as receive.
-
@aaronventure you should really look into JUCEs interprocess connnection server, it’s available in juce core in HISE and is easy to use and works really well.
-
@jdurnil I am a JUCE noob so I have no idea how would I do that or implement it into HISE.
-
@aaronventure I am writing some code now that will demonstrate it, it really is quite simple I’d be happy to share it with you when I’m done.
-
@jdurnil if it’s something people want I can ask Christopher if he’d allow me to write it into HISE.
-
@jdurnil auto correct I meant Cristoph
-
@jdurnil Here are the features of my file-based implementation:
"sentBy": instanceId, // checks against this so it doesn't execute its own changes "targetGroup": groupId, // string from a user-facing label, for grouping instances "time": Date.getSystemTimeMs(), // checks against this with the cleanup listener which deletes all files older than x "componentId": componentId, // used by the listener to apply the value to the correct control "value": value, "changeId": generateInstanceId(), // stores this for each component on execution and checks against it, to avoid repeatedly executing the same changes
-
@jdurnil said in Named Pipe idea:
if he’d allow me to write it into HISE.
Possibly it could be added to the snippet browser - or if it's something hardcoded then upstreamed
-
I was thinking it could be added to the scripting api in globalroutingmanager
-
@aaronventure it looks like you have something working for and that was very clever to come up with that, but I do think it would be cleaner with named pipe
-
@jdurnil That would be even better
-
@jdurnil You could give it a shot, but I think it will be more efficient if I'm writing the API wrapper as there is quite a load of glue boilerplate code necessary (also the thread synchronization must fit into the threading model of the HISE scripting engine which is not an easy task for someone that isn't too familiar with the codebase).
Let's talk the API first before I implement this. Would something like this work?
// use the global routing manager for handling named pipes, good idea const var rm = Engine.getGlobalRoutingManager() // Creates a pipe or connects to the existing pipe. mySender is the ID of the instance const var pipe = rm.openNamedPipe("mySender", "myPipe"); // Send a message, can be any seriazable JSON object (primitive values, strings, arrays or JSON objects) pipe.sendMessage([1, 2, 3]); // Receive a message (on another instance pipe.setCallback(function(id, data) { if(id == "mySender") Console.print(trace(data)); }
Once open, the NamedPipe would spawn a thread that polls for new data and calls the function when there is something coming in from another sender ID. From a performance perspective this is certainly less effort than periodically reading a file and check for changes.
-
@Christoph-Hart yes it would, that was pretty much what I was thinking