Setting an Inteface value from container
-
Why don't you put that code in your main interface script?
Think you edited the post after I posted or I didn't read your post properly :p
Yes the on note in the main interface does fire.
HiseSnippet 652.3ocsUssaSCCF1tsdhVNHlDO.Q6pNowTJrMPZWvX8.pBVWEYLwcSdNtqVywNxwYPEhWSdN3M.9cR1RKjMsfD9p7e3K4ye+GxTilwSRzFDt8IKh4H7iHAKT148mSEJz3AH7SHGQSrbiWtqCWDSSR3gHLt46bNvsagxN+7MGRkTEiW5BgNUKX7OHhD1RuSO38BobDMjehHZor24fwLspuVpSA9zj3ihorKoWvmPco0ffvqMLTX0l.K0xSfbNTGtHXt9Kp77OUjHNWxcF8PAvKJ2Mp+bgLb5020DDB2ZZ4MuY9M+YjiDgha7Wp.OMKfWIhk0.biUoTqUnTuaiRizxP2K3VnGdI50JmdqSBXFQrsLhiaOjLVAEmYTP1WlV44hv+fzWCInraGQujOx.F2.n6d99a4squ+l6OKUwrBsxSqlns7iUc2ry25z1CN.9DsjucrQnrc2XNWJ0ar49c9dm+DzrY4nVMj66azRI2TUTWGf4Nf0UkFcN2rk2UTYJ+57.QYUUes6mpyx0hkRTqFqD1ii4E1k0kdUTWPEhI7zmFOfZotRUgOHuXtwJbzAOfeEz2mW3ZSFvStzpigN++ppB8V5vTI0tZCmaxpH.HGqTYckOUhvtX4IuZzE5WYWXk216IcWmLUXYyqluMpfufp8+luEyzOlLb1LNyVR1VjQe9ec.tFT4i5TqPcwQTqQ7UDlLIMJ.Vqw3.STJtD9PDbCWGUtsuy1oLAbUXlwufSQvdNabQvdWGDEQYF8Yr7AE2ViGj4A3jJagYaXyMX60CkM7jy6HXU1YLlSHdNv7pQ7hZi3k0FwN0Fwt0Fwd0FwqpMhWeGHb+23soVcT9XA3X5vr0FX7PEE5px5.Q+FLEdAMB
-
Wow this is SOOO frustrating - now the on note is firing in the main interface,....but I had to reload the entire project to make it do it.
-
@d-healey thanks anyway.
-
In all my projects I defer the callbacks in the interface script and do all real-time stuff in sub scripts. I was working on a project yesterday that used key switching, which is obviously real-time, so I put it in a sub-script. However I wanted the keyswitch to update the GUI.
My solution was to have a global variable called
articulationID
and whenever a keyswitch was pressed the sub-script would update this variable with a number that referenced the selected articulation. In the interface script'sonNote
callback I put a simple check to see if the value of the global variable had changed and if it has I update the GUI appropriately. -
@d-healey Yes I'm begining to think Globals are the way to go for a lot of things...
-
@Lindon Not necessarily. I generally try to avoid them because it can make scripts trickier to debug and maintain at a later date.
My keyswitches for example work by enabling/disabling samplers using MIDI muters so instead of using a global variable I could have checked the state of the muters. But for this particular use case I applied a kind of Occam's razor approach and decided a global was right.
-
@d-healey yes I think there are cases (and I have one) where this is the way to go... now I've tried this but I cant seem to get my container to recognise my Global variable, here's what I've done:
in my Interface on Init I said:
var triggerNote;
in my control call back I say:
inline function onArticulations_TRIGGER_ELECTRICControl(component, value) { triggerNote = -99; Console.print("set up:" + triggerNote); };
and this prints to the Console nicely...
in my containers on note call back I say:
function onNoteOn() { Console.print(triggerNote); }
and I get this error message:
Script Processor_TRIGGER:! onNoteOn() - Line 3, column 15: API call with undefined parameter 0
- so triggerNote is undefined for my on note container call back - how do I reference globals then?
Do I need to referece my Interface script somehow? Im mystifid as usual. How can something as simple as global variables be this hard?
-
D*mn it! I hate people who ask questions without first searching the forum...
FR: Global variables scripting API
If a function references a variable from a script that was deleted, then surely you just throw an error "variable is undefined" What would the code look like...
Forum (forum.hise.audio)
Still, yet another undocumented feature...to add to Christoph's list
-
@Lindon I think it is documented in the blog posts
-
@d-healey yeah because blog-posts = documentation