spa: alsa: Add a mechanism for external volume control

Currently enabled at device creation and delegated to an external entity
via a varlink protocol.
This commit is contained in:
Arun Raghavan 2026-02-11 15:06:56 -08:00
parent c1031bef1b
commit 283c091b71
9 changed files with 758 additions and 88 deletions

View file

@ -0,0 +1,47 @@
/* External Volume Control */
/* SPDX-FileCopyrightText: Copyright © 2026 Arun Raghavan */
/* SPDX-License-Identifier: MIT */
#ifndef ACP_EXT_VOLUME_H
#define ACP_EXT_VOLUME_H
#include <stdint.h>
#include <spa/param/audio/volume.h>
#include <spa/support/varlink.h>
typedef struct pa_cvolume pa_cvolume;
struct acp_card;
struct spa_acp_ext_volume {
struct spa_varlink_client *client;
struct spa_hook listener;
enum spa_audio_volume_control_flags flags;
};
int spa_acp_ext_volume_init(struct spa_acp_ext_volume *ext_volume, struct spa_varlink *varlink,
const char *path, const char *device, const char *route);
void spa_acp_ext_volume_destroy(struct spa_acp_ext_volume *ext_volume);
int spa_acp_ext_volume_read_volume(struct spa_acp_ext_volume *ext_volume,
const char *device, const char *route, pa_cvolume *cvol);
int spa_acp_ext_volume_write_volume_absolute(struct spa_acp_ext_volume *ext_volume,
const char *device, const char *route, pa_cvolume *cvol);
int spa_acp_ext_volume_write_volume_relative(struct spa_acp_ext_volume *ext_volume,
const char *device, const char *route, float step);
int spa_acp_ext_volume_read_mute(struct spa_acp_ext_volume *ext_volume,
const char *device, const char *route, bool *mute);
int spa_acp_ext_volume_write_mute_value(struct spa_acp_ext_volume *ext_volume,
const char *device, const char *route, bool mute);
int spa_acp_ext_volume_write_mute_toggle(struct spa_acp_ext_volume *ext_volume,
const char *device, const char *route);
#endif /* ACP_EXT_VOLUME_H */