On 2017-12-13 22:28, Ingo Stock wrote:
You can set the audio settings from within a patch by sending a message to pd.
The message would look like this:
[; pd audio-dialog 0 0 0 0 1 0 0 0 0 0 0 0 2 0 0 0 44100 25 -1 128]
two things:
#1 while not being vanilla, i think the "mediasettings" library is a better approach to that problem (but then of course, i'm the author). it kind of guarantees a stable API on the patch level (the messages you are using are an implementation detail without any guarantees). it also makes it possible to only set the thing you want to (e.g. you can set the latency without resetting the audio device to the built-in speakers). it also allows you to query all the names (and current state) so you can actually build an audio settings dialog within Pd (does not breaking the aesthetics of your application).
#2 more important i'm not sure how your suggestion helps. i mean: if you hand out an application two 5 people (or the whole world), which values would you *actually* put in there? is "0" a good choice, just because it routes to the built-in microphone and speakers on your system? on my PC it might be the unconnected hdmi audio. what if the user wants to play back via the nice PA connected through their USB interface? would they have to re-set the audio settings whenever the patch crashes?
gfamsdr IOhannes