And for a DSP with 0 input, 1 audio output and 1 control output, the generated sc file is now:
FaustOsc : MultiOutUGen
{
*ar { | gain(0.0), freq(1000.0) |
^this.multiNew('audio', gain, freq)
}
*kr { | gain(0.0), freq(1000.0) |
^this.multiNew('control', gain, freq)
}
init { | ... theInputs |
inputs = theInputs
^this.initOutputs(2, rate)
}
name { ^"FaustOsc" }
info { ^"Generated with Faust" }
}
But the generated audio output is distorted, as soon at the control output is also written, with the OUT0(curControl) = unit->getOutputControl(i)->updateOutput(); or fillBuffer(OUT(curControl), inNumSamples, unit->getOutputControl(i)->updateOutput());
You’re right - you can know the block size when you construct the SynthDef in sclang, but when the synthdef file is deserialized from disk it may be in the context of a server with a different block size, so it would no longer be valid. Probably this could be made to work, except cached synthdefs would be invalid if you booted the server with a different block size, which is obviously not good. The alternative here would be to use a LocalBuf I guess - this would give you a fixed size buffer into which you could pack/unpack values.