Commit graph

135 commits

Author SHA1 Message Date
Wim Taymans
2eaac9b67a acp: mark the Pro profile with a flag 2023-01-03 13:13:03 +01:00
Wim Taymans
6a69152185 acp: add api.acp.probe-rate option
Add an option to configure the samplerate used for probing because the
default 48KHz might not work for everyone.

See also #1599
2022-12-16 12:57:17 +01:00
Wim Taymans
3e000c11c4 acp: do probing in 48000 Hz again
And... we're back to 48Khz probing. Some devices fail to probe with
44.1KHz so when we need to choose between 2 bad things we choose to
do the right thing, which is probe in 48KHz.

Fixes #2857
2022-12-07 12:21:32 +01:00
Wim Taymans
80cb1d2566 acp: ignore_dB should be passed around to device
Don't only use the ignore_dB property for the profile sets but also when
setting up the mixer of a device, like pulseaudio does.
2022-12-06 13:39:45 +01:00
Wim Taymans
50a24ac69e acp: do probing in 44100 Hz again
Some devices don't seem to work when probed in 48000 so bring it back
to 44100 until we figure out what is going on.

Fixes #2718
2022-11-15 16:30:26 +01:00
Jaroslav Kysela
a2278a5f70 spa: support the speakers (output) only case in report_jack_state()
The Realtek ALC4080 USB audio device (integrated in the
motherboards) can detect the presence on all I/O jacks.

If user connects only speakers, it's a valid case.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2744
2022-10-29 20:22:06 +02:00
Wim Taymans
7b432aec88 spa: make default samplerate 48000
Remove some 44100 default rates and use 48000 instead.
2022-09-05 12:21:20 +02:00
Wim Taymans
a9ced45d4b acp: add debug for open and close
Debug open and close calls.
Make pa_alsa_close to close the device.
2022-08-05 12:31:28 +02:00
Wim Taymans
1118c35956 acp: handle some more mixer NULL cases
These are in pulseaudio handled with asserts.

Fixes #2612
2022-08-04 09:06:28 +02:00
Wim Taymans
6144d037ce acp: handle NULL mixer_handle
It can be NULL for some UCM configs.

Fixes #2612
2022-08-03 12:34:13 +02:00
Wim Taymans
bc1789c3ea Revert "acp: sync with pulseaudio"
This reverts commit 57f0fdf746.

This seems to cause problems and needs to mature a bit more in
pulseaudio it seems.
2022-07-11 10:03:01 +02:00
Wim Taymans
57f0fdf746 acp: sync with pulseaudio 2022-07-07 12:23:28 +02:00
Wim Taymans
b99c71262e alsa: force same clock only for pro audio profile
Assume that capture and playback nodes from a device have different
clocks. This enables the adative resampler to match them. A lot of devices
actually have slightly different rates and would work out of the box
with this fix.

Make an exception when the card is configured in the pro audio profile.
Then we force the same clock on all device nodes and avoid resampling
and rate matching. This can still be changed with a session manager
override.
2022-06-08 17:03:50 +02:00
Wim Taymans
b63a6a1b66 acp: sync with pulseaudio 2022-01-03 17:21:28 +01:00
Wim Taymans
e1898812b2 acp: remove duplicate AUX channels in pa channelmap
The pulseaudio channel map can only hold 32 AUX channels and we reuse
them when we need more. When we find a duplicate channel, map it to the
next AUX channels.
2021-10-18 10:53:07 +02:00
Wim Taymans
a475926f87 acp: move pro channel init to init_auto 2021-10-18 10:51:48 +02:00
Wim Taymans
6bb21d6abf acp: fix AUX13 channel mapping
Fixes #1727
2021-10-18 10:01:44 +02:00
Wim Taymans
80628f38e7 alsa: move codec config to acp-device
Just like the latency, move the codecs to the device Route param.
This way, it is easier for the session manager to save and restore
the codecs as part of the Route settings.
2021-09-02 10:27:59 +02:00
Wim Taymans
35d7ad5529 acp: compare the HW volume against stored HW volume
When we store the real_volume we get a hardware_volume as stored
in the mixer and a residual software_volume.

When we read the volume from the card, we need to compare this against
the hardware_volume we stored to check if something changed, not
against the real_volume that also contains the leftover software_volume.
2021-08-09 14:18:20 +02:00
Wim Taymans
1ad54e8a26 spa: add 64 AUX channels
Make 64 AUX channels instead of using the CUSTOM range for them.
2021-07-21 11:25:43 +02:00
Julian Bouzas
7bf50fd8ed spa: alsa: acp: free device name in add_pro_profile 2021-07-13 17:03:30 +00:00
Wim Taymans
ae89ae093e acp: strip UCM alibpref from mapping
Strip the alibpref from the device string in the mapping name. This
name is used to generate the node name eventually and we don't want
this random identifier in it.

Fixes #1362
2021-06-29 17:43:00 +02:00
Wim Taymans
1c513464c8 alsa: strip and add the _alibpref from device names
Strip the _alibpref from the device name, it contains a local counter
to identify the ucm card that should remain internal. We set a flag on
the device to notify of this.

Re-add the _alibpref of the local card to the device name if the
device was flagged.

See #1286
2021-06-10 15:36:26 +02:00
Wim Taymans
23a0f29d48 acp: don't use the card index for alibpref
The alibpref fallback does not contain the card number but it is
a local counter instead. Just check if it starts with something in
case the alsa library is not patched to return _alibpref.
2021-06-10 13:25:53 +02:00
Wim Taymans
8132c4e2b4 acp: add fallback alibpref just in case
Until we are sure that everybody has a recent enough version of
alsa-lib 1.2.5
2021-06-07 13:04:03 +02:00
Wim Taymans
35e81fbfdc alsa: rework UCM open
Use _alibpref to check if a device needs a UCM local config. Mark
the device as such and use this to set the OPEN_UCM property on
the device.
Open the UCM for a card when the device has the property set. Use the
same logic for loading the UCM as the acp code.

See #1251
2021-06-02 17:25:21 +02:00
Wim Taymans
f544e4d87c 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
2021-06-01 11:47:59 +02:00
Peter Hutterer
71c6a175c4 Drop double semicolons 2021-05-20 07:24:22 +00:00
Peter Hutterer
cdfd50e166 spa: add spa_atob() to convert a string to a boolean
This replaces the manual check for "true" and some (inconsistent) return value
of atoi. All those instances now require either "true" or "1" to parse as
true, any other value (including NULL) is boolean false.
2021-05-18 22:18:56 +10:00
Peter Hutterer
522f87d5ea treewide: replace strcmp() != 0 with !spa_streq
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Wim Taymans
d226a28b30 acp: reset soft_volume
Reset the software volume when initializing the device and when the
hardware volume is updated.

The software volume was set to 0 by default and if the session manager
did not change the volume enough to cause a software volume change,
it would remain 0 and there would be silence.

Also improve the debug a little.

See #1160 #1167 #1164 #1049 #1117
2021-05-10 10:50:42 +02:00
Andrea Gelmini
47ef2b6b09 Fix typos 2021-04-30 07:40:20 +00:00
Wim Taymans
3424d10231 Revert "acp: use the right profile name and description"
This reverts commit 09106151d3.

We need the actual name and description of the mapping, not the
profile or else we end up with the full profile description in the
node description instead of the part of the profile that applies to
the device.
2021-04-27 16:43:13 +02:00
Wim Taymans
09106151d3 acp: use the right profile name and description 2021-04-15 17:56:40 +02:00
Wim Taymans
3babedec9c acp: get i18n interface from support and use it
Save the i18n interface in a global variable. Make acp use the support
interface when translating strings.
2021-04-14 18:03:46 +02:00
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
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
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
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