This may just be my misunderstanding something fundamental, but I fell like this should work.
The following code compiles with no problems:
SynthDef(\safety, {|in|
ReplaceOut.ar(0, In.ar(in, 2))});
But this slightly more portable code throws an error:
SynthDef(\safety, {|in|
ReplaceOut.ar(0, In.ar(in, 2))});
with the following gorgeous error:
ERROR: Non Boolean in test.
RECEIVER:
Instance of BinaryOpUGen { (0x1780a0cb8, gc=C8, fmt=00, flg=00, set=04)
instance variables [9]
synthDef : instance of SynthDef (0x131a86ec8, size=16, set=4)
inputs : instance of Array (0x13271f6a8, size=2, set=2)
rate : Symbol 'scalar'
synthIndex : Integer 3
specialIndex : Integer 8
antecedents : nil
descendants : nil
widthFirstAntecedents : nil
operator : Symbol '<'
}
PROTECTED CALL STACK:
Meta_MethodError:new 0x130443080
arg this = MustBeBooleanError
arg what = nil
arg receiver = a BinaryOpUGen
Object:mustBeBoolean 0x120125140
arg this = a BinaryOpUGen
MultiOutUGen:initOutputs 0x130b51f00
arg this = an In
arg numChannels = a NumOutputBuses
arg rate = audio
a FunctionDef 0x1506201a8
sourceCode = "{|in|
ReplaceOut.ar(0, In.ar(in, NumOutputBuses.ir()))}"
arg in = an OutputProxy
SynthDef:buildUgenGraph 0x1318b0580
arg this = a SynthDef
arg func = a Function
arg rates = nil
arg prependArgs = [ ]
var result = nil
var saveControlNames = nil
a FunctionDef 0x1318aeb00
sourceCode = "<an open Function>"
Function:prTry 0x130747680
arg this = a Function
var result = nil
var thread = a Thread
var next = nil
var wasInProtectedFunc = false
CALL STACK:
MethodError:reportError
arg this = <instance of MustBeBooleanError>
Nil:handleError
arg this = nil
arg error = <instance of MustBeBooleanError>
Thread:handleError
arg this = <instance of Thread>
arg error = <instance of MustBeBooleanError>
Object:throw
arg this = <instance of MustBeBooleanError>
Function:protect
arg this = <instance of Function>
arg handler = <instance of Function>
var result = <instance of MustBeBooleanError>
SynthDef:build
arg this = <instance of SynthDef>
arg ugenGraphFunc = <instance of Function>
arg rates = nil
arg prependArgs = nil
Interpreter:interpretPrintCmdLine
arg this = <instance of Interpreter>
var res = nil
var func = <instance of Function>
var code = "SynthDef(\safety, {|in|
Rep..."
var doc = nil
var ideClass = <instance of Meta_ScIDE>
Process:interpretPrintCmdLine
arg this = <instance of Main>
^^ The preceding error dump is for ERROR: Non Boolean in test.
RECEIVER: a BinaryOpUGen
Is this a bug that I should raise on the github, or have I just misunderstood something?
As far as I can tell this is something about the second input for In.ar where it only accepts values.