Taking a stab at getting audio API and device info with [pdinfo]:
It is currently difficult to control audio settings programmatically from within a patch. Users might want to do the following: * connect through JACK when they open patchX.pd, and through ALSA or Pulse when running any other patch * instructor might want to increase/decrease latency for demoX.pd on all the students laptops, which may be running different OSes/APIs * probably a lot else
1) Need to be able to query the current audio/midi API being used:
[audioapi( | [pdinfo] | "symbol ALSA"
Or should there be a single "api" method that returns an audio/midi pair like "list ALSA ALSA"?
2) Need to be able to query the available audio/midi APIs:
[listaudioapis( | [pdinfo] | "list OSS ALSA PA JACK ESD dummy"
or on windows you might get
"list MMIO ASIO"
3) Either let the user query the API symbol and get its esoteric api number, for use in the audio-dialog message:
[ALSA( | [pdinfo] | "1"
or change audio-setapi to take A_GIMME and translate a symbolarg to the corresponding number there so that this can be completely hidden from the user. (I'd vote for the latter)
4) Might need to be able to query the available audio devices for the current API. I'm kind of lost on this one. But I suppose all you'd need is:
[listaudioindevices( | [pdinfo] | "list HDA ATI SB (hardware) HDA ATI SB (hardware) HDA ATI HDMI (hardware) HDA ATI HDMI (plug-in)" | [list length] | "4"
AFAICT you can only deal with 4 devices total. The above is not optimal since those symbol-atoms have spaces in them and thus are difficult to [route] or [select].
5) Need to be able to query the current audio-dialog attribute values:
[listaudioparams( | [pdinfo] | "0 1 2 3 4 5 6 7 8 9 10 etc."
6) Need to query an annotated version of the current audio-dialog attribute values. I think it's best to just print them out to the console with newlines:
[printaudioparams(
| [pdinfo]
To the console:
DeviceIn1 0 DeviceIn2 1 DeviceIn3 2 DeviceIn4 3 DeviceIn1-Channels 4 DeviceIn2-Channels 5 DeviceIn3-Channels 6 DeviceIn4-Channels 7 DeviceOut1 0 DeviceOut2 1 DeviceOut3 2 DeviceOut4 3 DeviceOut1-Channels 4 DeviceOut2-Channels 5 DeviceOut3-Channels 6 DeviceOut4-Channels 7 SampleRate 8 AudioAdvance 9 Callback 10 Blocksize etc. 7) Might be handy to have this as well:
[listallaudioapis( | [pdinfo] |
"list MMIO ASIOOSS ALSA PA JACK ESD dummy"
That way you can see what Pd has available by default which may not be available on your own system.
-Jonathan