How to debug control not linking in exported plugin?
-
When I export my project, a control in my realtime script that should be controlling a knob in the deferred script, isn't. The behavior is the same whether I use the linkedTo field or a callback. I thought maybe the reference to the other script was ending up undefined on init, so I tried getting the reference in the callback, but with the same result.
inline function oncurrentPhraseControl(component, value) { local Interface = Synth.getMidiProcessor("Interface"); Interface.setAttribute(Interface.currentPhraseKnob,value); };
I'll try building a minimal project that replicates the issue but maybe somebody ran into this before? It always works fine in HISE, it is only unlinked in exports on all three OSs.
-
@Simon Not sure why it's not working, but getting references dynamically at run time like that is bad practice. Try storing the reference in a const in on init. I think though there is probably a better way overall to structure the intercommunication between your modules.
-
@d-healey It behaved the same when it was in a constant. Is there another way besides using a global variable or linking controls together with a callback?
-
@Simon said in How to debug control not linking in exported plugin?:
Is there another way
It depends on what the goal is, but I think it's a structural issue. Without knowing more about your project it's hard to give specific advice. Can you send me your project or tell me more about what this element's purpose is?
-
It's for keyswitching. In the realtime script, on note, if a note is in the KS range, it updates a knob. That knob is linked to a knob in the deferred UI script, so it can update the key colors on screen. That's it really. The keyswitching is working, because I can hear the articulation change, it's just the linking part that doesn't work.
It's tricky to debug as it only happens in a compiled vst or standalone. I'll probably try Christoph's logger next: https://forum.hise.audio//post/26752
-
@Simon I understand now. This is how you do it.
Your real time script does the keyswitching (changing articulation). In your UI you have another script that also picks up the keyswitches and updates the UI. The two scripts don't need to communicate.
-
@Simon Here's a snippet that demonstrates it, the keyswitches are 24 and 25.
HiseSnippet 1662.3oc6ZstaSbDEd1jroXCkBHpfetD0eroDErcBIDQQDxMHBLwJN.UBgPi2c13Qd2YVsyrowsBo9pzmj1Gg9HzGAdCZOydwdWGiwwwDHzDEEk4Lma64Ly46acRs.tEQH3AHsh601mfztjd81LYy0ahoLz1afztrdUrPRBLhEsVaerPPrQZZS9Xk.sBSgh958ObMrKlYQ5JBgdImZQdF0iJ6Js1pOk55tE1lrG0Ki1Kt51Vb15bWdHjOSpWB4isZg2m7brRsIzQOAKZhz9Q8R2cIBY4EbrswKr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oFEG4MOPwqIkhzwg1wQTMtbYGE+2UnvWfrRzGWrRNwLQ5AtNgFhtllZT6IlBRwgMtGphoJjsS+EgrspfLst5RO5CwB48+YWVHcQXDgNNzCidSHGpqm.Ns6usGbVCocM8WHHF.wbbnqzPzBFlC20ZQr2iGo+47U9ZiuxMhC+E0eE9.RDtTBboZML7zy3wDfyhp1MHdK+83m2xNVRHE1K.yD9bAobVOWm3Q2CtEIxIsGKpzWKxIcChLjk20whxokpTrETJxn2EVMUXkrBqgY4bFrNmmpROL66HrICCMr5D3I2dGgETXT04rWKpE5JHuhZKaVNqgcEWIq3mfCrgdnUtCs8P+apga3Z96uYz+rGuvISOh2gPVBi7NqyexdvDlOFezJY.al3CA1DSoHYneVVF84cdGBe7c5vn85xPqVJfbQuNAcVXBdtlWgzbrN0y2krI6.hKfxFkiWCfUiPpRkluOVky39M4LZt6C6R.7t8Uj+yj688AB3ABjd6J45qtKwkfEYpm+vpOCnhhCf5DYDqEG+Oct91utodb5ZnFqZb1E4cx+2f7N3ae.RwW1cwanCHVULhZkFed5k6xCkT19UwvMZEEY3EqpCzGrHpWumQbUuJg1Dp4vwqKkxdtNgYGs3eguR1rbJud0lkS2bDoJU4bpRcDdk9QU5lmSU5rIUoJmAnJk3tyoJM.pRUNmpzImpzTCWe6i7GG6zi1zXOeGcJTmpktSNcpS0zcrQsZ7j0mFzr9ZIFdXq.9ashQeTCktPjDn1xh9uOofdU0ZixGEtwCfXeqkUdWcDCqLpFtvnZ3hipg2cTMboQ0vkGUCu2G2PECnGEJ4dI+k6QUqsYzm+ulVL2znqkn+CfV1fAi
-
@d-healey yup this is the way. Put the key switching stuff into functions and into an external script, then include it in both the interface and real-time processors, so you only have to maintain one version of it.
-
Despite separating the two scripts as much as possible, I've run into the need to get an integer from the realtime audio script into the deferred interface script.
Trying to use a global here causes a race condition where sometimes the value gets updated before, sometimes after.
This time I created a panel in the interface script, and set its value with Interface.SetAttribute(Interface.storagePanel,value)
It works in an exported plugin, but I'm not sure why!
-
@Simon said in How to debug control not linking in exported plugin?:
Despite separating the two scripts as much as possible, I've run into the need to get an integer from the realtime audio script into the deferred interface script.
If you want I can take a look at your project and see if I can suggest an alternative approach.
-
@d-healey I appreciate it, but I already know the alternate approach is re-implementing a bunch of legato logic in both scripts. I understand that's the "correct" way to do it, but if the panel method works I just can't justify the additional code and time spent.
Is there a reason this separation is so insisted upon? The integer in question must be kept track of in the audio thread anyway. Is the performance overhead from setting panel data really higher than running the legato logic twice? Maybe there's a potential for catastrophic failure I'm not seeing?
-
@Simon said in How to debug control not linking in exported plugin?:
Is there a reason this separation is so insisted upon?
I think it's just good practice in general with most programming systems to modularize and separate functionality from form. This is why a lot of programs are separated into backend components and frontend components, and you can have multiple GUIs for the same programs because the backend logic doesn't have to change.
-
I'll suggest something (David, cover your eye) :
Create a broadcaster in your interface script for the sole purpose of writing these variables, but create it into a global.
Add the functions (reading the global variable from your realtime script), then just trigger the broadcaster in your realtime script.
That way you bypass midi execution order.
-
@aaronventure said in How to debug control not linking in exported plugin?:
I'll suggest something (David, cover your eye) :
thats just cruel..... funny, but cruel.
-
@aaronventure said in How to debug control not linking in exported plugin?:
Create a broadcaster in your interface script for the sole purpose of writing these variables, but create it into a global.
I thought that might be a good use for globals too but it doesn't work - https://forum.hise.audio/topic/9746/broadcasters-best-practices/42?_=1736095809561
@Christoph-Hart said in Broadcasters best practices:
yes, don‘t. The global variable system breaks apart as soon as you are calling functions from other script processors as it was designed for data sharing across modules. Treat the option that you can slap a broadcaster to a global variable and react to events from another module as an easter egg functionality but I absolutely cannot guarantee that it will work 100%.
There is an
attachToModuleParameter
broadcaster which might do it, but it also doesn't seem to work at the moment - this one's a bug though whereas a global broadcaster is not intended to work. -
@d-healey Dammit, I felt so smart for a second there. Totally forgot about that thread, I don't recall reading Chris' reply there so that's good to know, thanks. I should probably check whether I actually did that anywhere...