mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-30 21:37:53 -04:00
spa: alsa: Add a mechanism for external volume control
Currently enabled at device creation and delegated to an external entity via spa_device events.
This commit is contained in:
parent
122bfd712b
commit
ef6f5194e3
9 changed files with 867 additions and 86 deletions
69
spa/plugins/alsa/acp/ext-volume.h
Normal file
69
spa/plugins/alsa/acp/ext-volume.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/* External Volume Control */
|
||||
/* SPDX-FileCopyrightText: Copyright © 2026 Arun Raghavan */
|
||||
/* SPDX-FileCopyrightText: Copyright © 2026 Julian Bouzas */
|
||||
/* 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/pod/event.h>
|
||||
|
||||
#define MAX_PORTS 256
|
||||
|
||||
typedef struct pa_cvolume pa_cvolume;
|
||||
|
||||
typedef void (*ext_volume_notifier_t) (void *data, struct spa_event *event);
|
||||
|
||||
struct caps_reply {
|
||||
int res;
|
||||
enum spa_audio_volume_control_flags caps;
|
||||
};
|
||||
|
||||
struct mute_reply {
|
||||
int res;
|
||||
bool mute;
|
||||
};
|
||||
|
||||
struct vols_reply {
|
||||
int res;
|
||||
uint32_t channels;
|
||||
double values[SPA_AUDIO_MAX_CHANNELS];
|
||||
};
|
||||
|
||||
struct spa_acp_ext_volume {
|
||||
bool initialized;
|
||||
enum spa_audio_volume_control_flags flags;
|
||||
|
||||
ext_volume_notifier_t notifier_cb;
|
||||
void *notifier_data;
|
||||
|
||||
struct caps_reply caps_reply;
|
||||
struct mute_reply mute_replies[MAX_PORTS];
|
||||
struct vols_reply vols_replies[MAX_PORTS];
|
||||
};
|
||||
|
||||
int spa_acp_ext_volume_init(struct spa_acp_ext_volume *ext_volume, const char *device,
|
||||
ext_volume_notifier_t notifier_cb, void *notifier_data);
|
||||
|
||||
int spa_acp_ext_volume_read_volume(struct spa_acp_ext_volume *ext_volume,
|
||||
const char *device, const char *port_name, uint32_t port_index, pa_cvolume *cvol);
|
||||
|
||||
int spa_acp_ext_volume_write_volume_absolute(struct spa_acp_ext_volume *ext_volume,
|
||||
const char *device, const char *port_name, uint32_t port_index, pa_cvolume *cvol);
|
||||
|
||||
int spa_acp_ext_volume_write_volume_relative(struct spa_acp_ext_volume *ext_volume,
|
||||
const char *device, const char *port_name, uint32_t port_index, float step);
|
||||
|
||||
int spa_acp_ext_volume_read_mute(struct spa_acp_ext_volume *ext_volume,
|
||||
const char *device, const char *port_name, uint32_t port_index, bool *mute);
|
||||
|
||||
int spa_acp_ext_volume_write_mute_value(struct spa_acp_ext_volume *ext_volume,
|
||||
const char *device, const char *port_name, uint32_t port_index, bool mute);
|
||||
|
||||
int spa_acp_ext_volume_write_mute_toggle(struct spa_acp_ext_volume *ext_volume,
|
||||
const char *device, const char *port_name, uint32_t port_index);
|
||||
|
||||
#endif /* ACP_EXT_VOLUME_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue