-/*
- * open mixer device
- */
-static int open_mixer(void)
-{
- return para_open(conf.mixer_device_arg, O_RDWR, 42);
-}
-
-/*
- * get volume via mixer_fd
- */
-static int do_get_vol(int mixer_fd)
-{
- int volume;
-
- if (ioctl(mixer_fd, MIXER_READ(SOUND_MIXER_VOLUME), &volume) < 0)
- return -ERRNO_TO_PARA_ERROR(errno);
- /* take the mean value of left and right volume */
- return (volume % 256 + (volume >> 8)) / 2;
-}
-
-/*
- * open mixer, get volume and close mixer
- */
-static int get_vol(void)
-{
- int mixer_fd;
- int volume;
-
- mixer_fd = open_mixer();
- if (mixer_fd < 0)
- return mixer_fd;
- volume = do_get_vol(mixer_fd);
- close(mixer_fd);
- return volume;
-}
-
-/*
- * set volume via mixer_fd
- */
-static int do_set_vol(int mixer_fd, int volume)
-{
- int tmp = (volume << 8) + volume;
-
- if (ioctl(mixer_fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &tmp) < 0)
- return -ERRNO_TO_PARA_ERROR(errno);
- return 1;
-}
-
-/*
- * open mixer, set volume and close mixer
- */
-static int set_vol(int volume)
-{
- int mixer_fd, ret = open_mixer();
-
- if (ret < 0)
- return ret;
- mixer_fd = ret;
- ret = do_set_vol(mixer_fd, volume);
- close(mixer_fd);
- return ret;
-}
-
-/*
- * Open mixer, get volume, fade to new_vol in secs seconds and
- * close mixer
- */
-static int fade(int new_vol, int fade_time)