I think I know the answer to this, but asking in case I’m not seeing something.
Basically, I would like to specify a function like
{ |out|
var sig = In.ar(out, 2);
NHHall.ar(sig, 10);
}
which could also have other control arguments, and wrap it in a ReplaceOut… but when I do like:
(
var func = { |out|
var sig = In.ar(out, 2);
NHHall.ar(sig, 10);
};
SynthDef(\test, { |out|
var sig = SynthDef.wrap(func);
ReplaceOut.ar(out, sig);
}).add;
)
I get warned because both levels need access to the out parameter.
WARNING: Could not build msgFunc for this SynthDesc: duplicate control name out
Your synthdef has been saved in the library and loaded on the server, if running.
Use of this synth in Patterns will not detect argument names automatically because of the duplicate name(s).
I have solved this temporarily using an Environment:
Environment.new.use {
SynthDef(\test, { |out|
~out = out;
...
and then I can use ~out in my function. But this requires the user (= me in 10 years) to know that they need to in this one instance use ~out instead of |out| for the control. So still I wonder: Is there any way to collapse these |out|s?