diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2019-07-12 06:30:56 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2019-07-12 06:30:56 +0000 |
commit | fdf5bff0e600532b05030b1ca0071ee9a2be28f2 (patch) | |
tree | 3db7c00a171911fb9dd337419f3f7faf764399de /lib/libsndio/aucat.c | |
parent | 77dbe3a6d01aec61ec827f376205fb6e73ab7b26 (diff) |
Add affinity between the program and its mixer control.
Currently, if there are two instances of the same program, sndiod will
allocate one volume control to each. If both programs disconnect and
reconnect, the information of which control is assigned to which
program is lost. This makes difficult to run two instances of a player
and crossfade between each other with a MIDI controller.
To address this, the program chooses a 32-bit "id" (for now the
process pid) and sends it to the server. The server records the id in
the client's slot structure. When the server accepts a new
connection, it uses the id to identify the slot the client used during
the previous connection; if it was not recycled yet, it's assigned to
the program.
Diffstat (limited to 'lib/libsndio/aucat.c')
-rw-r--r-- | lib/libsndio/aucat.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c index b418f4e0fdd..4b86ed3fdb2 100644 --- a/lib/libsndio/aucat.c +++ b/lib/libsndio/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.76 2019/06/29 06:05:26 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.77 2019/07/12 06:30:55 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -486,6 +486,7 @@ _aucat_open(struct aucat *hdl, const char *str, unsigned int mode) hdl->wmsg.u.hello.version = AMSG_VERSION; hdl->wmsg.u.hello.mode = htons(mode); hdl->wmsg.u.hello.devnum = devnum; + hdl->wmsg.u.hello.id = htonl(getpid()); strlcpy(hdl->wmsg.u.hello.who, __progname, sizeof(hdl->wmsg.u.hello.who)); strlcpy(hdl->wmsg.u.hello.opt, opt, |