[Csnd-dev] Signal via API to host
Date | 2017-05-03 14:02 |
From | Tarmo Johannes |
Subject | [Csnd-dev] Signal via API to host |
Hi, What is a good way to send a signal about an event from Csound via API to host program?Websockets intoduce a new dependency.... |
Date | 2017-05-03 14:27 |
From | Michael Gogins |
Subject | Re: [Csnd-dev] Signal via API to host |
Did you try csoundSetOutputChannelCallback? It takes a "C" function pointer that will be called whenever the Csound orchestra executes the outvalue opcode. But probably this is what you were talking about regarding "values in channels". Keep in mind, some code somewhere has to be checking values, so pushing the checking down into Csound will not save much time though it would simplify the code. If csoundSetOutputChannelCallback is not sufficient, perhaps we should add another callback, call it csoundSetGlobalVariablelCallback. This would be called when and only when the value of a global variable changes. Or, which would amount to much the same thing, we could add a variant of csoundSetOutputChannelCallback that would apply only to one named channel and only fire when the value of the channel changes. Best, Mike ----------------------------------------------------- Michael Gogins Irreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Wed, May 3, 2017 at 9:02 AM, Tarmo Johannes |
Date | 2017-05-03 16:36 |
From | Tarmo Johannes |
Subject | Re: [Csnd-dev] Signal via API to host |
Thank you, Mike! The only small problem is that outvalue is run also on init-time regardless of the k-rate conditions. It is definitely possibl to overcome in the host's code but would be nice to have a way to tell from csound code to host "do something now ". Maybe there is another way alreadycsoundSetOutputChannelCallback and outvalue could do the trick - I used chnset before and I did not realize that option. instr 1 if (metro(1)==1) then kvalue timeinsts outvalue "test",kvalue endif endin And ouput from host callback function:
"test" 0 // <--- this is init time "test" 0.000725624 // <- and this first firing from metro "test" 1.00136 "test" 2.00127 Similar result with string channels. Anyway - good idea and helps further! tarmo 2017-05-03 16:27 GMT+03:00 Michael Gogins <michael.gogins@gmail.com>: Did you try csoundSetOutputChannelCallback |