Detect number of channels of soundcard device?

I feel like I’m missing something very basic here, I want to get the number of (hardware) channels available from my soundcard, before booting the server.

ServerOptions.outDevices[0];
returns:
Built-in Output

and

ServerOptions.outDevices[0].numChannels;
returns:
1
When it should return 2, or am I mistaken?

Booting the server posts this:

"Built-in Output" Output Device
   Streams: 1
      0  channels 2

So the correct number of channels (2) is stored somewhere but where can I access this?

I have the same question. I’m trying to make a dialog box for ordinary users to select their sound devices.

The device list in the language (ServerOptions.devices) unfortunately doesn’t return the number of channels.

It’s misleading because every object in SC has a numChannels, which is assumed to be 1 unless overridden somewhere.

String.findRespondingMethodFor(\numChannels)
-> Object:numChannels

// which is implemented as
	numChannels { ^1 }

The server-side code to read the audio device list is different from the language-side code.

It would be a good feature request, to have ServerOptions.devices give back objects with device properties, rather than just strings (but this would break existing user code).

The only workaround I can think of is to run scsynth in unixCmdGetStdOut and parse the text result.

hjh

1 Like

Thank you for the clarification James!

I have made a feature request here, with my limited knowledge.

Feel free to add to it, correct or if anything is missing. I always feel kinda weary writing anything on github. That’s like, where the adults are! :flushed: