mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:05:42 +01:00
Added mode argument to open functions where it was missing. First part of CTL documentation
This commit is contained in:
parent
91945c8692
commit
f8ab746deb
4 changed files with 15 additions and 15 deletions
|
@ -425,7 +425,7 @@ static int get_controls(int cardno, snd_config_t *top)
|
||||||
snd_ctl_elem_list_alloca(&list);
|
snd_ctl_elem_list_alloca(&list);
|
||||||
|
|
||||||
sprintf(name, "hw:%d", cardno);
|
sprintf(name, "hw:%d", cardno);
|
||||||
err = snd_ctl_open(&handle, name);
|
err = snd_ctl_open(&handle, name, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
error("snd_ctl_open error: %s", snd_strerror(err));
|
error("snd_ctl_open error: %s", snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
|
@ -878,7 +878,7 @@ static int set_controls(int card, snd_config_t *top)
|
||||||
snd_ctl_card_info_alloca(&info);
|
snd_ctl_card_info_alloca(&info);
|
||||||
|
|
||||||
sprintf(name, "hw:%d", card);
|
sprintf(name, "hw:%d", card);
|
||||||
err = snd_ctl_open(&handle, name);
|
err = snd_ctl_open(&handle, name, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
error("snd_ctl_open error: %s", snd_strerror(err));
|
error("snd_ctl_open error: %s", snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -1252,14 +1252,14 @@ mixer_init (void)
|
||||||
int err;
|
int err;
|
||||||
snd_ctl_card_info_alloca(&hw_info);
|
snd_ctl_card_info_alloca(&hw_info);
|
||||||
|
|
||||||
if ((err = snd_ctl_open (&ctl_handle, card_id)) < 0)
|
if ((err = snd_ctl_open (&ctl_handle, card_id, 0)) < 0)
|
||||||
mixer_abort (ERR_OPEN, "snd_ctl_open", err);
|
mixer_abort (ERR_OPEN, "snd_ctl_open", err);
|
||||||
if ((err = snd_ctl_card_info (ctl_handle, hw_info)) < 0)
|
if ((err = snd_ctl_card_info (ctl_handle, hw_info)) < 0)
|
||||||
mixer_abort (ERR_FCN, "snd_ctl_card_info", err);
|
mixer_abort (ERR_FCN, "snd_ctl_card_info", err);
|
||||||
snd_ctl_close (ctl_handle);
|
snd_ctl_close (ctl_handle);
|
||||||
/* open mixer device
|
/* open mixer device
|
||||||
*/
|
*/
|
||||||
if ((err = snd_mixer_open (&mixer_handle)) < 0)
|
if ((err = snd_mixer_open (&mixer_handle, 0)) < 0)
|
||||||
mixer_abort (ERR_FCN, "snd_mixer_open", err);
|
mixer_abort (ERR_FCN, "snd_mixer_open", err);
|
||||||
if ((err = snd_mixer_attach (mixer_handle, card_id)) < 0)
|
if ((err = snd_mixer_attach (mixer_handle, card_id)) < 0)
|
||||||
mixer_abort (ERR_FCN, "snd_mixer_attach", err);
|
mixer_abort (ERR_FCN, "snd_mixer_attach", err);
|
||||||
|
|
|
@ -82,7 +82,7 @@ static int info(void)
|
||||||
snd_ctl_card_info_alloca(&info);
|
snd_ctl_card_info_alloca(&info);
|
||||||
snd_ctl_elem_list_alloca(&clist);
|
snd_ctl_elem_list_alloca(&clist);
|
||||||
|
|
||||||
if ((err = snd_ctl_open(&handle, card)) < 0) {
|
if ((err = snd_ctl_open(&handle, card, 0)) < 0) {
|
||||||
error("Control device %i open error: %s", card, snd_strerror(err));
|
error("Control device %i open error: %s", card, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ static int info(void)
|
||||||
printf(" Controls : %i\n", snd_ctl_elem_list_get_count(clist));
|
printf(" Controls : %i\n", snd_ctl_elem_list_get_count(clist));
|
||||||
}
|
}
|
||||||
snd_ctl_close(handle);
|
snd_ctl_close(handle);
|
||||||
if ((err = snd_mixer_open(&mhandle)) < 0) {
|
if ((err = snd_mixer_open(&mhandle, 0)) < 0) {
|
||||||
error("Mixer open error: %s", snd_strerror(err));
|
error("Mixer open error: %s", snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ static int controls(int level)
|
||||||
snd_ctl_elem_id_t *id;
|
snd_ctl_elem_id_t *id;
|
||||||
snd_ctl_elem_id_alloca(&id);
|
snd_ctl_elem_id_alloca(&id);
|
||||||
|
|
||||||
if ((err = snd_hctl_open(&handle, card)) < 0) {
|
if ((err = snd_hctl_open(&handle, card, 0)) < 0) {
|
||||||
error("Control %s open error: %s", card, snd_strerror(err));
|
error("Control %s open error: %s", card, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ static int selems(int level)
|
||||||
snd_mixer_elem_t *elem;
|
snd_mixer_elem_t *elem;
|
||||||
snd_mixer_selem_id_alloca(&sid);
|
snd_mixer_selem_id_alloca(&sid);
|
||||||
|
|
||||||
if ((err = snd_mixer_open(&handle)) < 0) {
|
if ((err = snd_mixer_open(&handle, 0)) < 0) {
|
||||||
error("Mixer %s open error: %s", card, snd_strerror(err));
|
error("Mixer %s open error: %s", card, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -759,7 +759,7 @@ static int cset(int argc, char *argv[], int roflag)
|
||||||
show_control_id(id);
|
show_control_id(id);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
if ((err = snd_ctl_open(&handle, card)) < 0) {
|
if ((err = snd_ctl_open(&handle, card, 0)) < 0) {
|
||||||
error("Control %s open error: %s\n", card, snd_strerror(err));
|
error("Control %s open error: %s\n", card, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -823,7 +823,7 @@ static int cset(int argc, char *argv[], int roflag)
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
snd_hctl_t *hctl;
|
snd_hctl_t *hctl;
|
||||||
snd_hctl_elem_t *elem;
|
snd_hctl_elem_t *elem;
|
||||||
if ((err = snd_hctl_open(&hctl, card)) < 0) {
|
if ((err = snd_hctl_open(&hctl, card, 0)) < 0) {
|
||||||
error("Control %s open error: %s\n", card, snd_strerror(err));
|
error("Control %s open error: %s\n", card, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -895,7 +895,7 @@ static int sset(unsigned int argc, char *argv[], int roflag)
|
||||||
fprintf(stderr, "Specify what you want to set...\n");
|
fprintf(stderr, "Specify what you want to set...\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ((err = snd_mixer_open(&handle)) < 0) {
|
if ((err = snd_mixer_open(&handle, 0)) < 0) {
|
||||||
error("Mixer %s open error: %s\n", card, snd_strerror(err));
|
error("Mixer %s open error: %s\n", card, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1046,7 @@ static int events(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
|
||||||
snd_hctl_elem_t *helem;
|
snd_hctl_elem_t *helem;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((err = snd_hctl_open(&handle, card)) < 0) {
|
if ((err = snd_hctl_open(&handle, card, 0)) < 0) {
|
||||||
error("Control %s open error: %s\n", card, snd_strerror(err));
|
error("Control %s open error: %s\n", card, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1123,7 @@ static int sevents(int argc ATTRIBUTE_UNUSED, char *argv[] ATTRIBUTE_UNUSED)
|
||||||
snd_mixer_t *handle;
|
snd_mixer_t *handle;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if ((err = snd_mixer_open(&handle)) < 0) {
|
if ((err = snd_mixer_open(&handle, 0)) < 0) {
|
||||||
error("Mixer %s open error: %s", card, snd_strerror(err));
|
error("Mixer %s open error: %s", card, snd_strerror(err));
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ static void device_list(void)
|
||||||
while (card >= 0) {
|
while (card >= 0) {
|
||||||
char name[32];
|
char name[32];
|
||||||
sprintf(name, "hw:%d", card);
|
sprintf(name, "hw:%d", card);
|
||||||
if ((err = snd_ctl_open(&handle, name)) < 0) {
|
if ((err = snd_ctl_open(&handle, name, 0)) < 0) {
|
||||||
error("control open (%i): %s", card, snd_strerror(err));
|
error("control open (%i): %s", card, snd_strerror(err));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ int main(int argc, char *argv[])
|
||||||
goto __diga_end;
|
goto __diga_end;
|
||||||
}
|
}
|
||||||
sprintf(ctl_name, "hw:%d", ctl_card);
|
sprintf(ctl_name, "hw:%d", ctl_card);
|
||||||
if ((err = snd_ctl_open(&ctl_handle, ctl_name)) < 0) {
|
if ((err = snd_ctl_open(&ctl_handle, ctl_name, 0)) < 0) {
|
||||||
error("Unable to open the control interface '%s': %s", ctl_name, snd_strerror(err));
|
error("Unable to open the control interface '%s': %s", ctl_name, snd_strerror(err));
|
||||||
goto __diga_end;
|
goto __diga_end;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue