snd_control_list_t list;
int idx, err;
- err = snd_ctl_open(&handle, cardno);
+ err = snd_ctl_hw_open(&handle, cardno);
if (err < 0) {
error("snd_ctl_open error: %s", snd_strerror(err));
return err;
snd_config_iterator_t i;
int err;
- err = snd_ctl_open(&handle, card);
+ err = snd_ctl_hw_open(&handle, card);
if (err < 0) {
error("snd_ctl_open error: %s", snd_strerror(err));
return err;
static float mixer_extra_space = 0;
static int mixer_cbar_height = 0;
-static int card_id = 0;
+static char* card_id = "0";
static snd_mixer_t *mixer_handle;
static char mixer_card_name[128];
static char mixer_device_name[128];
{
case ERR_OPEN:
fprintf (stderr,
- PRGNAME ": failed to open mixer #%i: %s\n",
+ PRGNAME ": failed to open mixer %s: %s\n",
card_id,
snd_strerror (xerrno));
break;
case '?':
case 'h':
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);
case 'c':
- card_id = snd_card_get_index(optarg);
+ card_id = optarg;
break;
case 'g':
mixer_do_color = !mixer_do_color;
int quiet = 0;
int debugflag = 0;
-int card;
+char *card = "0";
static void error(const char *fmt,...)
{
printf("Usage: amixer <options> command\n");
printf("\nAvailable options:\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(" -v,--version print version of this program\n");
printf("\nAvailable commands:\n");
error("Control device %i hw info error: %s", card, snd_strerror(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 name : '%s'\n", info.mixername);
memset(&clist, 0, sizeof(clist));
};
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) {
int c;
break;
case 'c':
case HELPID_CARD:
- card = snd_card_get_index(optarg);
+ card = optarg;
break;
case 'q':
case HELPID_QUIET:
for (card = 0; card < SND_CARDS; card++) {
if (!(mask & (1 << card)))
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));
continue;
}