summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2011-10-17 21:09:12 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2011-10-17 21:09:12 +0000
commitcd90aa38151068c861041641b0e4e40b3afa4fae (patch)
tree12bfda26b4b359086eeb1a5912967b20a36934f0
parente796f6ed824da5e9e191c2ab4bd774e6efa3392f (diff)
Remove midicat since aucat can now be used instead of midicat
with almost the same syntax (roughly an extra -M option). Thru boxes are created with aucat, and corresponding MIDI port names have the "aucat" prefix instead of "midithru". The old device name will still work some time for backward compatibility. ok deraadt
-rw-r--r--lib/libsndio/amsg.h4
-rw-r--r--lib/libsndio/aucat.c24
-rw-r--r--lib/libsndio/aucat.h2
-rw-r--r--lib/libsndio/mio.c6
-rw-r--r--lib/libsndio/mio_aucat.c20
-rw-r--r--lib/libsndio/mio_open.324
-rw-r--r--lib/libsndio/mio_priv.h3
-rw-r--r--lib/libsndio/sio_aucat.c4
-rw-r--r--lib/libsndio/sio_open.310
-rw-r--r--lib/libsndio/sndio.762
-rw-r--r--usr.bin/aucat/Makefile5
-rw-r--r--usr.bin/aucat/aucat.110
-rw-r--r--usr.bin/aucat/aucat.c25
-rw-r--r--usr.bin/aucat/midicat.1215
14 files changed, 69 insertions, 345 deletions
diff --git a/lib/libsndio/amsg.h b/lib/libsndio/amsg.h
index d6370a2628f..2cf7dd04e4b 100644
--- a/lib/libsndio/amsg.h
+++ b/lib/libsndio/amsg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amsg.h,v 1.2 2011/04/28 06:19:57 ratchov Exp $ */
+/* $OpenBSD: amsg.h,v 1.3 2011/10/17 21:09:11 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -24,8 +24,6 @@
*/
#define AUCAT_PATH "aucat"
#define AUCAT_PORT 11025
-#define MIDICAT_PATH "midicat"
-#define MIDICAT_PORT 11041
#define DEFAULT_OPT "default"
/*
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c
index 6936a912ac6..7c563ea8ddb 100644
--- a/lib/libsndio/aucat.c
+++ b/lib/libsndio/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.50 2011/10/05 16:15:43 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.51 2011/10/17 21:09:11 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -280,7 +280,7 @@ bad_gen:
}
int
-aucat_connect_tcp(struct aucat *hdl, char *host, char *unit, int isaudio)
+aucat_connect_tcp(struct aucat *hdl, char *host, char *unit)
{
int s, error, opt;
struct addrinfo *ailist, *ai, aihints;
@@ -291,11 +291,7 @@ aucat_connect_tcp(struct aucat *hdl, char *host, char *unit, int isaudio)
DPRINTF("%s: bad unit number\n", unit);
return 0;
}
- if (isaudio)
- port += AUCAT_PORT;
- else
- port += MIDICAT_PORT;
- snprintf(serv, sizeof(serv), "%u", port);
+ snprintf(serv, sizeof(serv), "%u", port + AUCAT_PORT);
memset(&aihints, 0, sizeof(struct addrinfo));
aihints.ai_socktype = SOCK_STREAM;
aihints.ai_protocol = IPPROTO_TCP;
@@ -336,18 +332,16 @@ aucat_connect_tcp(struct aucat *hdl, char *host, char *unit, int isaudio)
}
int
-aucat_connect_un(struct aucat *hdl, char *unit, int isaudio)
+aucat_connect_un(struct aucat *hdl, char *unit)
{
struct sockaddr_un ca;
socklen_t len = sizeof(struct sockaddr_un);
- char *sock;
uid_t uid;
int s;
uid = geteuid();
- sock = isaudio ? AUCAT_PATH : MIDICAT_PATH;
snprintf(ca.sun_path, sizeof(ca.sun_path),
- "/tmp/aucat-%u/%s%s", uid, sock, unit);
+ "/tmp/aucat-%u/%s%s", uid, AUCAT_PATH, unit);
ca.sun_family = AF_UNIX;
s = socket(AF_UNIX, SOCK_STREAM, 0);
if (s < 0)
@@ -358,7 +352,7 @@ aucat_connect_un(struct aucat *hdl, char *unit, int isaudio)
DPERROR(ca.sun_path);
/* try shared server */
snprintf(ca.sun_path, sizeof(ca.sun_path),
- "/tmp/aucat/%s%s", sock, unit);
+ "/tmp/aucat/%s%s", AUCAT_PATH, unit);
while (connect(s, (struct sockaddr *)&ca, len) < 0) {
if (errno == EINTR)
continue;
@@ -373,7 +367,7 @@ aucat_connect_un(struct aucat *hdl, char *unit, int isaudio)
}
int
-aucat_open(struct aucat *hdl, const char *str, unsigned mode, int isaudio)
+aucat_open(struct aucat *hdl, const char *str, unsigned mode)
{
extern char *__progname;
int eof, hashost;
@@ -409,10 +403,10 @@ aucat_open(struct aucat *hdl, const char *str, unsigned mode, int isaudio)
}
DPRINTF("aucat_init: trying %s -> %s.%s\n", str, unit, opt);
if (hashost) {
- if (!aucat_connect_tcp(hdl, host, unit, isaudio))
+ if (!aucat_connect_tcp(hdl, host, unit))
return 0;
} else {
- if (!aucat_connect_un(hdl, unit, isaudio))
+ if (!aucat_connect_un(hdl, unit))
return 0;
}
if (fcntl(hdl->fd, F_SETFD, FD_CLOEXEC) < 0) {
diff --git a/lib/libsndio/aucat.h b/lib/libsndio/aucat.h
index ab180303592..6598d70aadb 100644
--- a/lib/libsndio/aucat.h
+++ b/lib/libsndio/aucat.h
@@ -20,7 +20,7 @@ int aucat_rmsg(struct aucat *, int *);
int aucat_wmsg(struct aucat *, int *);
size_t aucat_rdata(struct aucat *, void *, size_t, int *);
size_t aucat_wdata(struct aucat *, const void *, size_t, unsigned, int *);
-int aucat_open(struct aucat *, const char *, unsigned, int);
+int aucat_open(struct aucat *, const char *, unsigned);
void aucat_close(struct aucat *, int);
int aucat_pollfd(struct aucat *, struct pollfd *, int);
int aucat_revents(struct aucat *, struct pollfd *);
diff --git a/lib/libsndio/mio.c b/lib/libsndio/mio.c
index 397d713346c..55631863df3 100644
--- a/lib/libsndio/mio.c
+++ b/lib/libsndio/mio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mio.c,v 1.11 2011/05/06 07:30:20 ratchov Exp $ */
+/* $OpenBSD: mio.c,v 1.12 2011/10/17 21:09:11 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -49,7 +49,7 @@ mio_open(const char *str, unsigned mode, int nbio)
if (str == NULL && !issetugid())
str = getenv("MIDIDEVICE");
if (str == NULL) {
- hdl = mio_midithru_open("0", mode, nbio);
+ hdl = mio_aucat_open("0", mode, nbio);
if (hdl != NULL)
return hdl;
return mio_rmidi_open("0", mode, nbio);
@@ -62,7 +62,7 @@ mio_open(const char *str, unsigned mode, int nbio)
len = sep - str;
if (len == (sizeof(prefix_midithru) - 1) &&
memcmp(str, prefix_midithru, len) == 0)
- return mio_midithru_open(sep + 1, mode, nbio);
+ return mio_aucat_open(sep + 1, mode, nbio);
if (len == (sizeof(prefix_aucat) - 1) &&
memcmp(str, prefix_aucat, len) == 0)
return mio_aucat_open(sep + 1, mode, nbio);
diff --git a/lib/libsndio/mio_aucat.c b/lib/libsndio/mio_aucat.c
index bccc94b7ffd..5c2e55450fe 100644
--- a/lib/libsndio/mio_aucat.c
+++ b/lib/libsndio/mio_aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mio_aucat.c,v 1.4 2011/04/18 23:57:35 ratchov Exp $ */
+/* $OpenBSD: mio_aucat.c,v 1.5 2011/10/17 21:09:11 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -51,15 +51,15 @@ static struct mio_ops mio_aucat_ops = {
mio_aucat_revents,
};
-static struct mio_hdl *
-mio_xxx_open(const char *str, unsigned mode, int nbio, int isaudio)
+struct mio_hdl *
+mio_aucat_open(const char *str, unsigned mode, int nbio)
{
struct mio_aucat_hdl *hdl;
hdl = malloc(sizeof(struct mio_aucat_hdl));
if (hdl == NULL)
return NULL;
- if (!aucat_open(&hdl->aucat, str, mode, isaudio))
+ if (!aucat_open(&hdl->aucat, str, mode))
goto bad;
mio_create(&hdl->mio, &mio_aucat_ops, mode, nbio);
if (!aucat_setfl(&hdl->aucat, nbio, &hdl->mio.eof))
@@ -70,18 +70,6 @@ bad:
return NULL;
}
-struct mio_hdl *
-mio_midithru_open(const char *str, unsigned mode, int nbio)
-{
- return mio_xxx_open(str, mode, nbio, 0);
-}
-
-struct mio_hdl *
-mio_aucat_open(const char *str, unsigned mode, int nbio)
-{
- return mio_xxx_open(str, mode, nbio, 1);
-}
-
static void
mio_aucat_close(struct mio_hdl *sh)
{
diff --git a/lib/libsndio/mio_open.3 b/lib/libsndio/mio_open.3
index 76f5b03f2e6..030fabe2027 100644
--- a/lib/libsndio/mio_open.3
+++ b/lib/libsndio/mio_open.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: mio_open.3,v 1.4 2011/04/16 10:52:22 ratchov Exp $
+.\" $OpenBSD: mio_open.3,v 1.5 2011/10/17 21:09:11 ratchov Exp $
.\"
.\" Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: April 16 2011 $
+.Dd $Mdocdate: October 17 2011 $
.Dt MIO_OPEN 3
.Os
.Sh NAME
@@ -51,8 +51,8 @@ The
library allows user processes to access
.Xr midi 4
hardware and
-.Xr midicat 1
-MIDI thru boxes in a uniform way.
+.Xr aucat 1
+MIDI thru boxes and control ports in a uniform way.
.Ss Opening and closing an MIDI stream
First the application must call the
.Fn mio_open
@@ -63,10 +63,10 @@ argument of most other functions.
The
.Fn mio_open
function tries to connect to the
-.Xr midicat 1
-software MIDI thru box or to use the
+.Xr aucat 1
+MIDI thru box or to use the
.Xr midi 4
-hardware device.
+hardware port.
The
.Ar name
parameter gives the device string discussed in
@@ -232,22 +232,22 @@ and
.Fn mio_write
functions return the number of bytes transferred.
.Sh ENVIRONMENT
-.Bl -tag -width "MIO_DEBUGXXX" -compact
+.Bl -tag -width "SNDIO_DEBUGXXX" -compact
.It Ev SNDIO_DEBUG
The debug level:
may be a value between 0 and 2.
.El
.Sh FILES
-.Bl -tag -width "/tmp/aucat-<uid>/midithru0" -compact
-.It Pa /tmp/aucat-<uid>/midithru0
+.Bl -tag -width "/tmp/aucat-<uid>/aucat0" -compact
+.It Pa /tmp/aucat-<uid>/aucat0
Default path to
-.Xr midicat 1
+.Xr aucat 1
socket to connect to.
.It Pa /dev/rmidiX
.Xr midi 4
devices.
.El
.Sh SEE ALSO
-.Xr midicat 1 ,
+.Xr aucat 1 ,
.Xr midi 4 ,
.Xr sndio 7
diff --git a/lib/libsndio/mio_priv.h b/lib/libsndio/mio_priv.h
index 51ef244bc1d..dd22ca80bce 100644
--- a/lib/libsndio/mio_priv.h
+++ b/lib/libsndio/mio_priv.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mio_priv.h,v 1.6 2011/04/16 10:52:22 ratchov Exp $ */
+/* $OpenBSD: mio_priv.h,v 1.7 2011/10/17 21:09:11 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -42,7 +42,6 @@ struct mio_ops {
};
struct mio_hdl *mio_rmidi_open(const char *, unsigned, int);
-struct mio_hdl *mio_midithru_open(const char *, unsigned, int);
struct mio_hdl *mio_aucat_open(const char *, unsigned, int);
void mio_create(struct mio_hdl *, struct mio_ops *, unsigned, int);
void mio_destroy(struct mio_hdl *);
diff --git a/lib/libsndio/sio_aucat.c b/lib/libsndio/sio_aucat.c
index a3f9472993d..2fbdea23492 100644
--- a/lib/libsndio/sio_aucat.c
+++ b/lib/libsndio/sio_aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio_aucat.c,v 1.7 2011/06/03 18:09:25 ratchov Exp $ */
+/* $OpenBSD: sio_aucat.c,v 1.8 2011/10/17 21:09:11 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -156,7 +156,7 @@ sio_aucat_open(const char *str, unsigned mode, int nbio)
hdl = malloc(sizeof(struct sio_aucat_hdl));
if (hdl == NULL)
return NULL;
- if (!aucat_open(&hdl->aucat, str, mode, 1)) {
+ if (!aucat_open(&hdl->aucat, str, mode)) {
free(hdl);
return NULL;
}
diff --git a/lib/libsndio/sio_open.3 b/lib/libsndio/sio_open.3
index a6a96ce4c8b..d02d07e0fdb 100644
--- a/lib/libsndio/sio_open.3
+++ b/lib/libsndio/sio_open.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sio_open.3,v 1.28 2011/10/04 20:58:27 jmc Exp $
+.\" $OpenBSD: sio_open.3,v 1.29 2011/10/17 21:09:11 ratchov Exp $
.\"
.\" Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 4 2011 $
+.Dd $Mdocdate: October 17 2011 $
.Dt SIO_OPEN 3
.Os
.Sh NAME
@@ -722,7 +722,7 @@ and
.Fn sio_write
functions return the number of bytes transferred.
.Sh ENVIRONMENT
-.Bl -tag -width "AUDIODEVICEXXX" -compact
+.Bl -tag -width "SNDIO_DEBUGXXX" -compact
.It Ev AUDIODEVICE
Device to use if
.Fn sio_open
@@ -734,8 +734,8 @@ The debug level:
may be a value between 0 and 2.
.El
.Sh FILES
-.Bl -tag -width "/tmp/aucat-<uid>/softaudio0" -compact
-.It Pa /tmp/aucat-<uid>/softaudio0
+.Bl -tag -width "/tmp/aucat-<uid>/aucat0" -compact
+.It Pa /tmp/aucat-<uid>/aucat0
Default path to
.Xr aucat 1
socket to connect to.
diff --git a/lib/libsndio/sndio.7 b/lib/libsndio/sndio.7
index 39132a66c95..81dbb3ad23d 100644
--- a/lib/libsndio/sndio.7
+++ b/lib/libsndio/sndio.7
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sndio.7,v 1.5 2011/06/03 18:57:51 ratchov Exp $
+.\" $OpenBSD: sndio.7,v 1.6 2011/10/17 21:09:11 ratchov Exp $
.\"
.\" Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 3 2011 $
+.Dd $Mdocdate: October 17 2011 $
.Dt SNDIO 7
.Os
.Sh NAME
@@ -25,9 +25,7 @@ The
.Nm sndio
audio and MIDI system provides access to audio and MIDI hardware and
to services provided by
-.Xr aucat 1
-and
-.Xr midicat 1 ,
+.Xr aucat 1 ,
summarized below.
.Pp
Hardware
@@ -59,27 +57,25 @@ Software MIDI thru boxes allow one application to send MIDI data to other
applications connected to the thru box (for instance a software sequencer
can send events to multiple software synthesizers).
There's no hardware involved: thru boxes are created by
-.Xr midicat 1 .
+.Xr aucat 1 .
.Pp
Additionally,
.Xr aucat 1
-exposes a MIDI device used to control and monitor audio streams
+exposes a MIDI port used to control and monitor audio streams
in real time using MIDI.
.Sh DEVICE NAMES
From the user's perspective every audio interface, MIDI port,
.Xr aucat 1
-or
-.Xr midicat 1
service has a name of the form:
.Bd -literal -offset center
type:[hostname/]unit[.option]
.Ed
.Pp
This information is used by audio and MIDI applications to determine
-how to access the audio or MIDI device or service.
+how to access the audio device or MIDI port.
.Bl -tag -width "option"
.It Pa type
-The type of the audio or MIDI device.
+The type of the audio device or MIDI port.
Possible values for audio devices are
.Pa aucat
and
@@ -89,31 +85,24 @@ corresponding to
sockets and hardware
.Xr audio 4
devices.
-Possible values for MIDI devices are
-.Pa midithru ,
-.Pa rmidi ,
-and
+Possible values for MIDI ports are
.Pa aucat
+and
+.Pa rmidi
corresponding to
-.Xr midicat 1
-software MIDI thru boxes, hardware
-.Xr midi 4
-ports and
.Xr aucat 1
-control through MIDI respectively.
+software MIDI thru boxes or control ports and hardware
+.Xr midi 4
+ports respectively.
.It Pa hostname
The hostname where the remote
.Xr aucat 1
-or
-.Xr midicat 1
server to connect to is running.
.It Pa unit
-For hardware audio or MIDI devices, this corresponds to
+For hardware audio or MIDI ports, this corresponds to
the character device minor number.
-For audio or MIDI devices created with
+For audio devices or MIDI ports created with
.Xr aucat 1
-or
-.Xr midicat 1
it corresponds to the server
.Em unit
number, typically 0.
@@ -121,13 +110,9 @@ number, typically 0.
Corresponds to the profile string registered using the
.Fl s
option of
-.Xr aucat 1
-or
-.Xr midicat 1 .
+.Xr aucat 1 .
Only meaningful for
.Pa aucat
-and
-.Pa midithru
device types.
.El
.Pp
@@ -148,19 +133,13 @@ device registered with
.Fl s Fa rear .
.It Pa rmidi:5
Hardware MIDI port number 5.
-.It Pa midithru:0
-First software MIDI thru box created with
-.Xr midicat 1 .
.It Pa aucat:0
-MIDI port controlling the first
-.Xr aucat 1
-audio server.
+First software MIDI thru box or control port created with
+.Xr aucat 1 .
.El
.Sh AUTHENTICATION
If a shared
.Xr aucat 1
-or
-.Xr midicat 1
server is running, for privacy reasons only one user may have
connections to it at a given time
(though the same user could have multiple connections to it).
@@ -179,9 +158,7 @@ can connect to the server using the same cookie.
.It AUCAT_COOKIE
Path to file containing the session cookie to be used
when connecting to
-.Xr aucat
-or
-.Xr midicat .
+.Xr aucat .
.It Ev AUDIODEVICE
Audio device to use if the application provides
no device chooser.
@@ -201,7 +178,6 @@ MIDI ports.
.El
.Sh SEE ALSO
.Xr aucat 1 ,
-.Xr midicat 1 ,
.Xr mio_open 3 ,
.Xr sio_open 3 ,
.Xr audio 4 ,
diff --git a/usr.bin/aucat/Makefile b/usr.bin/aucat/Makefile
index ee125d29e39..173caf72f13 100644
--- a/usr.bin/aucat/Makefile
+++ b/usr.bin/aucat/Makefile
@@ -1,10 +1,9 @@
-# $OpenBSD: Makefile,v 1.15 2011/04/27 21:20:36 ratchov Exp $
+# $OpenBSD: Makefile,v 1.16 2011/10/17 21:09:11 ratchov Exp $
PROG= aucat
SRCS= aucat.c abuf.c aparams.c aproc.c dev.c midi.c file.c headers.c \
siofile.c miofile.c sock.c pipe.c listen.c opt.c wav.c dbg.c
-MAN= aucat.1 midicat.1
-LINKS= ${BINDIR}/aucat ${BINDIR}/midicat
+MAN= aucat.1
CFLAGS+= -Wall -Wstrict-prototypes -Wundef -DDEBUG -I${.CURDIR}/../../lib/libsndio
LDADD+= -lsndio
.include <bsd.prog.mk>
diff --git a/usr.bin/aucat/aucat.1 b/usr.bin/aucat/aucat.1
index 9d4d35d965f..aaac47ecd00 100644
--- a/usr.bin/aucat/aucat.1
+++ b/usr.bin/aucat/aucat.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: aucat.1,v 1.88 2011/10/12 12:16:10 jmc Exp $
+.\" $OpenBSD: aucat.1,v 1.89 2011/10/17 21:09:11 ratchov Exp $
.\"
.\" Copyright (c) 2006 Alexandre Ratchov <alex@caoua.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 12 2011 $
+.Dd $Mdocdate: October 17 2011 $
.Dt AUCAT 1
.Os
.Sh NAME
@@ -590,10 +590,10 @@ For instance, the following command will play a file on the
.Va aucat:0.mmc
audio device, and give full control to MIDI software or hardware
connected to the
-.Va midithru:0
-MIDI device:
+.Va aucat:0.thru
+MIDI port:
.Bd -literal -offset indent
-$ aucat -f aucat:0.mmc -t slave -q midithru:0 -i file.wav
+$ aucat -f aucat:0.mmc -t slave -q aucat:0.thru -i file.wav
.Ed
.Pp
At this stage,
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c
index 80d1a581881..6264bc784aa 100644
--- a/usr.bin/aucat/aucat.c
+++ b/usr.bin/aucat/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.121 2011/10/12 12:16:10 jmc Exp $ */
+/* $OpenBSD: aucat.c,v 1.122 2011/10/17 21:09:11 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -56,7 +56,6 @@
#define SNDIO_PRIO (-20)
#define PROG_AUCAT "aucat"
-#define PROG_MIDICAT "midicat"
/*
* sample rate if no ``-r'' is used
@@ -84,10 +83,6 @@ char aucat_usage[] = "usage: " PROG_AUCAT " [-dlMn] [-a flag] [-b nframes] "
"[-q port] [-r rate] [-s name] [-t mode] [-U unit] [-v volume]\n\t"
"[-w flag] [-x policy] [-z nframes]\n";
-char midicat_usage[] = "usage: " PROG_MIDICAT " [-dlM] [-a flag] "
- "[-i file] [-L addr] [-o file] [-q port]\n\t"
- "[-s name] [-U unit]\n";
-
/*
* SIGINT handler, it raises the quit flag. If the flag is already set,
* that means that the last SIGINT was not handled, because the process
@@ -367,8 +362,8 @@ mkopt(char *path, struct dev *d, struct aparams *rpar, struct aparams *ppar,
int
main(int argc, char **argv)
{
- char *prog, *un_path, *optstr, *usagestr;
- int c, background, unit, server, tcp_port, active;
+ char *prog, *optstr, *usagestr;
+ int c, background, unit, server, active;
char base[PATH_MAX], path[PATH_MAX];
unsigned mode, hdr, xrun, rate, join, mmc, vol;
unsigned hold, autovol, bufsz, round;
@@ -409,21 +404,11 @@ main(int argc, char **argv)
mode = MODE_MIDIMASK | MODE_PLAY | MODE_REC;
optstr = "a:b:c:C:de:f:h:i:j:lL:m:Mno:q:r:s:t:U:v:w:x:z:t:j:z:";
usagestr = aucat_usage;
- un_path = AUCAT_PATH;
- tcp_port = AUCAT_PORT;
- } else if (strcmp(prog, PROG_MIDICAT) == 0) {
- mode = MODE_MIDIMASK | MODE_THRU;
- optstr = "a:di:lL:Mo:q:s:U:";
- usagestr = midicat_usage;
- un_path = MIDICAT_PATH;
- tcp_port = MIDICAT_PORT;
- mkdev("midithru", MODE_THRU, 0, 0, 1, 0);
} else {
fprintf(stderr, "%s: can't determine program to run\n", prog);
return 1;
}
-
while ((c = getopt(argc, argv, optstr)) != -1) {
switch (c) {
case 'd':
@@ -441,7 +426,7 @@ main(int argc, char **argv)
server = 1;
break;
case 'L':
- listen_new_tcp(optarg, tcp_port + unit);
+ listen_new_tcp(optarg, AUCAT_PORT + unit);
server = 1;
break;
case 'm':
@@ -567,7 +552,7 @@ main(int argc, char **argv)
}
if (server) {
getbasepath(base, sizeof(base));
- snprintf(path, PATH_MAX, "%s/%s%u", base, un_path, unit);
+ snprintf(path, PATH_MAX, "%s/%s%u", base, AUCAT_PATH, unit);
listen_new_un(path);
if (geteuid() == 0)
privdrop();
diff --git a/usr.bin/aucat/midicat.1 b/usr.bin/aucat/midicat.1
deleted file mode 100644
index 348d0a2831f..00000000000
--- a/usr.bin/aucat/midicat.1
+++ /dev/null
@@ -1,215 +0,0 @@
-.\" $OpenBSD: midicat.1,v 1.19 2011/10/12 12:16:10 jmc Exp $
-.\"
-.\" Copyright (c) 2006 Alexandre Ratchov <alex@caoua.org>
-.\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-.Dd $Mdocdate: October 12 2011 $
-.Dt MIDICAT 1
-.Os
-.Sh NAME
-.Nm midicat
-.Nd MIDI server and manipulation tool
-.Sh SYNOPSIS
-.Nm midicat
-.Op Fl dlM
-.Op Fl a Ar flag
-.Op Fl i Ar file
-.Op Fl L Ar addr
-.Op Fl o Ar file
-.Op Fl q Ar port
-.Op Fl s Ar name
-.Op Fl U Ar unit
-.Sh DESCRIPTION
-The
-.Nm
-utility can merge any number of MIDI inputs and broadcast the result
-to any number of MIDI outputs, similarly to a hardware MIDI thru box.
-MIDI streams are typically MIDI ports or plain files containing raw MIDI
-data.
-.Pp
-The
-.Nm
-utility can also act as a MIDI server in which case MIDI streams
-correspond to client connections.
-The server capability
-allows any MIDI-capable application to send MIDI messages to
-MIDI hardware or to another application in a uniform way.
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl a Ar flag
-Control whether
-.Nm
-opens MIDI ports connected to the thru box only when needed
-or keeps them open all the time.
-If the flag is
-.Va on
-then MIDI ports are kept open all the time, ensuring no other program can
-steal any of them.
-If the flag is
-.Va off ,
-then they are automatically closed, allowing other programs to have direct
-access to MIDI ports, or the corresponding hardware to be disconnected.
-The default is
-.Va on .
-.It Fl d
-Increase log verbosity.
-.Nm
-logs on
-.Em stderr
-until it daemonizes.
-.It Fl i Ar file
-Read data to send from this file.
-If the option argument is
-.Sq -
-then standard input will be used.
-.It Fl L Ar addr
-Specify a local network address to listen on in server mode.
-.Nm
-will listen on TCP port 11041+n, where n is the unit number
-specified with
-.Fl U .
-Without this option,
-.Nm
-listens on the
-.Ux Ns -domain
-socket only, and is not reachable from any network.
-If the option argument is
-.Sq -
-then
-.Nm
-will accept connections from any address.
-.It Fl M
-Create a MIDI thru box.
-It merges any number of MIDI inputs and broadcasts the result
-to any number of MIDI outputs, similarly to a hardware MIDI thru box.
-Any MIDI ports
-.Pq Fl q
-or MIDI files
-.Pq Fl io
-specified after this option will be subscribed to this thru box.
-If sub-devices are exposed
-.Pq Fl s
-they behave like software MIDI ports,
-allowing any MIDI-capable application to send MIDI messages to
-MIDI hardware or to another application in a uniform way.
-.It Fl l
-Detach and become a daemon.
-.It Fl s Ar name
-Expose a MIDI thru box to which MIDI programs
-can connect.
-The given
-.Ar name
-corresponds to the
-.Dq option
-part of the
-.Xr sndio 7
-device name string.
-.It Fl o Ar file
-Write received data into this file.
-If the option argument is
-.Sq -
-then standard output will be used.
-.It Fl q Ar port
-Send and receive data from this
-.Xr sndio 7
-MIDI port.
-.It Fl U Ar unit
-Unit number to use when running in server mode.
-Each
-.Nm
-server instance has a unique unit number,
-used in
-.Xr sndio 7
-device names.
-The default is 0.
-The unit number must be set before any server-specific
-options are used
-.Pq Fl Ls .
-.El
-.Pp
-If files
-.Pq Fl io
-are specified but no ports
-.Pq Fl q
-are specified, the default
-.Xr sndio 7
-port is used.
-If no streams
-.Pq Fl ioq
-are specified, server mode is assumed and a thru box is created
-as if
-.Fl s Ar default
-was used as the last argument.
-.Pp
-Generally MIDI applications are real-time.
-To reduce jitter, especially on busy machines,
-the server can be started by the super-user,
-in which case it will run with higher priority.
-Any user will still be able to connect to it,
-but for privacy reasons only one user may have connections to
-it at a given time.
-.Pp
-If
-.Nm
-is sent
-.Dv SIGHUP ,
-.Dv SIGINT
-or
-.Dv SIGTERM ,
-then processing terminates.
-.Sh EXAMPLES
-The following dumps MIDI data received from the default port:
-.Bd -literal -offset indent
-$ midicat -o - | hexdump -e '1/1 "%x"'
-.Ed
-.Pp
-The following sends raw MIDI data to the
-.Pa rmidi:5
-port:
-.Bd -literal -offset indent
-$ midicat -i sysexfile -q rmidi:5
-.Ed
-.Pp
-The following connects
-.Pa rmidi:5
-and
-.Pa rmidi:6
-ports:
-.Bd -literal -offset indent
-$ midicat -q rmidi:5 -q rmidi:6
-.Ed
-.Pp
-The following creates a MIDI thru box and daemonizes,
-allowing MIDI programs to send data to each other instead of
-using hardware MIDI ports:
-.Bd -literal -offset indent
-$ midicat -l
-.Ed
-.Pp
-The following creates a MIDI thru box and subscribes the
-.Pa rmidi:5
-port, allowing multiple MIDI programs to use the port
-simultaneously:
-.Bd -literal -offset indent
-$ midicat -q rmidi:5
-.Ed
-.Sh SEE ALSO
-.Xr aucat 1 ,
-.Xr midi 4 ,
-.Xr sndio 7
-.Sh BUGS
-The ability to merge multiple inputs is provided to allow multiple
-applications producing MIDI data to keep their connection open while
-idling; it does not replace a fully featured MIDI merger.