summaryrefslogtreecommitdiff
path: root/lib
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 /lib
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
Diffstat (limited to 'lib')
-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
10 files changed, 57 insertions, 102 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 ,