diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2020-02-26 13:53:59 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2020-02-26 13:53:59 +0000 |
commit | aecb8e198594ee032277b784712935eb10fc4708 (patch) | |
tree | 92ab6418cfec5c32da4c9feafc252332c85fa7b4 /lib/libsndio/amsg.h | |
parent | 7d9906cf5784b21f9d2afab98129af86715d51d8 (diff) |
Add API to control audio device parameters exposed by sndiod.
The API exposes controls of modern audio hardware and sndiod software
volume knobs in a uniform way. Hardware knobs are exposed through
sndiod. Multiple programs may use the controls at the same time
without the need to continuously scan the controls.
For now sndiod exposes only its own controls and the master output and
input volumes of the underlying hardware (if any), i.e. those
typically exposed by acpi volume keys.
ok deraadt
Diffstat (limited to 'lib/libsndio/amsg.h')
-rw-r--r-- | lib/libsndio/amsg.h | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/lib/libsndio/amsg.h b/lib/libsndio/amsg.h index a22ea0e1078..abea9088879 100644 --- a/lib/libsndio/amsg.h +++ b/lib/libsndio/amsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: amsg.h,v 1.12 2019/07/12 06:30:55 ratchov Exp $ */ +/* $OpenBSD: amsg.h,v 1.13 2020/02/26 13:53:58 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -43,6 +43,11 @@ #define AUCAT_PORT 11025 /* + * limits + */ +#define AMSG_CTL_NAMEMAX 16 /* max name length */ + +/* * WARNING: since the protocol may be simultaneously used by static * binaries or by different versions of a shared library, we are not * allowed to change the packet binary representation in a backward @@ -64,6 +69,9 @@ struct amsg { #define AMSG_HELLO 10 /* say hello, check versions and so ... */ #define AMSG_BYE 11 /* ask server to drop connection */ #define AMSG_AUTH 12 /* send authentication cookie */ +#define AMSG_CTLSUB 13 /* ondesc/onctl subscription */ +#define AMSG_CTLSET 14 /* set control value */ +#define AMSG_CTLSYNC 15 /* end of controls descriptions */ uint32_t cmd; uint32_t __pad; union { @@ -108,10 +116,41 @@ struct amsg { #define AMSG_COOKIELEN 16 uint8_t cookie[AMSG_COOKIELEN]; } auth; + struct amsg_ctlsub { + uint8_t desc, val; + } ctlsub; + struct amsg_ctlset { + uint16_t addr, val; + } ctlset; } u; }; /* + * network representation of sioctl_node structure + */ +struct amsg_ctl_node { + char name[AMSG_CTL_NAMEMAX]; + int16_t unit; + uint8_t __pad[2]; +}; + +/* + * network representation of sioctl_desc structure + */ +struct amsg_ctl_desc { + struct amsg_ctl_node node0; /* affected channels */ + struct amsg_ctl_node node1; /* dito for AMSG_CTL_{SEL,VEC,LIST} */ + char func[AMSG_CTL_NAMEMAX]; /* parameter function name */ + char group[AMSG_CTL_NAMEMAX]; /* group of the control */ + uint8_t type; /* see sioctl_desc structure */ + uint8_t __pad1[1]; + uint16_t addr; /* control address */ + uint16_t maxval; + uint16_t curval; + uint32_t __pad2[3]; +}; + +/* * Initialize an amsg structure: fill all fields with 0xff, so the read * can test which fields were set. */ |