Connecting broadcasters query
-
I have two broadcasters, they have one argument, state, which is either true or false. The two broadcasters are never true at the same time.
When either of these broadcasters is true I want to enable a knob on the UI. However the issue I'm running into using two separate listeners is that they cancel each other.
Is there a way I can say if this one is true, or this one is true, then enable the knob?
Here's a simplified example (I'm using buttons to trigger the broadcasters in this demo but that is not how my real project is setup - otherwise I'd just use control callbacks, it's just for demonstration purposes).
HiseSnippet 1047.3ocyV0kaabCDlqsW2Z01f5hb.HzSJEFNZW+eBJhpjkSERriPkiQAJZCnH4ZQncIEVx00JFFnOzCROA8JzyRuA8FzNj6ZoU1F9GATfpGD1gy7M7iyvYF1MUQ4ZsJE4U43wi3HuO2u2XoYPqADgD0Yej2p98SUDFknM7zi4ZCp43QDslyPddK9ZqYdqrDx86ueUSRLQR4SWBgNQIn72JRDloq1swaDwwGPX7iEIkrdyFcnJYKUrJCnzh90QiHzgjS4GQrlsfO56H5AHuu1OLpOMLZmM1MXuf81Yy8BB1Z29aVOjx1ZuM1X6MXQg6R1dW.zxsYBiJsmgX3ZvoMUrw8Fn9EY9FbhPK5GysBAndvNmuLp0.QLq6UwGMB4sT2oQqEyiVO0+PASLY8oQsuzo.OEQ4fl2B2EkBdDTxqDkVJmRq52ilJFYlpwxmOyuiDxeQDH2TlJ41hVn+h9sTfERy5Ijg7CRAgIHpsc85qgg+d1KqT44OG2b5EBbPEHgoM39zlYFiRFbBINii+Fba4oBIecZJGNjkPT6BA6E3pyZe00vjzS0u.+iUopjQJIPDXspm4T9SWBa7r.VmXLD5fiUstxb2x0pVXjEbUKcuNLFaBBHBMhmZF+VAvKIvrpuQp56fxkDHAvre118I1LfiGBpw8IPnCqj39N+h01jHXXTljZDJYMgjwOeM7jywZX2o3YUtnxJobSVpLegWV4xaIdFds3Y3iLdF9XimgOj3Y3Mhmg+eMddENvkGoL72Iq4rrxkUvWWUTzspyVHjphigSvso11wJ8t.VSlkzmmVlmVCgJzYK6W9gU1SyqKKYnR1QJLuaDuP9.ULyVNa+9lMIPEE1vWuuy9DCw12nXshTlvRGu84mAcpy6hrh+9b8PiZD30IIXj2SLNsOonGSuXAimhDvd+I9tjM57oMykMFOQ3WIMzlw1C2xNCQIBFKl2UoE1fWoQH+Ib4YTOwGcSEt3o+wq+qO9auJo7TFDJgbd4gN5rnHw4twCQh3DsA3VmDXpAx6q7euliY7HRVrAqGB9IVHGxYGqb1qImw6H6lx0biseXwE0xaFpz42e1yedof67uheQelxQfetTD32MMt9l837bXIO2H6d77MmK.SjTrrXhY1wT1A3EJr4gxyFr8+kP9Yb4X8iX1U86b10Ckhq52UXnCtcNtvsvQ358+EbrXh+W32NJhSMSI3R9G7Cy6386Y6+dUlQHO8PBbiFR99GkkzCdYDkC6tTxiAm66sf8JZtbcqrMBziKYNg+A9UnLvJ6UnL3JkPsDMU8AZdqK6aJ9T2J.mjt2bsh+gVYb.x0NalxP3INefRm0U2.X37Bbi4E3lyKvslWfaOu.2YdAt68Cz9BzuMynRxKaPnC6110+2yq8Us4fVE+aXK+lk
-
@d-healey I'm on my phone so I can't look at the snippet, but can't you write their state to an external variable (array) , and in the listener callback just check for the states in the array.
That way it doesn't matter which one executed first, it'll only enable the knob if either is true.
-
@aaronventure Oh that's a good idea, yes it works.
HiseSnippet 1007.3ocyV0taZcCF1mP7Zg8gVj1EfE+hNEkx4P9fzppxfP1PsIEMxhlTTZkwGSvJGrQ19jUZUk1O1ExtL1sytC1cv1qOmCvABcsAsJM9A532Oe7iser6pULtwnzHuRmMYLG48E3dSj1gsFRERTmiPdag6qUzPF0X45y3FKp4jwTigGh77J78tv7JtIJ42e8zlzHpjwmaBgNWIX7mKFIrys1swyDQQGSC4mIFkK5cazgojsTQpX.REvUQiorqoWwOk5BaCL5GnlgHuuEGLnOKXvA0p6en+gGr6g996Uu+tUCXg6cXsZ6WKbPPc590gj9r1gBqR2yRsbCxaylpvI8Fp9EYZCNWXD8i3tA9ndPmSMerJJzMEcVQsFJhB6NkqLHnJcmybERYtuAehHTLy9bF7qSbPlmQdBzaiEgWgEfmed3UMG7VAj7xAoMSgzV3dLsXrctGGd9bbGIrVNfBqS4gRZrnM9iB3VJHBocmQzq4GqgAyxnx9UqtMA96AOtTIXsxXI2Pih4FxSHWbIX6gOjzb9FFheVP8YMisVkz+bWzPvskWIj7cXZNLwykQk2JBeDo7hwWdaBUek4QjKJyTiFqj.3.akSZc4KeG.lESXGp0RYCOS0ZZ3IlqTNKHWxkcSgkSKLbVF.qMlqsSdt.vkDPV4mIU8SRkKovhRn6y1IeRrC4jqA2j9TfNIJIoeRcIF2BKD3fXIyJTxJBYH+0aSlMO1Nk.ePo2VpXJUdQ0KABJ46GWpnlai0xLVdGfMsvFKSEe.8t48xDdvRDdvcjvCtqDdvGCgGbKBO3+SDt+cgvmVXnmmpr7WHqjTpRuqDYYWCFrRetiWZUTDLEWkamln9eKwJx3Q8457SDWfv49EESvuewj7ZcrzS64BTI6HE1WLlKeeJfnLIB3qepyQTK0o.kYKacT3ff2Q7a.8+T8nh3i3lqspwPUmspi7tmMw6WkoV0KRDx0HAHJcObxN.zqmeEgrwjYC9UZCXmx3dh2L8NjF+4a9smZn2v6H6p4Ft0Irks4w8IJWawK11zskIssHNSTHeieYtF+61FK2j6VkCxU4FwefJeagc3JEUXbD0t38Ltaiyb.6WVPb2IfKMB6j72V+e1kOerPbKbWgkMb0XbiUfQXW0mBLlck8WhaOX.mYmCvMwG+yeZteF8ipXqPd0ITqV.K93SiG0CdlCiCcWJ4Qtyqda3NYkNtpariA5wkgIC9a3WlSe2XuLm9SchFQYZ0qXopDtGEb+DK.ljIOfpH9D2XhOJQ4HOOOBdixqXrEK0sRLXcSr15l3tqah6stIt+5l3Aqah0+vI5dB42EaUiRO1fPmzschrqmW6bxa+Cv8Ho8M
I was thinking there might be a method built into the broadcaster system for handling this type of situation, but I'll use your solution if there isn't.
-
@d-healey When is the broadcast video coming? :)
-
@d-healey in case you're also setting the button to false, there could be a case where the condition says false in the second listener (because the execution order is fixed), in which case you should also write Engine.getUptime to the third element and check against it in in the condition (say 100ms). That way if the button was set to true less than 100ms ago (first listener passed the check) the second won't flip it back just because it was the second to execute.
As for there being a native solution, I don't think so: the broadcasters don't really have a state, they're just a collection of functions with the same constructor.
-
@orange said in Connecting broadcasters query:
@d-healey When is the broadcast video coming? :)
I posted one to Patreon a week ago, it has had 1 view
-
@d-healey said in Connecting broadcasters query:
@orange said in Connecting broadcasters query:
@d-healey When is the broadcast video coming? :)
I posted one to Patreon a week ago:
Really? I think this is: "Resetting a SliderPack with a Mouse Click Broadcaster". Thanks I'll check that.
it has had 1 view
Maybe because Sliderpack is not something that is used a lot.
Maybe things that will be used more might get more attention. Connecting parameters, eq..etc.
-
@orange said in Connecting broadcasters query:
Maybe things that will be used more might get more attention. Connecting parameters, eq..etc
I covered some of the new EQ broadcasters I added in a video last month - it's not a proper tutorial though.
I also did this last year.
-
@d-healey That was probably me. lol. Lone watcher. haha.
-
@d-healey That's the vid that got me started on broadcasters, and I'm very appreciative of it! So thanks!