diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-06-17 20:24:27 -0400 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-07-04 22:29:37 +0000 |
commit | 509105d48cd1524cba1f20c4e0641d8c2d3a9cb4 (patch) | |
tree | c9739f3e7bc741efb8c2760bf0dc917e920f5824 /src/audiomixer.h | |
parent | dadd3d771d5b27a455afffed8437c0a2e6db26b2 (diff) |
Repurpose into VIS clientneedlefish_13.93.0needlefish/13.93.013.93.0
Repurpose repository for a spiritual successor of the previous
binding. The replacement is a daemon that demonstrates servicing
the volume actuator from the VSS schema via VIS signals from
KUKSA.val. Currently the connection to KUKSA.val is websocket based
using the boost::asio framework, but the plan is to migrate to gRPC
as that becomes more robust in KUKSA.val. As well, this new code
will serve as the base for implementing a gRPC API to expose the full
set of WirePlumber controls as was done with the previous binding.
Notable changes:
- New code is completely C++, partly to leverage using Boost, but
also to futureproof future work with gRPC. The WirePlumber
interfacing code that has been kept from the old binding is
still C for now, converting it to C++ is a planned future
rework.
- Switch from CMake to meson for ease of development and some
degree of futureproofing.
- Use with systemd is assumed; behavior follows the systemd
daemon guidelines barring the use of journald logging prefixes,
which may be addressed with future work. A systemd unit is
also installed as part of the build.
- SPDX license headers using SPDX "short identifiers" are used in
source files rather than the full copyright headers used in the
previous codebase. This follows the direction that projects such
as the Linux kernel are going in.
Bug-AGL: SPEC-4409
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: Ibb7091c4354432bb094147d1419ab475486a4abc
(cherry picked from commit 298bbf445a731b85cb8d5d19a3b595e8870d8701)
Diffstat (limited to 'src/audiomixer.h')
-rw-r--r-- | src/audiomixer.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/audiomixer.h b/src/audiomixer.h new file mode 100644 index 0000000..cc67a83 --- /dev/null +++ b/src/audiomixer.h @@ -0,0 +1,71 @@ +/* + * Copyright © 2019 Collabora Ltd. + * @author George Kiagiadakis <george.kiagiadakis@collabora.com> + * + * SPDX-License-Identifier: MIT + */ + +#ifndef _AUDIOMIXER_H +#define _AUDIOMIXER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdbool.h> + +struct audiomixer; + +struct mixer_control +{ + char name[32]; + double volume; + bool mute; +}; + +struct audiomixer_events +{ + void (*controls_changed) (void *data); + + void (*value_changed) (void *data, +#define MIXER_CONTROL_CHANGE_FLAG_VOLUME (1<<0) +#define MIXER_CONTROL_CHANGE_FLAG_MUTE (1<<1) + unsigned int change_mask, + const struct mixer_control *control); +}; + +struct audiomixer * audiomixer_new(void); +void audiomixer_free(struct audiomixer *self); + +/* locking is required to call any of the methods below + * and to access any structure maintained by audiomixer */ +void audiomixer_lock(struct audiomixer *self); +void audiomixer_unlock(struct audiomixer *self); + +int audiomixer_ensure_controls(struct audiomixer *self, int timeout_sec); + +const struct mixer_control ** audiomixer_get_active_controls( + struct audiomixer *self, + unsigned int *n_controls); + +const struct mixer_control * audiomixer_find_control( + struct audiomixer *self, + const char *name); + +void audiomixer_add_event_listener(struct audiomixer *self, + const struct audiomixer_events *events, + void *data); + +void audiomixer_change_volume(struct audiomixer *self, + const struct mixer_control *control, + double volume); + +void audiomixer_change_mute(struct audiomixer *self, + const struct mixer_control *control, + bool mute); + +#ifdef __cplusplus +} +#endif + +#endif // _AUDIOMIXER_H |