mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
acp: add volume base and step
Add a READONLY property flag to makr properties READONLY Set the base_volume and volume_step in the acp device Send the base volume and step as REAONLY properties. Use these in pulse layer.
This commit is contained in:
parent
f75dfde89c
commit
e030445e49
8 changed files with 40 additions and 11 deletions
|
|
@ -55,7 +55,7 @@ static void init_device(pa_card *impl, pa_alsa_device *dev, pa_alsa_direction_t
|
|||
dev->device.format.format_mask = m->sample_spec.format;
|
||||
dev->device.format.rate_mask = m->sample_spec.rate;
|
||||
dev->device.format.channels = m->channel_map.channels;
|
||||
pa_cvolume_set(&dev->real_volume, m->channel_map.channels, PA_VOLUME_NORM);
|
||||
pa_cvolume_reset(&dev->real_volume, m->channel_map.channels);
|
||||
for (i = 0; i < m->channel_map.channels; i++)
|
||||
dev->device.format.map[i]= m->channel_map.map[i];
|
||||
dev->direction = direction;
|
||||
|
|
@ -813,6 +813,8 @@ static void mixer_volume_init(pa_alsa_device *dev) {
|
|||
dev->read_volume = NULL;
|
||||
dev->set_volume = NULL;
|
||||
pa_log_info("Driver does not support hardware volume control, falling back to software volume control.");
|
||||
dev->base_volume = PA_VOLUME_NORM;
|
||||
dev->n_volume_steps = PA_VOLUME_NORM+1;
|
||||
dev->device.flags &= ~ACP_DEVICE_HW_VOLUME;
|
||||
} else {
|
||||
dev->read_volume = read_volume;
|
||||
|
|
@ -846,6 +848,8 @@ static void mixer_volume_init(pa_alsa_device *dev) {
|
|||
pa_log_info("Using hardware volume control. Hardware dB scale %s.",
|
||||
dev->mixer_path->has_dB ? "supported" : "not supported");
|
||||
}
|
||||
dev->device.base_volume = (float)dev->base_volume / PA_VOLUME_NORM;
|
||||
dev->device.volume_step = 1.0f / dev->n_volume_steps;
|
||||
|
||||
if (!dev->mixer_path || !dev->mixer_path->has_mute) {
|
||||
dev->read_mute = NULL;
|
||||
|
|
|
|||
|
|
@ -169,6 +169,9 @@ struct acp_device {
|
|||
char **device_strings;
|
||||
struct acp_format format;
|
||||
|
||||
float base_volume;
|
||||
float volume_step;
|
||||
|
||||
struct acp_port **ports;
|
||||
uint32_t n_ports;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue