pipewire/spa/plugins/alsa/acp/card.h
Wim Taymans fb74ab9054 alsa: add volume limits
Add 3 levels of volume limits.

1. Add api.acp.min-volume and api.acp.max-valume on the ACP devices that
   is applied to all noded from this device
2. Add api.acp.device.<node-name>.min-volume and
   api.acp.device.<node-name>.max-volume that is applied to all nodes
   from the device with the given node-name.
3. Add api.acp.port.<port-name>.min-volume and
   api.acp.port.<port-name>.max-volume that is applied to all ports
   from the device with the given port-name.

The volume settings on an ALSA nodes can either go through the device on
the Routes (ports) to control the hardware mixer volumes and then the
remainder is performed on the nodes in software by the channel mixer.

We need to set the limits on the channel mixer when the hardware mixer
does not have routes.

This is not an easy way to set the volume limits but it provides a
static configuration option to enforce the limits. An easier
configuration option will also make it easier to change/bypass the
limits, which these options can guard against.

See #5266, #4323, #1517
2026-06-08 10:46:56 +02:00

80 lines
1.7 KiB
C

/***
This file is part of PulseAudio.
Copyright 2004-2006 Lennart Poettering
Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License,
or (at your option) any later version.
PulseAudio is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
***/
#ifndef PULSE_CARD_H
#define PULSE_CARD_H
#include "compat.h"
#ifdef __cplusplus
extern "C" {
#else
#include <stdbool.h>
#endif
typedef struct pa_card pa_card;
struct pa_card {
struct acp_card card;
pa_core *core;
char *name;
char *driver;
pa_proplist *proplist;
bool use_ucm;
bool soft_mixer;
bool disable_mixer_path;
bool auto_profile;
bool auto_port;
bool ignore_dB;
bool disable_pro_audio;
bool use_eld_channels;
uint32_t rate;
uint32_t pro_channels;
float volume_range[2];
pa_alsa_ucm_config ucm;
pa_alsa_profile_set *profile_set;
pa_hashmap *ports;
pa_hashmap *profiles;
pa_hashmap *jacks;
struct {
pa_dynarray ports;
pa_dynarray profiles;
pa_dynarray devices;
} out;
const struct acp_card_events *events;
void *user_data;
};
bool pa_alsa_device_init_description(pa_proplist *p, pa_card *card);
#ifdef __cplusplus
}
#endif
#endif /* PULSE_CARD_H */