Bind variable to channel?

Hey all,

Was just curious if there is an efficient way to bind a variable to a channel so it automatically updates on change or if this has to be explicitly handled via checking with opcodes like changed and changed2


There is chn_export that binds global variable to named channel. Very useful.


T, 2. jaanuar 2024 07:52 lo94 via The Csound Community <> kirjutas:

Oh very cool! Does that opcode run on initialization pass and will it run if placed inside an instrument?

Also, if you happen to know, is chnexport what Cabbage uses for its widgets to bind to channels?


I tried on Cabbage, yes input from the widget works, displaying value from the global value did not (maybe I did something wrong). Here is a minimal example: