commit 87c3fbac7a53f19e5684c026f7df3a8fe2c20dd2
parent 5f4e95638a4240d096c78dd739bb2381fb0db381
Author: Christos Margiolis <christos@margiolis.net>
Date: Wed, 21 Jul 2021 21:54:26 +0300
working on manpages
Diffstat:
5 files changed, 397 insertions(+), 80 deletions(-)
diff --git a/mixer_lib/mixer.3 b/mixer_lib/mixer.3
@@ -24,14 +24,27 @@
.Dt mixer 3
.Os
.Sh NAME
-.Nm mixer
-.Nd an OSS mixer library
+.Nm mixer_open ,
+.Nm mixer_close ,
+.Nm mixer_getdev ,
+.Nm mixer_getdevbyname ,
+.Nm mixer_setvol ,
+.Nm mixer_setmute ,
+.Nm mixer_modrecsrc ,
+.Nm mixer_getdunit ,
+.Nm mixer_setdunit ,
+.Nm mixer_getnmixers ,
+.Nm MIX_ISDEV ,
+.Nm MIX_ISMUTE ,
+.Nm MIX_ISREC ,
+.Nm MIX_ISRECSRC
+.Nd interface to OSS mixers
.Sh LIBRARY
Mixer library (libmixer, -lmixer)
.Sh SYNOPSIS
.In mixer.h
.Ft struct mixer *
-.Fn mixer_open "const char *path"
+.Fn mixer_open "const char *name"
.Ft int
.Fn mixer_close "struct mixer *m"
.Ft struct mix_dev *
@@ -39,7 +52,7 @@ Mixer library (libmixer, -lmixer)
.Ft struct mix_dev *
.Fn mixer_getdevbyname "struct mixer *m" "name"
.Ft int
-.Fn mixer_setvol "struct mixer *m" "mixer_volume_t vol"
+.Fn mixer_setvol "struct mixer *m" "mix_volume_t vol"
.Ft int
.Fn mixer_setmute "struct mixer *m" "int opt"
.Ft int
@@ -50,9 +63,269 @@ Mixer library (libmixer, -lmixer)
.Fn mixer_setdunit "struct mixer *m" "int unit"
.Ft int
.Fn mixer_getnmixers "void"
+.Ft int
+.Fn MIX_ISDEV "struct mixer *m" "int devno"
+.Ft int
+.Fn MIX_ISMUTE "struct mixer *m" "int devno"
+.Ft int
+.Fn MIX_ISREC "struct mixer *m" "int devno"
+.Ft int
+.Fn MIX_ISRECSRC "struct mixer *m" "int devno"
.Sh DESCRIPTION
-.\" TODO
+The
+.Nm mixer
+library allows userspace programs to access and manipulate OSS sound mixers in
+a simple way.
+.Ss Mixer
+.Pp
+A mixer is described by the following structure:
+.Bd -literal
+struct mixer {
+ TAILQ_HEAD(, mix_dev) devs;
+ struct mix_dev *dev;
+ oss_mixerinfo mi;
+ oss_card_info ci;
+ char name[NAME_MAX];
+ int fd;
+ int unit;
+ int ndev;
+ int devmask;
+#define MIX_MUTE 0x01
+#define MIX_UNMUTE 0x02
+#define MIX_TOGGLEMUTE 0x04
+ int mutemask;
+ int recmask;
+#define MIX_ADDRECSRC 0x01
+#define MIX_REMOVERECSRC 0x02
+#define MIX_SETRECSRC 0x04
+#define MIX_TOGGLERECSRC 0x08
+ int recsrc;
+ int f_default;
+};
+.Ed
+.Ss Mixer device
+.Pp
+Each mixer device stored in a mixer structure is described as follows:
+.Bd -literal
+struct mix_dev {
+ char name[NAME_MAX];
+ int devno;
+ struct mix_volume {
+#define MIX_VOLMIN 0.0f
+#define MIX_VOLMAX 1.0f
+#define MIX_VOLNORM(v) ((v) / 100.0f)
+#define MIX_VOLDENORM(v) ((int)roundf((v) * 100.0f))
+ float left;
+ float right;
+ } vol;
+ TAILQ_ENTRY(mix_dev) devs;
+};
+.Ed
+.Ss Device names
+The name a device is guaranteed to be one of the following:
+.Bd -ragged -offset indent
+vol, bass, treble, synth, pcm, speaker, line, mic, cd, mix,
+pcm2, rec, igain, ogain, line1, line2, line3, dig1, dig2, dig3,
+phin, phout, video, radio, and monitor.
+.Ed
+.Ss Opening and closing the mixer
+.Pp
+The application must first call the
+.Fn mixer_open
+function to obtain a handle to the device, which is used as an argument
+in most other functions and macros. The parameter
+.Ar name
+specifies the path to the mixer. OSS mixers are stored under
+.Ar /dev/mixerN
+where
+.Ar N
+is the number of the mixer device. Each device maps to an actual
+.Ar pcm
+audio card, so
+.Ar /dev/mixer0
+is the mixer for
+.Ar pcm0 ,
+and so on. If
+.Ar name
+is
+.Ar NULL
+or
+.Ar /dev/mixer ,
+.Fn mixer_open
+opens the default mixer (hw.snd.defaul_unit).
+.Pp
+The
+.Fn mixer_close
+function frees resources and closes the mixer device. It's a good practice to
+always call it when the application is done using the mixer.
+.Ss Manipulating the mixer
+.Pp
+The
+.Fn mixer_getdev
+and
+.Fn mixer_getdevbyname
+functions select a mixer device, either by its number or by its name
+respectively. The mixer structure keeps a list of all the devices, but only
+one can be manipulated at a time. Each time a new device is to be manipulated,
+one of the two functions has to be called.
+.Pp
+The
+.Fn mixer_setvol
+function changes the volume of the selected mixer device. The
+.Ar vol
+parameter is a structure that stores the left and right volumes of a given
+device. The allowed volume values are between MIX_VOLMIN (0.0) and
+MIX_VOLMAX (1.0).
+.Pp
+The
+.Fn mixer_setmute
+function modifies the mute of a selected device. The
+.Ar opt
+parameter has to be one of the following options:
+.Bl -tag -width MIX_TOGGLEMUTE -offset indent
+.It Dv MIX_MUTE
+Mute the device.
+.It Dv MIX_UNMUTE
+Unmute the device.
+.It Dv MIX_TOGGLEMUTE
+Toggle the device's mute (e.g mute if unmuted and unmute if muted).
+.El
+.Pp
+The
+.Fn mixer_modrecsrc
+function modifies a recording device. The selected device has to be
+a recording device, otherwise the function will fail. The
+.Ar opt
+parameter has to be one of the following options:
+.Bl -tag -width MIX_REMOVERECSRC -offset indent
+.It Dv MIX_ADDRECSRC
+Add device to the recording sources.
+.It Dv MIX_REMOVERECSRC
+Remove device from the recording sources.
+.It Dv MIX_SETRECSRC
+Set device as the only recording source.
+.It Dv MIX_TOGGLERECSRC
+Toggle device from the recording sources.
+.El
+.Pp
+The
+.Fn mixer_getdunit
+and
+.Fn mixer_setdunit
+functions get and set the default audio card in the system. Although this is
+not really a mixer feature, it's useful to have instead of having to use
+the
+.Xr sysctl 3
+controls.
+.Pp
+The
+.Fn mixer_getnmixers
+function returns the total number of mixer devices in the system.
+.Pp
+The
+.Fn MIX_ISDEV
+macro checks if a device is actually a valid device for a given mixer. It's very
+unlikely that this macro will ever be needed since the library stores only
+valid devices by default.
+.Pp
+The
+.Fn MIX_ISMUTE
+macro checks if a device is muted.
+.Pp
+The
+.Fn MIX_ISREC
+macro checks if a device is a recording device.
+.Pp
+The
+.Fn MIX_ISRECSRC
+macro checks if a device is a recording source.
+.Sh RETURN VALUES
+.Pp
+The
+.Fn mixer_open
+function returns the newly created handle on success and NULL on failure.
+.Pp
+The
+.Fn mixer_close ,
+.Fn mixer_setvol ,
+.Fn mixer_setmute ,
+.Fn mixer_modrecsrc ,
+.Fn mixer_getdunut ,
+.Fn mixer_setdunit
+and
+.Fn mixer_getnmixers
+functions return 0 or positive values on success and -1 on failure.
+.Pp
+The
+.Fn mixer_getdev
+and
+.Fn mixer_getdevbyname
+functions return the selected device on success and NULL on failure.
+.Pp
+All functions set the value of
+.Ar errno
+on failure.
+.Sh EXAMPLES
+.Ss Change the volume of a device
+.Bd -literal
+struct mixer *m;
+mix_volume_t vol;
+char *mix_name, *dev_name;
+
+mix_name = ...;
+if ((m = mixer_open(mix_name)) == NULL)
+ err(1, "mixer_open: %s", mix_name);
+
+dev_name = ...;
+if ((m->dev = mixer_getdevbyname(m, dev_name)) < 0)
+ err(1, "unknown device: %s", dev_name);
+
+vol.left = ...;
+vol.right = ....;
+if (mixer_setvol(m, vol) < 0)
+ warn("cannot change volume");
+
+(void)mixer_close(m);
+.Ed
+.Ss Mute all unmuted devices
+.Bd -literal
+struct mixer *m;
+struct mix_dev *dp;
+
+if ((m = mixer_open(NULL)) == NULL) /* Open the default mixer. */
+ err(1, "mixer_open");
+TAILQ_FOREACH(dp, &m->devs, devs) {
+ m->dev = dp; /* Select device. */
+ if (M_ISMUTE(m, dp->devno))
+ continue;
+ if (mixer_setmute(m, MIX_MUTE) < 0)
+ warn("cannot mute device: %s", dp->name);
+}
+
+(void)mixer_close(m);
+.Ed
+.Ss Print all recording sources' names and volumes
+.Bd -literal
+struct mixer *m;
+struct mix_dev *dp;
+
+char *mix_name, *dev_name;
+
+mix_name = ...;
+if ((m = mixer_open(mix_name)) == NULL)
+ err(1, "mixer_open: %s", mix_name);
+
+TAILQ_FOREACH(dp, &m->devs, devs) {
+ if (M_ISRECSRC(m, dp->devno))
+ printf("%s\\t%.2f:%.2f\\n",
+ dp->name, dp->vol.left, dp->vol.right);
+}
+
+(void)mixer_close(m);
+.Ed
.Sh SEE ALSO
-.Xr sound 4
+.Xr mixer 8 ,
+.Xr sound 4 ,
+.Xr errno 2
.Sh AUTHORS
.An Christos Margiolis Aq Mt christos@margiolis.net
diff --git a/mixer_lib/mixer.c b/mixer_lib/mixer.c
@@ -48,22 +48,22 @@ _mixer_readvol(struct mixer *m, struct mix_dev *dev)
if (ioctl(m->fd, MIXER_READ(dev->devno), &v) < 0)
return (-1);
- dev->vol.left = M_VOLNORM(v & 0x00ff);
- dev->vol.right = M_VOLNORM((v >> 8) & 0x00ff);
+ dev->vol.left = MIX_VOLNORM(v & 0x00ff);
+ dev->vol.right = MIX_VOLNORM((v >> 8) & 0x00ff);
return (0);
}
/*
* Open a mixer device in `/dev/mixerN`, where N is the number of the mixer.
- * Each device maps to an actual pcmN audio card, so `/dev/mixer0` is the
- * mixer device for pcm0, and so on.
+ * Each device maps to an actual pcm audio card, so `/dev/mixer0` is the
+ * mixer for pcm0, and so on.
*
* @param name path to mixer device. NULL or "/dev/mixer" for the
* the default mixer (i.e `hw.snd.default_unit`).
*
* @retval mixer success
- * @retval NULL fail
+ * @retval NULL failure
*/
struct mixer *
mixer_open(const char *name)
@@ -112,7 +112,7 @@ dunit:
TAILQ_INIT(&m->devs);
for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
- if (!M_ISDEV(m, i))
+ if (!MIX_ISDEV(m, i))
continue;
if ((dp = calloc(1, sizeof(struct mix_dev))) == NULL)
goto fail;
@@ -137,6 +137,9 @@ fail:
/*
* Free resources and close the mixer.
+ *
+ * @retval 0 success
+ * @retval -1 failure
*/
int
mixer_close(struct mixer *m)
@@ -155,6 +158,19 @@ mixer_close(struct mixer *m)
return (r);
}
+/*
+ * Select a mixer device. The mixer structure keeps a list of all the devices
+ * the mixer has, but only one can be manipulated at a time -- this is what
+ * the `dev` in the mixer structure field is for. Each time a device is to be
+ * manipulated, `dev` has to point to it first.
+ *
+ * The caller must manually assign the return value to `m->dev`.
+ *
+ * @param dev device number; `devno` field of `mix_dev`
+ *
+ * @retval dev success
+ * @retval NULL failure
+ */
struct mix_dev *
mixer_getdev(struct mixer *m, int dev)
{
@@ -174,14 +190,12 @@ mixer_getdev(struct mixer *m, int dev)
}
/*
- * Select a mixer device (e.g vol, pcm, mic) by name. The mixer structure
- * keeps a list of all the devices the mixer has, but only one can be
- * manipulated at a time -- this is what the `dev` field is for. Each
- * time we want to manipulate a device, `dev` has to point to it first.
- *
- * The caller has to assign the return value to `m->dev`.
+ * Select a device by name.
*
* @param name device name (e.g vol, pcm, ...)
+ *
+ * @retval dev success
+ * @retval NULL failure
*/
struct mix_dev *
mixer_getdevbyname(struct mixer *m, const char *name)
@@ -199,26 +213,29 @@ mixer_getdevbyname(struct mixer *m, const char *name)
/*
* Change the mixer's left and right volume. The allowed volume values are
- * between M_VOLMIN and M_VOLMAX. The `ioctl` for volume change requires
+ * between MIX_VOLMIN and MIX_VOLMAX. The `ioctl` for volume change requires
* an integer value between 0 and 100 stored as `lvol | rvol << 8` -- for
* that reason, we de-normalize the 32-bit float volume value, before
* we pass it to the `ioctl`.
*
- * If the volumes passed are not in the range `M_VOLMIN <= vol <= M_VOLMAX`,
- * we return an error and `errno` is set to ERANGE. Volume clumping should
- * be handlded by the caller.
+ * Volume clumping should be done by the caller.
+ *
+ * @param vol left/right volume structure.
+ *
+ * @retval 0 success
+ * @retval -1 failure
*/
int
mixer_setvol(struct mixer *m, mix_volume_t vol)
{
int v;
- if (vol.left < M_VOLMIN || vol.left > M_VOLMAX ||
- vol.right < M_VOLMIN || vol.right > M_VOLMAX) {
+ if (vol.left < MIX_VOLMIN || vol.left > MIX_VOLMAX ||
+ vol.right < MIX_VOLMIN || vol.right > MIX_VOLMAX) {
errno = ERANGE;
return (-1);
}
- v = M_VOLDENORM(vol.left) | M_VOLDENORM(vol.right) << 8;
+ v = MIX_VOLDENORM(vol.left) | MIX_VOLDENORM(vol.right) << 8;
if (ioctl(m->fd, MIXER_WRITE(m->dev->devno), &v) < 0)
return (-1);
if (_mixer_readvol(m, m->dev) < 0)
@@ -227,17 +244,27 @@ mixer_setvol(struct mixer *m, mix_volume_t vol)
return (0);
}
+/*
+ * Manipulate a device's mute.
+ *
+ * @param opt MIX_MUTE mute device
+ * MIX_UNMUTE unmute device
+ * MIX_TOGGLEMUTE toggle device's mute
+ *
+ * @retval 0 success
+ * @retval -1 failure
+ */
int
mixer_setmute(struct mixer *m, int opt)
{
switch (opt) {
- case M_MUTE:
+ case MIX_MUTE:
m->mutemask |= (1 << m->dev->devno);
break;
- case M_UNMUTE:
+ case MIX_UNMUTE:
m->mutemask &= ~(1 << m->dev->devno);
break;
- case M_TOGGLEMUTE:
+ case MIX_TOGGLEMUTE:
m->mutemask ^= (1 << m->dev->devno);
break;
default:
@@ -253,27 +280,35 @@ mixer_setmute(struct mixer *m, int opt)
}
/*
- * Modify the mixer's selected device flags. The `recsrc` flag tells
- * us if a device is a recording source.
+ * Modify a recording device. The selected device has to be a recording device,
+ * otherwise the function will fail.
+ *
+ * @param opt MIX_ADDRECSRC add device to recording sources
+ * MIX_REMOVERECSRC remove device from recording sources
+ * MIX_SETRECSRC set device as the only recording source
+ * MIX_TOGGLERECSRC toggle device from recording sources
+ *
+ * @retval 0 success
+ * @retval -1 failure
*/
int
mixer_modrecsrc(struct mixer *m, int opt)
{
- if (!m->recmask || !M_ISREC(m, m->dev->devno)) {
+ if (!m->recmask || !MIX_ISREC(m, m->dev->devno)) {
errno = ENODEV;
return (-1);
}
switch (opt) {
- case M_ADDRECSRC:
+ case MIX_ADDRECSRC:
m->recsrc |= (1 << m->dev->devno);
break;
- case M_REMOVERECSRC:
+ case MIX_REMOVERECSRC:
m->recsrc &= ~(1 << m->dev->devno);
break;
- case M_SETRECSRC:
+ case MIX_SETRECSRC:
m->recsrc = (1 << m->dev->devno);
break;
- case M_TOGGLERECSRC:
+ case MIX_TOGGLERECSRC:
m->recsrc ^= (1 << m->dev->devno);
break;
default:
@@ -291,6 +326,9 @@ mixer_modrecsrc(struct mixer *m, int opt)
/*
* Get default audio card's number. This is used to open the default mixer
* and set the mixer structure's `f_default` flag.
+ *
+ * @retval unit success
+ * @retval -1 failure
*/
int
mixer_getdunit(void)
@@ -311,6 +349,9 @@ mixer_getdunit(void)
* the sysctl API.
*
* @param unit the audio card number (e.g pcm0, pcm1, ...).
+ *
+ * @retval 0 success
+ * @retval -1 failure
*/
int
mixer_setdunit(struct mixer *m, int unit)
@@ -327,6 +368,9 @@ mixer_setdunit(struct mixer *m, int unit)
/*
* Get the total number of mixers in the system.
+ *
+ * @retval nmixers success
+ * @retval -1 failure
*/
int
mixer_getnmixers(void)
diff --git a/mixer_lib/mixer.h b/mixer_lib/mixer.h
@@ -34,20 +34,20 @@ __FBSDID("$FreeBSD$");
#include <limits.h>
#include <math.h>
-#define M_ISSET(n,f) (((1 << (n)) & (f)) ? 1 : 0)
-#define M_ISDEV(m,n) M_ISSET(n, (m)->devmask)
-#define M_ISMUTE(m,n) M_ISSET(n, (m)->mutemask)
-#define M_ISREC(m,n) M_ISSET(n, (m)->recmask)
-#define M_ISRECSRC(m,n) M_ISSET(n, (m)->recsrc)
+#define MIX_ISSET(n,f) (((1 << (n)) & (f)) ? 1 : 0)
+#define MIX_ISDEV(m,n) MIX_ISSET(n, (m)->devmask)
+#define MIX_ISMUTE(m,n) MIX_ISSET(n, (m)->mutemask)
+#define MIX_ISREC(m,n) MIX_ISSET(n, (m)->recmask)
+#define MIX_ISRECSRC(m,n) MIX_ISSET(n, (m)->recsrc)
struct mix_dev {
char name[NAME_MAX];
int devno;
struct mix_volume {
-#define M_VOLMIN 0.0f
-#define M_VOLMAX 1.0f
-#define M_VOLNORM(v) ((v) / 100.0f)
-#define M_VOLDENORM(v) ((int)roundf((v) * 100.0f))
+#define MIX_VOLMIN 0.0f
+#define MIX_VOLMAX 1.0f
+#define MIX_VOLNORM(v) ((v) / 100.0f)
+#define MIX_VOLDENORM(v) ((int)roundf((v) * 100.0f))
float left;
float right;
} vol;
@@ -64,15 +64,15 @@ struct mixer {
int unit;
int ndev;
int devmask;
-#define M_MUTE 0x01
-#define M_UNMUTE 0x02
-#define M_TOGGLEMUTE 0x04
+#define MIX_MUTE 0x01
+#define MIX_UNMUTE 0x02
+#define MIX_TOGGLEMUTE 0x04
int mutemask;
int recmask;
-#define M_ADDRECSRC 0x01
-#define M_REMOVERECSRC 0x02
-#define M_SETRECSRC 0x04
-#define M_TOGGLERECSRC 0x08
+#define MIX_ADDRECSRC 0x01
+#define MIX_REMOVERECSRC 0x02
+#define MIX_SETRECSRC 0x04
+#define MIX_TOGGLERECSRC 0x08
int recsrc;
int f_default;
};
diff --git a/mixer_prog/mixer_prog.8 b/mixer_prog/mixer_prog.8
@@ -76,7 +76,7 @@ Without any arguments,
.Nm
displays all information for each one of the mixer's supported devices to
.Ar stdout .
-If the \" TODO: explain what "default mixer" means.
+If the
.Ar dev
argument is specified,
.Nm
diff --git a/mixer_prog/mixer_prog.c b/mixer_prog/mixer_prog.c
@@ -223,21 +223,21 @@ printdev(struct mixer *m, struct mix_dev *d, int oflag)
if (!oflag) {
printf(" %-11s= %.2f:%.2f\t",
d->name, d->vol.left, d->vol.right);
- if (!M_ISREC(m, d->devno))
+ if (!MIX_ISREC(m, d->devno))
printf(" pbk");
- if (M_ISREC(m, d->devno))
+ if (MIX_ISREC(m, d->devno))
printf(" rec");
- if (M_ISRECSRC(m, d->devno))
+ if (MIX_ISRECSRC(m, d->devno))
printf(" src");
- if (M_ISMUTE(m, d->devno))
+ if (MIX_ISMUTE(m, d->devno))
printf(" mute");
printf("\n");
} else {
printf("%s.%s=%.2f:%.2f\n",
d->name, ctls[MCTL_VOL].name, d->vol.left, d->vol.right);
printf("%s.%s=%d\n",
- d->name, ctls[MCTL_MUT].name, M_ISMUTE(m, d->devno));
- if (M_ISRECSRC(m, d->devno))
+ d->name, ctls[MCTL_MUT].name, MIX_ISMUTE(m, d->devno));
+ if (MIX_ISRECSRC(m, d->devno))
printf("%s.%s=+\n", d->name, ctls[MCTL_SRC].name);
}
}
@@ -254,7 +254,7 @@ printrecsrc(struct mixer *m, int oflag)
if (!oflag)
printf(" recording source(s): ");
TAILQ_FOREACH(dp, &m->devs, devs) {
- if (M_ISRECSRC(m, dp->devno)) {
+ if (MIX_ISRECSRC(m, dp->devno)) {
if (n++)
printf("%s ", oflag ? " " : ", ");
printf("%s", dp->name);
@@ -308,14 +308,14 @@ mod_volume(struct mixer *m, const char *val)
if (rrel)
v.right += m->dev->vol.right;
- if (v.left < M_VOLMIN)
- v.left = M_VOLMIN;
- else if (v.left > M_VOLMAX)
- v.left = M_VOLMAX;
- if (v.right < M_VOLMIN)
- v.right = M_VOLMIN;
- else if (v.right > M_VOLMAX)
- v.right = M_VOLMAX;
+ if (v.left < MIX_VOLMIN)
+ v.left = MIX_VOLMIN;
+ else if (v.left > MIX_VOLMAX)
+ v.left = MIX_VOLMAX;
+ if (v.right < MIX_VOLMIN)
+ v.right = MIX_VOLMIN;
+ else if (v.right > MIX_VOLMAX)
+ v.right = MIX_VOLMAX;
lprev = m->dev->vol.left;
rprev = m->dev->vol.right;
@@ -336,24 +336,24 @@ mod_mute(struct mixer *m, const char *val)
switch (*val) {
case '0':
- opt = M_UNMUTE;
+ opt = MIX_UNMUTE;
break;
case '1':
- opt = M_MUTE;
+ opt = MIX_MUTE;
break;
case '^':
- opt = M_TOGGLEMUTE;
+ opt = MIX_TOGGLEMUTE;
break;
default:
warnx("%c: no such modifier", *val);
return;
}
- n = M_ISMUTE(m, m->dev->devno);
+ n = MIX_ISMUTE(m, m->dev->devno);
if (mixer_setmute(m, opt) < 0)
warn("%s.%s=%c", m->dev->name, ctls[MCTL_MUT].name, *val);
else
printf("%s.%s: %d -> %d\n",
- m->dev->name, ctls[MCTL_MUT].name, n, M_ISMUTE(m, m->dev->devno));
+ m->dev->name, ctls[MCTL_MUT].name, n, MIX_ISMUTE(m, m->dev->devno));
}
static void
@@ -363,28 +363,28 @@ mod_recsrc(struct mixer *m, const char *val)
switch (*val) {
case '+':
- opt = M_ADDRECSRC;
+ opt = MIX_ADDRECSRC;
break;
case '-':
- opt = M_REMOVERECSRC;
+ opt = MIX_REMOVERECSRC;
break;
case '=':
- opt = M_SETRECSRC;
+ opt = MIX_SETRECSRC;
break;
case '^':
- opt = M_TOGGLERECSRC;
+ opt = MIX_TOGGLERECSRC;
break;
default:
warnx("%c: no such modifier", *val);
return;
}
- n = M_ISRECSRC(m, m->dev->devno);
+ n = MIX_ISRECSRC(m, m->dev->devno);
if (mixer_modrecsrc(m, opt) < 0)
warn("%s.%s=%c", m->dev->name, ctls[MCTL_SRC].name, *val);
else
printf("%s.%s: %d -> %d\n",
m->dev->name, ctls[MCTL_SRC].name,
- n, M_ISRECSRC(m, m->dev->devno));
+ n, MIX_ISRECSRC(m, m->dev->devno));
}
static void
@@ -398,12 +398,12 @@ static void
print_mute(struct mixer *m)
{
printf("%s.%s=%d\n", m->dev->name, ctls[MCTL_MUT].name,
- M_ISMUTE(m, m->dev->devno));
+ MIX_ISMUTE(m, m->dev->devno));
}
static void
print_recsrc(struct mixer *m)
{
printf("%s.%s=%d\n",
- m->dev->name, ctls[MCTL_SRC].name, M_ISRECSRC(m, m->dev->devno));
+ m->dev->name, ctls[MCTL_SRC].name, MIX_ISRECSRC(m, m->dev->devno));
}