mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:25:42 +01:00
Updates for the latest API (the next device changes).
This commit is contained in:
parent
b62a07a9db
commit
3180b94099
3 changed files with 42 additions and 28 deletions
|
@ -915,19 +915,23 @@ static int save_state(char *file, const char *cardname)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cardname) {
|
if (!cardname) {
|
||||||
unsigned int card_mask, idx;
|
unsigned int card, first = 1;
|
||||||
|
|
||||||
card_mask = snd_cards_mask();
|
card = -1;
|
||||||
if (!card_mask) {
|
/* find each installed soundcards */
|
||||||
error("No soundcards found...");
|
while (1) {
|
||||||
return 1;
|
if (snd_card_next(&card) < 0)
|
||||||
}
|
break;
|
||||||
for (idx = 0; idx < 32; idx++) {
|
if (card < 0) {
|
||||||
if (card_mask & (1 << idx)) { /* find each installed soundcards */
|
if (first) {
|
||||||
if ((err = get_controls(idx, config))) {
|
error("No soundcards found...");
|
||||||
return err;
|
return 1;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
first = 0;
|
||||||
|
if ((err = get_controls(card, config)))
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int cardno;
|
int cardno;
|
||||||
|
@ -987,19 +991,23 @@ static int load_state(char *file, const char *cardname)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cardname) {
|
if (!cardname) {
|
||||||
unsigned int card_mask, idx;
|
unsigned int card, first = 1;
|
||||||
|
|
||||||
card_mask = snd_cards_mask();
|
card = -1;
|
||||||
if (!card_mask) {
|
/* find each installed soundcards */
|
||||||
error("No soundcards found...");
|
while (1) {
|
||||||
return 1;
|
if (snd_card_next(&card) < 0)
|
||||||
}
|
break;
|
||||||
for (idx = 0; idx < 32; idx++) {
|
if (card < 0) {
|
||||||
if (card_mask & (1 << idx)) { /* find each installed soundcards */
|
if (first) {
|
||||||
if ((err = set_controls(idx, config))) {
|
error("No soundcards found...");
|
||||||
return err;
|
return 1;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
first = 0;
|
||||||
|
if ((err = set_controls(card, config)))
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int cardno;
|
int cardno;
|
||||||
|
|
|
@ -1730,7 +1730,7 @@ main (int argc,
|
||||||
case '?':
|
case '?':
|
||||||
case 'h':
|
case 'h':
|
||||||
fprintf (stderr, "%s %s\n", PRGNAME_UPPER, VERSION);
|
fprintf (stderr, "%s %s\n", PRGNAME_UPPER, VERSION);
|
||||||
fprintf (stderr, "Usage: %s [-c <card: 0...%i>] [-z]\n", PRGNAME, snd_cards () - 1);
|
fprintf (stderr, "Usage: %s [-c <card: 0...7>] [-z]\n", PRGNAME);
|
||||||
mixer_abort (ERR_NONE, "", 0);
|
mixer_abort (ERR_NONE, "", 0);
|
||||||
case 'c':
|
case 'c':
|
||||||
card_id = optarg;
|
card_id = optarg;
|
||||||
|
|
|
@ -171,19 +171,16 @@ static void device_list(void)
|
||||||
{
|
{
|
||||||
snd_ctl_t *handle;
|
snd_ctl_t *handle;
|
||||||
int card, err, dev, idx;
|
int card, err, dev, idx;
|
||||||
unsigned int mask;
|
|
||||||
snd_ctl_hw_info_t info;
|
snd_ctl_hw_info_t info;
|
||||||
snd_pcm_info_t pcminfo;
|
snd_pcm_info_t pcminfo;
|
||||||
|
|
||||||
mask = snd_cards_mask();
|
card = -1;
|
||||||
if (!mask) {
|
if (snd_card_next(&card) < 0 || card < 0) {
|
||||||
error("no soundcards found...");
|
error("no soundcards found...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (card = 0; card < SND_CARDS; card++) {
|
while (card >= 0) {
|
||||||
char name[32];
|
char name[32];
|
||||||
if (!(mask & (1 << card)))
|
|
||||||
continue;
|
|
||||||
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) {
|
||||||
error("control open (%i): %s", card, snd_strerror(err));
|
error("control open (%i): %s", card, snd_strerror(err));
|
||||||
|
@ -194,7 +191,12 @@ static void device_list(void)
|
||||||
snd_ctl_close(handle);
|
snd_ctl_close(handle);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (dev = 0; dev < info.pcmdevs; dev++) {
|
dev = -1;
|
||||||
|
while (1) {
|
||||||
|
if (snd_ctl_pcm_next_device(handle, &dev)<0)
|
||||||
|
error("snd_ctl_pcm_next_device");
|
||||||
|
if (dev < 0)
|
||||||
|
break;
|
||||||
pcminfo.device = dev;
|
pcminfo.device = dev;
|
||||||
pcminfo.stream = -stream - 1;
|
pcminfo.stream = -stream - 1;
|
||||||
pcminfo.subdevice = -1;
|
pcminfo.subdevice = -1;
|
||||||
|
@ -221,6 +223,10 @@ static void device_list(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
snd_ctl_close(handle);
|
snd_ctl_close(handle);
|
||||||
|
if (snd_card_next(&card) < 0) {
|
||||||
|
error("snd_card_next");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue