summaryrefslogtreecommitdiff
path: root/audio/rat
diff options
context:
space:
mode:
authorOrion Hodson <orion@FreeBSD.org>2002-02-24 22:24:06 +0000
committerOrion Hodson <orion@FreeBSD.org>2002-02-24 22:24:06 +0000
commit6e6d30da7983775949dc84b12050a6c94fa75227 (patch)
tree63b187fd7593ed7d3a486eee57f9ae5b7c8d512f /audio/rat
parentUpdate to 20020225.1. Only documentary fixes I forgot to make in (diff)
Sync to rat-4.2.20.
Add newpcm patch for FreeBSD-4.4 upwards.
Notes
Notes: svn path=/head/; revision=55205
Diffstat (limited to 'audio/rat')
-rw-r--r--audio/rat/Makefile25
-rw-r--r--audio/rat/distinfo2
-rw-r--r--audio/rat/files/patch-aa77
-rw-r--r--audio/rat/files/patch-ab11
-rw-r--r--audio/rat/files/patch-ad11
-rw-r--r--audio/rat/files/patch-ae13
-rw-r--r--audio/rat/files/patch-af41
-rw-r--r--audio/rat/files/patch-ah286
-rw-r--r--audio/rat/pkg-plist7
9 files changed, 305 insertions, 168 deletions
diff --git a/audio/rat/Makefile b/audio/rat/Makefile
index 3987d8f45e28..c6cdd7e5787e 100644
--- a/audio/rat/Makefile
+++ b/audio/rat/Makefile
@@ -6,15 +6,16 @@
#
PORTNAME= rat
-PORTVERSION= 4.2.13
+PORTVERSION= 4.2.20
PORTREVISION= 0
CATEGORIES= mbone audio ipv6
-MASTER_SITES= http://www-mice.cs.ucl.ac.uk/multimedia/software/rat/4.2.13/ \
+MASTER_SITES= http://www-mice.cs.ucl.ac.uk/multimedia/software/rat/releases/4.2.20/ \
${MASTER_SITE_LOCAL}
MASTER_SITE_SUBDIR= cpiazza
-MAINTAINER= O.Hodson@cs.ucl.ac.uk
+MAINTAINER= orion@freebsd.org
+TCLTK_VERSION= 8.2
LIB_DEPENDS= tk82.1:${PORTSDIR}/x11-toolkits/tk82
USE_AUTOCONF= yes
@@ -23,6 +24,8 @@ MAN1= rat.1
MANCOMPRESSED= no
RAT_BUILD_DIRS= common rat
+RAT= ${PORTNAME}-${PORTVERSION}
+RAT_SCRIPT= ${PORTNAME}
.include <bsd.port.pre.mk>
@@ -31,20 +34,20 @@ ENABLE_IPv6= --enable-ipv6
.endif
do-install:
- ${INSTALL_PROGRAM} ${WRKSRC}/rat/rat ${PREFIX}/bin/rat
- ${INSTALL_PROGRAM} ${WRKSRC}/rat/rat-ui ${PREFIX}/bin/rat-ui
- ${INSTALL_PROGRAM} ${WRKSRC}/rat/rat-media ${PREFIX}/bin/rat-media
+ ${INSTALL_PROGRAM} ${WRKSRC}/rat/${RAT} ${PREFIX}/bin/${RAT}
+ ${INSTALL_PROGRAM} ${WRKSRC}/rat/${RAT}-ui ${PREFIX}/bin/${RAT}-ui
+ ${INSTALL_PROGRAM} ${WRKSRC}/rat/${RAT}-media ${PREFIX}/bin/${RAT}-media
+ ${INSTALL_SCRIPT} ${WRKSRC}/rat/${RAT_SCRIPT} ${PREFIX}/bin/${RAT_SCRIPT}
${INSTALL_MAN} ${WRKSRC}/rat/man/man1/rat.1 ${PREFIX}/man/man1
${MKDIR} ${LOCALBASE}/etc/sdr/plugins
- ${INSTALL_DATA} ${WRKSRC}/rat/sdr2.plugin.S02.audio.rtp.*.rat ${LOCALBASE}/etc/sdr/plugins
+ ${INSTALL_DATA} ${WRKSRC}/rat/sdr2.plugin.S02.audio.rtp.*.${RAT} ${LOCALBASE}/etc/sdr/plugins
do-build:
-.for d in ${RAT_BUILD_DIRS}
- cd ${WRKSRC}/${d} && ${GMAKE}
-.endfor
+ cd ${WRKSRC}/common/src && ${GMAKE}
+ cd ${WRKSRC}/rat && ${GMAKE}
do-configure:
cd ${WRKSRC}/common && ${AUTOCONF} && ./configure ${CONFIGURE_ARGS} ${ENABLE_IPv6}
- cd ${WRKSRC}/rat && ${AUTOCONF} && ./configure ${CONFIGURE_ARGS} --with-tcl=${LOCALBASE} --with-tk=${LOCALBASE} ${ENABLE_IPv6}
+ cd ${WRKSRC}/rat && ${AUTOCONF} && ./configure ${CONFIGURE_ARGS} --with-tcl=${LOCALBASE} --with-tk=${LOCALBASE} ${ENABLE_IPv6} --with-tcltk-version=${TCLTK_VERSION}
.include "bsd.port.post.mk"
diff --git a/audio/rat/distinfo b/audio/rat/distinfo
index 1edf6ef3ac6a..dc4cad16824c 100644
--- a/audio/rat/distinfo
+++ b/audio/rat/distinfo
@@ -1 +1 @@
-MD5 (rat-4.2.13.tar.gz) = 6524f9805772e60072de8769aea1945f
+MD5 (rat-4.2.20.tar.gz) = 011d6f446b627d45dc3b171f3f4d724a
diff --git a/audio/rat/files/patch-aa b/audio/rat/files/patch-aa
deleted file mode 100644
index c6fb8667dda0..000000000000
--- a/audio/rat/files/patch-aa
+++ /dev/null
@@ -1,77 +0,0 @@
---- rat/configure.in.orig Fri Mar 2 12:49:10 2001
-+++ rat/configure.in Thu Apr 5 19:13:17 2001
-@@ -280,12 +280,12 @@
- # We could be dealing with a source installation or a full installation.
- # Expect a source installation to have headers in TCL8_HOME/generic and libs in
- # TCL8_HOME/unix. A full installation should have headers in
--# INSTDIR/include/tcl8.0, or INSTDIR/include, and have libraries be in
-+# INSTDIR/include/tcl8.2, or INSTDIR/include, and have libraries be in
- # INSTDIR/lib.
- #------------------------------------------------------------------------------
- PARENT=`echo $PWD | sed -e 's%/[[^/]]*$%%'`
--TCL_INC=${PARENT}/tcl-8.0
--TCL_LIB=${PARENT}/tcl-8.0
-+TCL_INC=${PARENT}/tcl-8.2
-+TCL_LIB=${PARENT}/tcl-8.2
-
- AC_ARG_WITH(tcl,
- [ --with-tcl=DIR specify location of Tcl installation],
-@@ -295,7 +295,7 @@
- #-----------------------------------------------------------------------------
- # Depending on config expect tcl.h to be tcl source dir or include path
- #-----------------------------------------------------------------------------
--for i in $TCL_INC/generic $TCL_INC/include/tcl8.0 $TCL_INC/include $TCL_INC
-+for i in $TCL_INC/generic $TCL_INC/include/tcl8.2 $TCL_INC/include $TCL_INC
- do
- if test -d $i ; then
- TCL_INC=$i
-@@ -330,7 +330,7 @@
- SAVED_LIBS=$LIBS
- LIBS=""
- FOUND_TCL_LIB=no
--AC_SEARCH_LIBS(Tcl_Init, tcl8.0 tcl80,
-+AC_SEARCH_LIBS(Tcl_Init, tcl8.2 tcl82,
- FOUND_TCL_LIB=yes,
- ,
- -L${TCL_LIB} ${SAVED_LIBS} -lm)
-@@ -359,7 +359,7 @@
- # include tcl.h, Xlib.h, Xutil.h before tk.h.
- #-----------------------------------------------------------------------------
- FOUND_TK_INC=0
--for i in $TK_INC/generic $TK_INC/include/tk8.0 $TK_INC/include $TK_INC
-+for i in $TK_INC/generic $TK_INC/include/tk8.2 $TK_INC/include $TK_INC
- do
- AC_MSG_CHECKING(for $i/tk.h)
- if test -r $i/tk.h ; then
-@@ -391,7 +391,7 @@
- SAVED_LIBS=$LIBS
- LIBS=""
- FOUND_TK_LIB=no
--AC_SEARCH_LIBS(Tk_Init, tk8.0 tk80,
-+AC_SEARCH_LIBS(Tk_Init, tk8.2 tk82,
- FOUND_TK_LIB=yes,
- ,
- -L${TK_LIB} ${TCL_LIB} $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS ${SAVED_LIBS} -lm)
-@@ -464,20 +464,8 @@
- COMMON_LIB=${COMMON_LIB}/lib
- fi
-
--AC_CHECK_LIB(uclmmbase,
-- mbus_init,
-- [
-- EXTERNAL_DEP="${EXTERNAL_DEP} ${COMMON_LIB}/libuclmmbase.a"
-- COMMON_LIB="-L${COMMON_LIB} -luclmmbase"
-- ],
-- [
-- echo "Could not find libuclmmbase.a. One of the following halted progess:"
-- echo " (a) Library is not installed."
-- echo " (b) Library is not built or not in expected location (--with-common=DIR)."
-- echo " (c) this script failed to see it (please inform rat-trap@cs.ucl.ac.uk)."
-- exit
-- ],
-- -L${COMMON_LIB})
-+EXTERNAL_DEP="${EXTERNAL_DEP} ${COMMON_LIB}/libuclmmbase.a"
-+COMMON_LIB="-L${COMMON_LIB} -luclmmbase"
-
- AC_SUBST(COMMON_INC)
- AC_SUBST(COMMON_LIB)
diff --git a/audio/rat/files/patch-ab b/audio/rat/files/patch-ab
deleted file mode 100644
index 4df1138df8e8..000000000000
--- a/audio/rat/files/patch-ab
+++ /dev/null
@@ -1,11 +0,0 @@
---- rat/sdr2.plugin.in.orig Sat Sep 16 19:54:48 2000
-+++ rat/sdr2.plugin.in Sat Sep 16 19:55:02 2000
-@@ -14,7 +14,7 @@
-
- media:audio
- proto:RTP/AVP
--tool:rat-VERSION
-+tool:rat
- protoname:RTP
- cryptflag:-K
-
diff --git a/audio/rat/files/patch-ad b/audio/rat/files/patch-ad
deleted file mode 100644
index aa499c0f54ab..000000000000
--- a/audio/rat/files/patch-ad
+++ /dev/null
@@ -1,11 +0,0 @@
---- rat/Makefile.in.orig Sat Sep 16 20:45:21 2000
-+++ rat/Makefile.in Sat Sep 16 20:45:29 2000
-@@ -15,7 +15,7 @@
- ECHO = echo
-
- VERSION = @VERSION@
--RATVER = rat-$(VERSION)
-+RATVER = rat
-
- AU_OBJ = @AU_OBJ@
- AU_INC = @AU_INC@
diff --git a/audio/rat/files/patch-ae b/audio/rat/files/patch-ae
deleted file mode 100644
index d4383c889d1d..000000000000
--- a/audio/rat/files/patch-ae
+++ /dev/null
@@ -1,13 +0,0 @@
---- rat/main_control.c.brokenbin Sun Sep 17 02:26:19 2000
-+++ rat/main_control.c Sun Sep 17 02:26:38 2000
-@@ -34,8 +34,8 @@
- #define ENGINE_NAME "ratmedia.exe"
- #define CONTROL_NAME "rat.exe"
- #else
--#define UI_NAME "rat-"RAT_VERSION"-ui"
--#define ENGINE_NAME "rat-"RAT_VERSION"-media"
-+#define UI_NAME "rat-ui"
-+#define ENGINE_NAME "rat-media"
- #endif
-
- #define DEFAULT_RTP_PORT 5004
diff --git a/audio/rat/files/patch-af b/audio/rat/files/patch-af
deleted file mode 100644
index f6f25611a616..000000000000
--- a/audio/rat/files/patch-af
+++ /dev/null
@@ -1,41 +0,0 @@
---- rat/Makefile.in.prefix Fri Sep 8 21:02:41 2000
-+++ rat/Makefile.in Sun Sep 17 03:00:53 2000
-@@ -13,6 +13,7 @@
- AR = ar
- RANLIB = @RANLIB@
- ECHO = echo
-+STRIP = strip
-
- VERSION = @VERSION@
- RATVER = rat-$(VERSION)
-@@ -122,7 +123,7 @@
- @${ECHO} "Generating version.h"
- @sed -e 's/.*/#define RAT_VERSION "&"/' VERSION > version.h
-
--sdr2.plugin.S02.audio.rtp.-.rat-$(VERSION): sdr2.plugin.in
-+sdr2.plugin.S02.audio.rtp.-.$(RATVER): sdr2.plugin.in
- @${ECHO} "Generating sdr plugin"
- @${ECHO} "# Generated automatically from sdr2.plugin.in" > $@
- @${ECHO} "# DO NOT EDIT THIS FILE" >> $@
-@@ -147,9 +148,9 @@
- -rm -rf core core-$(RATVER)-media core-$(RATVER)-ui
-
- install: all
-- ./install-sh -m 555 -c $(RATVER) $(bindir)
-- ./install-sh -m 555 -c $(RATVER)-media $(bindir)
-- ./install-sh -m 555 -c $(RATVER)-ui $(bindir)
-+ ./install-sh -m 555 -s $(STRIP) -c $(RATVER) $(bindir)
-+ ./install-sh -m 555 -s $(STRIP) -c $(RATVER)-media $(bindir)
-+ ./install-sh -m 555 -s $(STRIP) -c $(RATVER)-ui $(bindir)
- ./install-sh -m 444 -c man/man1/rat.1 $(mandir)/man1/rat.1
- ./install-sh -m 444 -c sdr2.plugin.S02.audio.rtp.-.$(RATVER) $(prefix)/etc/sdr/plugins
-
-@@ -180,7 +181,7 @@
- cvs tag release-`cat VERSION | sed "s/\./-/g"`
-
- $(RATVER)-$(OSTYPE).tar.gz: $(RATVER) $(RATVER)-ui $(RATVER)-media
-- tar cf $(RATVER)-$(OSTYPE).tar README.* MODS COPYRIGHT INSTALL.TXT VERSION $(RATVER) $(RATVER)-ui $(RATVER)-media sdr2.plugin.S02.audio.rtp.-.rat-$(VERSION)
-+ tar cf $(RATVER)-$(OSTYPE).tar README.* MODS COPYRIGHT INSTALL.TXT VERSION $(RATVER) $(RATVER)-ui $(RATVER)-media sdr2.plugin.S02.audio.rtp.-.$(RATVER)
- rm -f $(RATVER)-$(OSTYPE).tar.gz
- gzip -9 $(RATVER)-$(OSTYPE).tar
-
diff --git a/audio/rat/files/patch-ah b/audio/rat/files/patch-ah
new file mode 100644
index 000000000000..e4b2b41eb216
--- /dev/null
+++ b/audio/rat/files/patch-ah
@@ -0,0 +1,286 @@
+Index: auddev_newpcm.c
+===================================================================
+RCS file: /cs/research/mice/starship/src/local/CVS_repository/rat/auddev_newpcm.c,v
+retrieving revision 1.17
+retrieving revision 1.18
+diff -u -r1.17 -r1.18
+--- rat/auddev_newpcm.c 2001/02/28 20:15:02 1.17
++++ rat/auddev_newpcm.c 2002/02/24 21:13:47 1.18
+@@ -9,7 +9,7 @@
+
+ #ifndef HIDE_SOURCE_STRINGS
+ static const char cvsid[] =
+-"$Id: auddev_newpcm.c,v 1.17 2001/02/28 20:15:02 ucacoxh Exp $";
++"$Id: auddev_newpcm.c,v 1.18 2002/02/24 21:13:47 ucacoxh Exp $";
+ #endif /* HIDE_SOURCE_STRINGS */
+
+ #include "config_unix.h"
+@@ -26,15 +26,32 @@
+ #include <dirent.h>
+ #include <errno.h>
+
++/* #define DEBUG_JUST_NEWPCM if not using debug-enable and want err msgs */
++#ifdef DEBUG_JUST_NEWPCM
++#undef debug_msg
++#define debug_msg(x...) fprintf(stderr, x)
++#endif /* DEBUG_JUST_NEWPCM */
++
+ static char *port_names[] = SOUND_DEVICE_LABELS;
+ static int iport, oport, loop;
+ static snd_chan_param pa;
+ static struct snd_size sz;
+ static int audio_fd = -1;
++static int mixer_fd = -1;
+
+ #define RAT_TO_DEVICE(x) ((x) * 100 / MAX_AMP)
+ #define DEVICE_TO_RAT(x) ((x) * MAX_AMP / 100)
+
++#define MIXER_CHECK0(fd) if ((fd) < 0) { \
++ debug_msg("Failed mixer checked\n"); \
++ return; \
++ }
++
++#define MIXER_CHECK1(fd, err) if ((fd) < 0) { \
++ debug_msg("Failed mixer checked\n"); \
++ return (err); \
++ }
++
+ #define NEWPCM_AUDIO_IOCTL(fd, cmd, val) \
+ newpcm_error = 0; \
+ if (ioctl((fd), (cmd), (val)) < 0) { \
+@@ -53,6 +70,7 @@
+ static audio_format *input_format, *output_format, *tmp_format;
+ static snd_capabilities soundcaps[NEWPCM_MAX_AUDIO_DEVICES];
+
++static int newpcm_mixer_open(const char* audiodev);
+ static void newpcm_mixer_save(int fd);
+ static void newpcm_mixer_restore(int fd);
+ static void newpcm_mixer_init(int fd);
+@@ -76,17 +94,15 @@
+ /* Ignore any earlier errors */
+ newpcm_error = 0;
+
+- newpcm_mixer_save(audio_fd);
+-
+ NEWPCM_AUDIO_IOCTL(audio_fd, AIOGCAP, &soundcaps[ad]);
+- debug_msg("soundcaps[%d].rate_min = %d\n", ad, soundcaps[ad].rate_min);
+- debug_msg("soundcaps[%d].rate_max = %d\n", ad, soundcaps[ad].rate_max);
++ debug_msg("soundcaps[%d].rate_min = %ld\n", ad, soundcaps[ad].rate_min);
++ debug_msg("soundcaps[%d].rate_max = %ld\n", ad, soundcaps[ad].rate_max);
+ debug_msg("soundcaps[%d].formats = 0x%08lx\n", ad, soundcaps[ad].formats);
+- debug_msg("soundcaps[%d].bufsize = %d\n", ad, soundcaps[ad].bufsize);
++ debug_msg("soundcaps[%d].bufsize = %ld\n", ad, soundcaps[ad].bufsize);
+ debug_msg("soundcaps[%d].mixers = 0x%08lx\n", ad, soundcaps[ad].mixers);
+ debug_msg("soundcaps[%d].inputs = 0x%08lx\n", ad, soundcaps[ad].inputs);
+- debug_msg("soundcaps[%d].left = 0x%04lx\n", ad, soundcaps[ad].left);
+- debug_msg("soundcaps[%d].right = 0x%04lx\n", ad, soundcaps[ad].right);
++ debug_msg("soundcaps[%d].left = 0x%04x\n", ad, soundcaps[ad].left);
++ debug_msg("soundcaps[%d].right = 0x%04x\n", ad, soundcaps[ad].right);
+
+ /* Setup input and output format settings */
+ assert(ofmt->channels == ifmt->channels);
+@@ -125,7 +141,7 @@
+ (IN_RANGE((uint32_t)ifmt->sample_rate,
+ soundcaps[ad].rate_min,
+ soundcaps[ad].rate_max) == 0)) {
+- debug_msg("(%d or %d) out of range %d -- %d Hz\n",
++ debug_msg("(%d or %d) out of range %ld -- %ld Hz\n",
+ ofmt->sample_rate,
+ ifmt->sample_rate,
+ soundcaps[ad].rate_min,
+@@ -190,7 +206,9 @@
+ }
+ output_format = tmp_format;
+
+- newpcm_mixer_init(audio_fd);
++ mixer_fd = newpcm_mixer_open(thedev);
++ newpcm_mixer_save(mixer_fd);
++ newpcm_mixer_init(mixer_fd);
+ /* Turn off loopback from input to output... not fatal so
+ * after error check.
+ */
+@@ -224,10 +242,14 @@
+ if (output_format != NULL) {
+ audio_format_free(&output_format);
+ }
+- newpcm_mixer_restore(audio_fd);
++
+ newpcm_audio_drain(audio_fd);
+ close(audio_fd);
+ audio_fd = -1;
++
++ newpcm_mixer_restore(mixer_fd);
++ close(mixer_fd);
++ mixer_fd = -1;
+ }
+
+ /* Flush input buffer */
+@@ -380,8 +402,9 @@
+ {
+ int volume, lgport, op;
+
+- UNUSED(ad); assert(audio_fd > 0);
+-
++ MIXER_CHECK0(mixer_fd);
++
++ UNUSED(ad);
+ vol = RAT_TO_DEVICE(vol);
+ volume = vol << 8 | vol;
+ lgport = -1;
+@@ -391,7 +414,7 @@
+ lgport ++;
+ }
+
+- NEWPCM_AUDIO_IOCTL(audio_fd, MIXER_WRITE(lgport), &volume);
++ NEWPCM_AUDIO_IOCTL(mixer_fd, MIXER_WRITE(lgport), &volume);
+ }
+
+ int
+@@ -399,7 +422,8 @@
+ {
+ int volume, lgport, op;
+
+- UNUSED(ad); assert(audio_fd > 0);
++ UNUSED(ad);
++ MIXER_CHECK1(mixer_fd, 0);
+
+ lgport = -1;
+ op = oport;
+@@ -408,7 +432,7 @@
+ lgport ++;
+ }
+
+- NEWPCM_AUDIO_IOCTL(audio_fd, MIXER_READ(lgport), &volume);
++ NEWPCM_AUDIO_IOCTL(mixer_fd, MIXER_READ(lgport), &volume);
+ volume = DEVICE_TO_RAT(volume & 0xff);
+ if (volume > 100 || volume < 0) {
+ debug_msg("gain out of bounds (%08x %d--%d)" \
+@@ -468,17 +492,19 @@
+ int volume = RAT_TO_DEVICE(gain);
+ volume |= (volume << 8);
+
+- UNUSED(ad); assert(audio_fd > 0);
++ UNUSED(ad);
++ MIXER_CHECK0(mixer_fd);
++
+ newpcm_audio_loopback_config(gain);
+ /* Try AC97 */
+- NEWPCM_AUDIO_IOCTL(audio_fd, SOUND_MIXER_WRITE_RECLEV, &volume);
++ NEWPCM_AUDIO_IOCTL(mixer_fd, SOUND_MIXER_WRITE_RECLEV, &volume);
+
+ if (newpcm_error != 0 && iport != 0) {
+ /* Fallback to non-ac97 */
+ int idx = 1;
+ while ((1 << idx) != iport)
+ idx++;
+- NEWPCM_AUDIO_IOCTL(audio_fd, MIXER_WRITE(idx), &volume);
++ NEWPCM_AUDIO_IOCTL(mixer_fd, MIXER_WRITE(idx), &volume);
+ }
+ }
+
+@@ -487,15 +513,17 @@
+ {
+ int volume = 0;
+
+- UNUSED(ad); assert(audio_fd > 0);
++ UNUSED(ad);
++ MIXER_CHECK1(mixer_fd, 0);
++
+ /* Try AC97 */
+- NEWPCM_AUDIO_IOCTL(audio_fd, SOUND_MIXER_READ_RECLEV, &volume);
++ NEWPCM_AUDIO_IOCTL(mixer_fd, SOUND_MIXER_READ_RECLEV, &volume);
+ if (newpcm_error != 0 && iport != 0) {
+ /* Fallback to non-ac97 */
+ int idx = 1;
+ while ((1 << idx) != iport)
+ idx++;
+- NEWPCM_AUDIO_IOCTL(audio_fd, MIXER_READ(idx), &volume);
++ NEWPCM_AUDIO_IOCTL(mixer_fd, MIXER_READ(idx), &volume);
+ }
+ volume = DEVICE_TO_RAT(volume & 0xff);
+ if (volume > 100 || volume < 0) {
+@@ -512,6 +540,8 @@
+ /* Check port is in record mask */
+ int gain;
+
++ MIXER_CHECK0(mixer_fd);
++
+ debug_msg("port 0x%08x recmask 0x%08x\n", port, recmask);
+
+ if ((port & recmask) == 0) {
+@@ -520,7 +550,7 @@
+ return;
+ }
+
+- if (ioctl(audio_fd, SOUND_MIXER_WRITE_RECSRC, &port) < 0) {
++ if (ioctl(mixer_fd, SOUND_MIXER_WRITE_RECSRC, &port) < 0) {
+ perror("Unable to write record mask\n");
+ return;
+ }
+@@ -571,6 +601,8 @@
+ {
+ int lgport, vol;
+
++ MIXER_CHECK0(mixer_fd);
++
+ /* Find current input port id */
+ lgport = newpcm_get_nth_port_mask(iport, 0);
+
+@@ -580,7 +612,7 @@
+ vol = 0;
+ }
+
+- NEWPCM_AUDIO_IOCTL(audio_fd, MIXER_WRITE(lgport), &vol);
++ NEWPCM_AUDIO_IOCTL(mixer_fd, MIXER_WRITE(lgport), &vol);
+ }
+
+ void
+@@ -706,6 +738,48 @@
+ return dummy;
+ }
+ return NULL;
++}
++
++/* Mixer open / close related */
++
++static int
++newpcm_mixer_device(const char* audiodev)
++{
++ const char* p = audiodev;
++ int devno = 0;
++
++ /*
++ * Audio device looks like "/dev/fooN" or "dev/foo/N.n"
++ * and we want "N"
++ */
++ while (p && !isnumber(*p))
++ p++;
++ while (p && isnumber(*p)) {
++ devno = devno * 10 + (*p - '0');
++ p++;
++ }
++ assert(devno < 20);
++ return devno;
++}
++
++static int
++newpcm_mixer_open(const char* audiodev)
++{
++ char mixer_name[32] = "/dev/mixerXXX";
++ int m;
++
++#define END_OF_DEV_MIXER 10
++ sprintf(mixer_name + END_OF_DEV_MIXER,
++ "%d", newpcm_mixer_device(audiodev));
++
++ m = open(mixer_name, O_RDWR);
++ if (m < 0) {
++ fprintf(stderr, "Could not open %s (%s): "
++ "mixer operations will not work.\n",
++ mixer_name, strerror(errno));
++ return 0;
++ }
++ return m;
+ }
+
+ /* Functions to save and restore recording source and mixer levels */
diff --git a/audio/rat/pkg-plist b/audio/rat/pkg-plist
index e0000def1a7c..940ec6bbbf82 100644
--- a/audio/rat/pkg-plist
+++ b/audio/rat/pkg-plist
@@ -1,6 +1,7 @@
+bin/rat-4.2.20
+bin/rat-4.2.20-ui
+bin/rat-4.2.20-media
bin/rat
-bin/rat-ui
-bin/rat-media
-etc/sdr/plugins/sdr2.plugin.S02.audio.rtp.-.rat
+etc/sdr/plugins/sdr2.plugin.S02.audio.rtp.-.rat-4.2.20
@dirrm etc/sdr/plugins
@dirrm etc/sdr