Ploppz Ploppz - 1 year ago 61
C Question

Alsa snd_mixer_open() 'open mode'

In the documentation for snd_mixer_open, the description for the second parameter

int mode
is: "open mode". But I can't find any further information about which symbolic values to use in the same module. After some searching, I found that in the snd_ctl/control module, there are symbolic values like SND_CTL_NONBLOCK and SND_CTL_ASYNC, and also SND_CTL_READONLY. But I have still no indication which ones are ok to use in the
snd_mixer_open
function! And as these are prefixed with 'SND_CTL' I have the impression they are only meant for functions of the snd_ctl module.

(What I'm generally trying to achieve, is to be able to read the volume level of the master channel of the default sound card.)

Answer Source

From the source in alsa-lib/src/mixer.c:68 the "mode" argument is flagged as unused:

int snd_mixer_open(snd_mixer_t **mixerp, int mode ATTRIBUTE_UNUSED)

and the source of the function bears that out. So it looks like it's safe to use any int there (I'd personally just go with 0).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download