#include #include #include static char *mixer_names[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_LABELS; int main(int argc, char **argv) { int val, from, to; int i, fd; fd = open("/dev/mixer", O_RDWR); if(fd < 0) { perror("/dev/mixer"); return 1; } for(i = 2; i < argc; i += 2) { from = atoi(argv[i-1]); to = atoi(argv[i]); if(to == SOUND_MIXER_NONE) fprintf(stderr, "%s: turning off mixer %s\n", argv[0], mixer_names[to]); else fprintf(stderr, "%s: rerouting mixer %s to %s\n", argv[0], mixer_names[from], mixer_names[to]); val = from << 8 | to; if(ioctl(fd, SOUND_MIXER_PRIVATE2, &val)) { perror("AD1848 mixer reroute"); return 1; } } return 0; }