Commit graph

135 commits

Author SHA1 Message Date
Arnaud Ferraris
a39bfa4995 acp: make sure each port's priority is updated when switching profiles
UCM profiles can use the same ports, but with different priorities. One 
good example is a phone, having an earpiece and a speaker:
- the default profile will put a higher priority on the speaker
- the "voice call" profile will put a higher priority on the earpiece

When switching to the "voice call" profile, we want pipewire to take 
into account the priority change, so that the earpiece gets the highest 
priority and is selected by default.

As the ports have the same name in both profiles, we have a single 
instance of each port in memory, and therefore need to trigger a port 
update when the profile is changed, so that the priority set by the new 
profile is used.

Moreover, the UCM code updates only the priority inside the 
`pa_device_port` structure, so this commit also makes sure we reflect 
this value into the `acp_port` structure when enabling a device.
2021-01-05 14:34:43 +00:00
Wim Taymans
62065ac263 acp: update to latest 2021-01-05 10:08:31 +01:00
Wim Taymans
c84646b66f acp: add channel to string function
Add a function to convert the channel to a string and use that
instead of the unsafe one.

Fixes #519
2020-12-28 13:27:34 +01:00
Wim Taymans
e8dcd7f5f9 acp: sync
Remove >2 channel support until upstream
Fix availability groups
2020-12-17 11:03:31 +01:00
Marijn Suijten
44882f5ab3 acp: Probe and set up HW volume for cards detected through UCM
The codepath `pa_alsa_ucm_add_ports` -> `probe_volumes` ->
`pa_alsa_path_probe` was never called leading to no HW volume being set
up when loading a card through UCM. PulseAudio calls this from
`card_set_profile` -> `pa_alsa_{sink,source}_new`.
2020-12-15 09:36:52 +00:00
Wim Taymans
d098c2ba86 acp: add option to disable hardware mixer
See #426
2020-12-01 10:43:39 +01:00
Wim Taymans
4d62899375 acp: sync versions 2020-11-26 10:42:26 +01:00
Wim Taymans
af3f18b489 acp: add channel layout and map channels 2020-11-23 15:31:10 +01:00
Wim Taymans
42dd52c7fe acp: clean up card object
Fixes #369
2020-11-09 15:01:07 +01:00
Wim Taymans
f3dda8e57b pulse: Use the right conversion functions for volumes
PulseAudio uses cubic volumes and PipeWire uses linear volumes
so use the right conversion functions from one to the other.
2020-10-22 19:34:47 +02:00
Wim Taymans
e7585bd7b8 acp: handle devices with no ports
Make sure we don't crash when there are no ports on a device.

See #321
2020-10-08 18:05:49 +02:00
Wim Taymans
9e3ae3a045 acp: improve debug 2020-10-01 13:27:08 +02:00
Wim Taymans
c0c439ff76 acp: avoid profile switch to the current profile 2020-10-01 13:23:20 +02:00
Wim Taymans
971236e77a acp: don't fall back to the highest priority unavailable
Use the Off profile in case there are no yes/unknown profiles.
2020-10-01 13:23:20 +02:00
Wim Taymans
e394c5145a acp: only emit profile change for current profile
When a port is plugged/unplugged, first update all the profile states
and then emit a profile change only for the current profile. This way
the device can look at all the updated profiles to select the best one.
2020-10-01 13:23:20 +02:00
Wim Taymans
38276d126c acp: improve debug 2020-10-01 13:23:16 +02:00
Wim Taymans
735eefa2fb acp: pass right user_data to event 2020-10-01 11:31:52 +02:00
Wim Taymans
41db0f35b3 acp: sync with latests 2020-09-30 12:56:05 +02:00
Wim Taymans
08438903e5 acp: reset soft volume
When we have accurate enough hardware volume, set the software volume to
1.0. Also fixes the issue of going to 0 volume and then staying silent
until we raise the volume above 1.0.
2020-09-28 12:40:16 +02:00
Wim Taymans
d13181fb37 acp: prefer some other profile than Off
The Off profile is always available but we should only use it as the
ultimate fallback when all other profiles are NO.

Fixes #309
2020-09-28 11:39:09 +02:00
Wim Taymans
a97287351c acp: use flag for the Off profile 2020-09-28 11:32:36 +02:00
Wim Taymans
66cc13cc56 acp: update properties correctly
After modifying the properties, update the exported dictionary again
because the memory might have changed.

Fixes #304
2020-09-22 12:40:21 +02:00
Wim Taymans
6e339200af acp: improve port and profile index select
Keep 3 options, the available ports, unknown and highest priority
other ports.
2020-09-09 14:08:15 +02:00
Wim Taymans
5f38562d38 acp: remove active_port_index
It is not clear if the port index is in the card or device port array
and it doesn't work when many ports are active. So simply iterate the
device ports and find the ones with the active flag set.
2020-09-09 13:57:33 +02:00
Wim Taymans
5e368b1ad6 acp: add option to switch profile and ports
Enable an option to switch to the next best profile and port when
the current one becomes unavailable.
2020-09-08 16:39:47 +02:00
Wim Taymans
cfdd6cab20 acp: fix UCM off profile 2020-08-18 16:52:09 +02:00
Wim Taymans
a67af43cad alsa: sync with latest pulseaudio
Move some things around to make it easier to merge in changes.
2020-08-18 12:41:34 +02:00
Wim Taymans
374210c890 acp: add per device port list
Add the list of possible ports for a device.
Pass the allowed devices in the routes.
Store the active port in the device.

Fixes enumeration of ports on devices with UCM.
2020-08-10 14:25:03 +02:00
Wim Taymans
77bd687bac acp: fix size of array 2020-08-04 12:05:56 +02:00
Wim Taymans
7f7a8ccc88 acp: use some existing keys and add some new ones 2020-08-03 17:08:46 +02:00
Wim Taymans
ee59bcd632 acp: emit volume/mute changes on change 2020-07-08 17:24:23 +02:00
Wim Taymans
b896d65723 acp: emit param change when port changed 2020-07-08 16:16:43 +02:00
Wim Taymans
e030445e49 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.
2020-07-07 13:12:57 +02:00
Wim Taymans
d80d593271 acp: add support for soft volume
Add a set_soft_volume/mute event.
If we can't configure the hardware volume completely, notify
the remainder with the soft_volume/mute events.
2020-07-06 17:22:42 +02:00
Wim Taymans
1612f5e4d2 alsa-acp: Add libacp based card device
libacp is a port and wrapper around the pulseaudio card profile code.
It uses a set of templates for construct a card profile and mixer port
settings. It also has support for UCM when available for the hardware.
2020-07-06 12:20:09 +02:00