-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add that to UGen methods #7
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
+ UGen { | ||
that { | callback, trigger | | ||
var oscAddress = "/that/ugen/%/%".format(synthDef, synthIndex); | ||
oscAddress.postln; | ||
callback = callback ? {}; | ||
trigger = trigger ? Impulse.kr(10.0); | ||
SendReply.perform( | ||
UGen.methodSelectorForRate(trigger.rate), | ||
trigger, // trig | ||
oscAddress, // cmdName | ||
this, // values | ||
); | ||
|
||
OSCdef(key: oscAddress, func: { |msg| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternatively, the https://github.com/supercollider-quarks/Sequencer implementation could be taken and just reformulated a little. |
||
var nodeId, replyId, values; | ||
#nodeId, replyId ... values = msg[1..]; | ||
callback.(values, nodeId); | ||
}, path: oscAddress).fix; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
synthDef
will only adda SynthDef
. You want some kind of ID, right? But one SynthDef can have many synths. .Why not get theNodeID.ir
?