mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:15:43 +01:00
Mixer interface updates (group extensions)..
This commit is contained in:
parent
2a4fa6ef11
commit
fab3731743
2 changed files with 62 additions and 5 deletions
|
@ -735,10 +735,67 @@ int show_group(void *handle, snd_mixer_gid_t *gid, const char *space)
|
|||
|
||||
bzero(&group, sizeof(group));
|
||||
group.gid = *gid;
|
||||
if ((err = snd_mixer_group(handle, &group)) < 0) {
|
||||
if ((err = snd_mixer_group_read(handle, &group)) < 0) {
|
||||
error("Mixer %i/%i group error: %s", card, device, snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
if (group.channels) {
|
||||
printf(" Capabilities:");
|
||||
if (group.caps & SND_MIXER_GRPCAP_VOLUME)
|
||||
printf(" volume");
|
||||
if (group.caps & SND_MIXER_GRPCAP_MUTE)
|
||||
printf(" mute");
|
||||
if (group.caps & SND_MIXER_GRPCAP_JOINTLY_MUTE)
|
||||
printf(" jointly-mute");
|
||||
if (group.caps & SND_MIXER_GRPCAP_RECORD) {
|
||||
printf(" record");
|
||||
} else {
|
||||
group.record = 0;
|
||||
}
|
||||
if (group.caps & SND_MIXER_GRPCAP_JOINTLY_RECORD)
|
||||
printf(" jointly-record");
|
||||
if (group.caps & SND_MIXER_GRPCAP_EXCL_RECORD)
|
||||
printf(" exclusive-record");
|
||||
printf("\n");
|
||||
if ((group.caps & SND_MIXER_GRPCAP_RECORD) &&
|
||||
(group.caps & SND_MIXER_GRPCAP_EXCL_RECORD))
|
||||
printf(" Record exclusive group: %i\n", group.record_group);
|
||||
printf(" Channels: ");
|
||||
if (group.channels == SND_MIXER_CHN_MASK_MONO) {
|
||||
printf("Mono");
|
||||
} else {
|
||||
if (group.channels & SND_MIXER_CHN_MASK_FRONT_LEFT)
|
||||
printf("Front-Left ");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_FRONT_RIGHT)
|
||||
printf("Front-Right ");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_FRONT_CENTER)
|
||||
printf("Front-Center ");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_REAR_LEFT)
|
||||
printf("Rear-Left ");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_REAR_RIGHT)
|
||||
printf("Rear-Right ");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_WOOFER)
|
||||
printf("Woofer");
|
||||
}
|
||||
printf("\n");
|
||||
printf(" Limits: min = %i, max = %i\n", group.min, group.max);
|
||||
if (group.channels == SND_MIXER_CHN_MASK_MONO) {
|
||||
printf(" Mono: %i [%s]\n", group.front_left, group.mute & SND_MIXER_CHN_MASK_MONO ? "mute" : "on");
|
||||
} else {
|
||||
if (group.channels & SND_MIXER_CHN_MASK_FRONT_LEFT)
|
||||
printf(" Front-Left: %i [%s] [%s]\n", group.front_left, group.mute & SND_MIXER_CHN_MASK_FRONT_LEFT ? "mute" : "on", group.record & SND_MIXER_CHN_MASK_FRONT_LEFT ? "record" : "---");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_FRONT_RIGHT)
|
||||
printf(" Front-Right: %i [%s] [%s]\n", group.front_right, group.mute & SND_MIXER_CHN_MASK_FRONT_RIGHT ? "mute" : "on", group.record & SND_MIXER_CHN_MASK_FRONT_RIGHT ? "record" : "---");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_FRONT_CENTER)
|
||||
printf(" Front-Center: %i [%s] [%s]\n", group.front_center, group.mute & SND_MIXER_CHN_MASK_FRONT_CENTER ? "mute" : "on", group.record & SND_MIXER_CHN_MASK_FRONT_CENTER ? "record" : "---");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_REAR_LEFT)
|
||||
printf(" Rear-Left: %i [%s] [%s]\n", group.rear_left, group.mute & SND_MIXER_CHN_MASK_REAR_LEFT ? "mute" : "on", group.record & SND_MIXER_CHN_MASK_REAR_LEFT ? "record" : "---");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_REAR_RIGHT)
|
||||
printf(" Rear-Right: %i [%s] [%s]\n", group.rear_right, group.mute & SND_MIXER_CHN_MASK_REAR_RIGHT ? "mute" : "---", group.record & SND_MIXER_CHN_MASK_REAR_RIGHT ? "record" : "---");
|
||||
if (group.channels & SND_MIXER_CHN_MASK_WOOFER)
|
||||
printf(" Woofer: %i [%s] [%s]\n", group.woofer, group.mute & SND_MIXER_CHN_MASK_WOOFER ? "mute" : "---", group.record & SND_MIXER_CHN_MASK_WOOFER ? "record" : "---");
|
||||
}
|
||||
}
|
||||
group.pelements = (snd_mixer_eid_t *)malloc(group.elements_over * sizeof(snd_mixer_eid_t));
|
||||
if (!group.pelements) {
|
||||
error("No enough memory...");
|
||||
|
@ -746,7 +803,7 @@ int show_group(void *handle, snd_mixer_gid_t *gid, const char *space)
|
|||
}
|
||||
group.elements_size = group.elements_over;
|
||||
group.elements = group.elements_over = 0;
|
||||
if ((err = snd_mixer_group(handle, &group)) < 0) {
|
||||
if ((err = snd_mixer_group_read(handle, &group)) < 0) {
|
||||
error("Mixer %i/%i group (2) error: %s", card, device, snd_strerror(err));
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -292,8 +292,8 @@ int init_group(void *handle, Group *group)
|
|||
and the info about the elements in the group, we'll set up the element array. */
|
||||
int idx, err;
|
||||
|
||||
if((err = snd_mixer_group(handle,
|
||||
&group->group)) < 0) {
|
||||
if((err = snd_mixer_group_read(handle,
|
||||
&group->group)) < 0) {
|
||||
printf("Unable to get info for group %s! ", group->group.gid.name);
|
||||
printf("Error: %s\n", snd_strerror(err));
|
||||
printf("elements_size = %i, elements_over=%i, elements=%i\n",
|
||||
|
@ -310,7 +310,7 @@ int init_group(void *handle, Group *group)
|
|||
}
|
||||
group->group.elements_size = group->group.elements_over;
|
||||
group->group.elements = group->group.elements_over = 0;
|
||||
if ((err = snd_mixer_group(handle, &group->group)) < 0) {
|
||||
if ((err = snd_mixer_group_read(handle, &group->group)) < 0) {
|
||||
printf("Unable to get second group info for group %s. Error: %s\n",
|
||||
group->group.gid.name, snd_strerror(err));
|
||||
printf("elements_size = %i, elements_over=%i, elements=%i\n",
|
||||
|
|
Loading…
Reference in a new issue