Conversation
| @@ -0,0 +1,20 @@ | |||
| + UGen { | |||
| that { | callback, trigger | | |||
| var oscAddress = "/that/ugen/%/%".format(synthDef, synthIndex); | |||
There was a problem hiding this comment.
synthDef will only add a SynthDef. You want some kind of ID, right? But one SynthDef can have many synths. .Why not get the NodeID.ir?
| this, // values | ||
| ); | ||
|
|
||
| OSCdef(key: oscAddress, func: { |msg| |
There was a problem hiding this comment.
when the synth ends, you'll want the OSCdef to be released, otherwise you have memory leak. This is not easy to solve, because you are now inside of the build phase of the SynthDef.
Not sure yet what is best to do.
There was a problem hiding this comment.
The problem is that we can only add methods but no variables to an existing class, so we can not create a state within sclang, but maybe we can trick the server on giving us a clue if something is freed, like a Trigger? I couldnt find something., but if it exists we could use this trigger for a SendReply which then could initiate a deletion of a given OSCdef.
On the other hand: the expected memory leak is not nice but I would accept it for convenience if documented - you'd need to modify an existing Ndef thousands of times in order to create a significant memory usage.
There was a problem hiding this comment.
No, I think it isn't that hard. The OSCfunc should be general, not UGen specific, and only after receiving a message it can decide what to do with it. This needs to be put somewhere, e.g. in a class variable of That. Then you also need a way to register the different Synths that run and their that-UGens, and using NodeWatcher and SimpleController you can register actions that remove the synths. But it is also possible to just say that after a certain time having received no message, the function is removed by some global task that checks. I am not so much in favour of MVC, so the latter seems also a good solution (although there may be reasons you want to have a long grace time?).
There was a problem hiding this comment.
Alternatively, the https://github.com/supercollider-quarks/Sequencer implementation could be taken and just reformulated a little.
closes #6