Added abstraction layer to controls. Added client/server support to controls. Cleaned private_data use for PCMs. Cleaned aserver

This commit is contained in:
Abramo Bagnara 2000-09-11 15:49:33 +00:00
parent 787089c2c0
commit a6427e6044
4 changed files with 11 additions and 16 deletions

View file

@ -424,7 +424,7 @@ static int get_controls(int cardno, snd_config_t *top)
snd_control_list_t list; snd_control_list_t list;
int idx, err; int idx, err;
err = snd_ctl_open(&handle, cardno); err = snd_ctl_hw_open(&handle, cardno);
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;
@ -852,7 +852,7 @@ static int set_controls(int card, snd_config_t *top)
snd_config_iterator_t i; snd_config_iterator_t i;
int err; int err;
err = snd_ctl_open(&handle, card); err = snd_ctl_hw_open(&handle, card);
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;

View file

@ -178,7 +178,7 @@ static int mixer_ofs_x = 0;
static float mixer_extra_space = 0; static float mixer_extra_space = 0;
static int mixer_cbar_height = 0; static int mixer_cbar_height = 0;
static int card_id = 0; static char* card_id = "0";
static snd_mixer_t *mixer_handle; static snd_mixer_t *mixer_handle;
static char mixer_card_name[128]; static char mixer_card_name[128];
static char mixer_device_name[128]; static char mixer_device_name[128];
@ -399,7 +399,7 @@ mixer_abort (ErrType error,
{ {
case ERR_OPEN: case ERR_OPEN:
fprintf (stderr, fprintf (stderr,
PRGNAME ": failed to open mixer #%i: %s\n", PRGNAME ": failed to open mixer %s: %s\n",
card_id, card_id,
snd_strerror (xerrno)); snd_strerror (xerrno));
break; break;
@ -1712,10 +1712,10 @@ 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...%i>] [-z]\n", PRGNAME, snd_cards () - 1);
mixer_abort (ERR_NONE, "", 0); mixer_abort (ERR_NONE, "", 0);
case 'c': case 'c':
card_id = snd_card_get_index(optarg); card_id = optarg;
break; break;
case 'g': case 'g':
mixer_do_color = !mixer_do_color; mixer_do_color = !mixer_do_color;

View file

@ -40,7 +40,7 @@
int quiet = 0; int quiet = 0;
int debugflag = 0; int debugflag = 0;
int card; char *card = "0";
static void error(const char *fmt,...) static void error(const char *fmt,...)
{ {
@ -58,7 +58,7 @@ static int help(void)
printf("Usage: amixer <options> command\n"); printf("Usage: amixer <options> command\n");
printf("\nAvailable options:\n"); printf("\nAvailable options:\n");
printf(" -h,--help this help\n"); printf(" -h,--help this help\n");
printf(" -c,--card # use a card number (0-%i) or the card name, default %i\n", snd_cards() - 1, card); printf(" -c,--card # use a card number (0-%i) or the card name, default %s\n", snd_cards() - 1, card);
printf(" -D,--debug debug mode\n"); printf(" -D,--debug debug mode\n");
printf(" -v,--version print version of this program\n"); printf(" -v,--version print version of this program\n");
printf("\nAvailable commands:\n"); printf("\nAvailable commands:\n");
@ -90,7 +90,7 @@ static int info(void)
error("Control device %i hw info error: %s", card, snd_strerror(err)); error("Control device %i hw info error: %s", card, snd_strerror(err));
return err; return err;
} }
printf("Card #%i '%s'/'%s'\n", card, info.id, info.longname); printf("Card %s '%s'/'%s'\n", card, info.id, info.longname);
printf(" Mixer ID : '%s'\n", info.mixerid); printf(" Mixer ID : '%s'\n", info.mixerid);
printf(" Mixer name : '%s'\n", info.mixername); printf(" Mixer name : '%s'\n", info.mixername);
memset(&clist, 0, sizeof(clist)); memset(&clist, 0, sizeof(clist));
@ -1058,11 +1058,6 @@ int main(int argc, char *argv[])
}; };
morehelp = 0; morehelp = 0;
card = snd_defaults_mixer_card();
if (card < 0) {
fprintf(stderr, "The ALSA sound driver was not detected in this system.\n");
return 1;
}
while (1) { while (1) {
int c; int c;
@ -1075,7 +1070,7 @@ int main(int argc, char *argv[])
break; break;
case 'c': case 'c':
case HELPID_CARD: case HELPID_CARD:
card = snd_card_get_index(optarg); card = optarg;
break; break;
case 'q': case 'q':
case HELPID_QUIET: case HELPID_QUIET:

View file

@ -238,7 +238,7 @@ static void device_list(void)
for (card = 0; card < SND_CARDS; card++) { for (card = 0; card < SND_CARDS; card++) {
if (!(mask & (1 << card))) if (!(mask & (1 << card)))
continue; continue;
if ((err = snd_ctl_open(&handle, card)) < 0) { if ((err = snd_ctl_hw_open(&handle, card)) < 0) {
error("control open (%i): %s", card, snd_strerror(err)); error("control open (%i): %s", card, snd_strerror(err));
continue; continue;
} }