Commit graph

74 commits

Author SHA1 Message Date
Wim Taymans
dc3bf68aa2 acp: make sure we pass the save flag around
When we set the volume on a port, make sure we also set the save flag
so that the flag is put into the volume changed event and the session
manager can save it.

Fixes #995
2021-03-30 16:06:30 +02:00
Wim Taymans
ae22852a9b remove some useless checks
The variable was already dereferenced above and thus can't be NULL
2021-03-27 20:36:43 +01:00
Wim Taymans
e7ca1b474e acp: use the input ports for the input mappings 2021-03-27 20:16:04 +01:00
Wim Taymans
5cddd61c6c acp: remove the soft volume/mute events
Remove the soft mute/volume events, add a new method to get the soft
volume and use the volume_changed event to emit the changed soft and
monitor (real) volumes event for the node.

Make sure the monitor ports always uses the monitor volume, which is the
real volume unaffected by the mixer volumes.

This configures the soft and real volume on the sink/source in all
cases and makes the monitor port follow the real volume of the sink.

See #897
2021-03-21 16:19:57 +01:00
Björn Daase
5913eb098c treewide: fix issues found by codespell 2021-03-16 19:11:25 +00:00
Jan Alexander Steffens (heftig)
6e2f78fffc acp: Check return value of asprintf
Building with `-D c_args="-D_FORTIFY_SOURCE=2"` triggers warnings:

    ../spa/plugins/alsa/acp/acp.c: In function ‘add_pro_profile’:
    ../spa/plugins/alsa/acp/acp.c:298:2: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      298 |  asprintf(&device, "hw:%d", index);
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../spa/plugins/alsa/acp/acp.c:334:4: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      334 |    asprintf(&name, "Mapping pro-output-%d", dev);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../spa/plugins/alsa/acp/acp.c:364:4: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      364 |    asprintf(&name, "Mapping pro-input-%d", dev);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-03-13 14:50:42 +00:00
Wim Taymans
6fd870a5f0 alsa: pass the right direction to ucm_set_port()
The function requires true for playback ports and false otherwise.

See #867
2021-03-08 17:40:32 +01:00
Wim Taymans
20eb61b882 alsa: sync with pulseaudio 2021-02-25 10:28:25 +01:00
Wim Taymans
8414092763 Rework profile/route handling
Add save property to Profile and Route params to notify the session
manager that they should be saved. Let the session manager only save
the Profile and Routes with the save flag.
Make pulse-server set the save flag on Profile and Route changes.
The result is that we can make a difference between user requested
changes and automatical changes and only remember the user preferences.
When a port changes availability, first check if we need to perform
a profile switch, if not select the new best port.
2021-02-22 16:51:59 +01:00
Wim Taymans
0ed7e537fb acp: make Pro devices look better
Omit the Output/Input string from the name
Don't print a number for the first device.

See !466
2021-02-16 20:21:53 +01:00
Wim Taymans
38e0ff55cd acp: don't add pro profile for UCM
For UCM, we can just as well make a use case in the UCM file.
2021-02-16 15:17:26 +01:00
Wim Taymans
b62771c3cb acp: fix mapping name 2021-02-16 12:53:23 +01:00
Wim Taymans
5892403b01 acp: add a Pro Audio profile
The Pro Audio profile exposes all devices and subdevices with maximum
channel count and no channel layout. It also have no hardware volume
and is more suited for Pro Audio usage.

See #731 #704 #57
2021-02-16 12:34:59 +01:00
Wim Taymans
3659d70aef acp: complain louder when profile files are missing 2021-02-04 10:31:55 +01:00
Wim Taymans
f43bcca35e media-session: implement route selection and restore
Disable automatic port configuration in acp and move the logic
to the session manager.
Implement initial port selection and restore on profile activation.
Implement route switch when unavailable
Implement port settings save.
2021-01-29 16:59:17 +01:00
Wim Taymans
3312757706 acp: use auto-profile and auto-port properties
Also disable initial automatic profile selection when auto-profile
is set to false
2021-01-27 13:48:10 +01:00
Wim Taymans
64b078d7bb acp: fix port and profile name lookup 2021-01-27 13:48:10 +01:00
Wim Taymans
d82066e49f acp: sync with pulseaudio 2021-01-19 10:52:28 +01:00
Wim Taymans
b3f8a4b99b acp: update pcm proplist for UCM as well
Update the properties we get from the pcm handle right before we
close the handle.
Also set properties on the UCM devices.

See #524
2021-01-11 15:39:48 +01:00
Wim Taymans
6a9552a4ac acp; fall back to default when profile-set is not accessible 2021-01-11 13:05:11 +01:00
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
cdb6c94c8e acp: undo upstream change that breaks duplex mode 2020-12-17 13:05:37 +01:00
Wim Taymans
d6530bc0cd acp: sync with pulseaudio 2020-12-17 12:04:18 +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
Marijn Suijten
d636cadbb8 acp: alsa-ucm: Print iterated path name instead of current path
data->path (current path for selected profile) is not set yet here
resulting in segfaults. We are not interested in printing that anyway
but instead care about the iterated `path` from data->paths.
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
119678e8d1 Revert "alsa: sync to latest acp"
This reverts commit f611e34456.

There is something wrong with this
2020-11-26 12:40:44 +01:00
Wim Taymans
f611e34456 alsa: sync to latest acp 2020-11-26 11:16:31 +01:00
Wim Taymans
4d62899375 acp: sync versions 2020-11-26 10:42:26 +01:00
Elliott Sales de Andrade
6224068586 Fix some possible leaks. 2020-11-23 15:36:08 +00: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
0320eca79e pulse-server: add port_type and availability-group 2020-10-28 12:18:26 +01:00
Wim Taymans
8116da41b9 acp: use properties for port type and available group 2020-10-28 11:48:24 +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
Jan Grulich
743cf58fb7 Define SPA_FALLTHROUGH to make fall-through annotations work for all compilers
This is needed for example for Clang compiler which uses different
annotations than GCC. It will make WebRTC to happily use PipeWire
since the spa library is header-only and WebRTC defaults to use
Clang with -Wimplicit-fallthrough.
2020-10-22 13:31:19 +02:00
Wim Taymans
df912a9059 acp: fix > 2 channel maps 2020-10-15 09:46:14 +02:00
Wim Taymans
477d6e0b7f acp: fixup impossible decibel ranges 2020-10-13 17:24:23 +02:00
Wim Taymans
4e9b81960f acp: sync 2020-10-13 17:23:36 +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