mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
acp: reset volume when enabling a device
When we enable a device, the node will be created and its software volume will be set to 100%. Update the device volume with this as well so that changing the volume has an effect. Fixes #1198
This commit is contained in:
parent
e994949d57
commit
f544e4d87c
1 changed files with 9 additions and 2 deletions
|
|
@ -216,8 +216,8 @@ 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.format_mask = m->sample_spec.format;
|
||||||
dev->device.format.rate_mask = m->sample_spec.rate;
|
dev->device.format.rate_mask = m->sample_spec.rate;
|
||||||
dev->device.format.channels = m->channel_map.channels;
|
dev->device.format.channels = m->channel_map.channels;
|
||||||
pa_cvolume_reset(&dev->real_volume, m->channel_map.channels);
|
pa_cvolume_reset(&dev->real_volume, dev->device.format.channels);
|
||||||
pa_cvolume_reset(&dev->soft_volume, m->channel_map.channels);
|
pa_cvolume_reset(&dev->soft_volume, dev->device.format.channels);
|
||||||
for (i = 0; i < m->channel_map.channels; i++)
|
for (i = 0; i < m->channel_map.channels; i++)
|
||||||
dev->device.format.map[i]= channel_pa2acp(m->channel_map.map[i]);
|
dev->device.format.map[i]= channel_pa2acp(m->channel_map.map[i]);
|
||||||
dev->direction = direction;
|
dev->direction = direction;
|
||||||
|
|
@ -1321,8 +1321,15 @@ static int device_enable(pa_card *impl, pa_alsa_mapping *mapping, pa_alsa_device
|
||||||
|
|
||||||
if (dev->read_volume)
|
if (dev->read_volume)
|
||||||
dev->read_volume(dev);
|
dev->read_volume(dev);
|
||||||
|
else {
|
||||||
|
pa_cvolume_reset(&dev->real_volume, dev->device.format.channels);
|
||||||
|
pa_cvolume_reset(&dev->soft_volume, dev->device.format.channels);
|
||||||
|
}
|
||||||
if (dev->read_mute)
|
if (dev->read_mute)
|
||||||
dev->read_mute(dev);
|
dev->read_mute(dev);
|
||||||
|
else
|
||||||
|
dev->muted = false;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue