No audio input when using sclang command line

I’m using sclang embedded in my own software, but cannot get any audio input to the server. I am running a simple echo to test:

~synth0=SynthDef("SD0", {Out.ar(0, In.ar(bus: 2))} ).play;

Audio output works fine, as does audio input using the SC IDE. I can see all my devices via

ServerOptions.devices

Any ideas anyone?
Thanks

Are you taking input from a mic? You need to use SoundIn:

~synth0=SynthDef("SD0", {Out.ar(0, SoundIn.ar(0))} ).play;

Yes, I’ve tried SoundIn too, but no joy. What I don’t understand is that it works fine in the IDE, just not when I run sclang from the command line.

but you can make sound?

~synth0=SynthDef("SD0", {Out.ar(0, SinOsc.ar(200, 0, 0.1))} ).play;

yes, audio output works fine