Commit graph

555 commits

Author SHA1 Message Date
Wim Taymans
d82066e49f acp: sync with pulseaudio 2021-01-19 10:52:28 +01:00
Wim Taymans
d9a63dc69f alsa: disable pause-on-idle by default
snd_pcm_drop() causes pops and cracks. It is better to just let the
sink consume silence until it gets suspended.
2021-01-18 11:13:48 +01:00
Wim Taymans
9b9b85ddbf alsa: put card name in udev monitor event
So that we can use it to construct a good name for the card.

Fixes #524
2021-01-17 11:35:27 +01:00
Wim Taymans
02295c5e2b alsa: call prepare again but ignore EBUSY
Not calling _prepare can cause problems on my card. So call it
again but ignore -EBUSY.
2021-01-15 18:42:35 +01:00
Wim Taymans
376436fc2c alsa: remove snd_pcm_prepare() call, it is not needed
set_hw_params already called _prepare for us and calling it twice
might cause trouble in some drivers.

See #580
2021-01-15 16:12:42 +01:00
Wim Taymans
482f96a644 alsa: add option to disable mmap access mode 2021-01-15 15:44:22 +01:00
Wim Taymans
2ff4615e53 alsa: prefer planar formats
They are easier to convert
2021-01-15 15:18:39 +01:00
Wim Taymans
7347b5ef05 alsa: add api.alsa.headroom setting
Can be used to tweak the extra distance kept between the hardware
and software pointers when reading and writing.

See #289
2021-01-14 17:10:05 +01:00
Wim Taymans
abe73c9146 meson: use global b_pie to build PIE executables 2021-01-14 16:29:32 +01:00
Wim Taymans
c9354c238f Add -fPIE to installed executables
Fixes #570
2021-01-13 19:40:37 +01:00
Nicolai Syvertsen
09a690b123 spa-acp-tool: fix set-volume vol argument parse 2021-01-11 22:26:30 +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
Wim Taymans
ac861a86c0 acp: make it possible to pass properties to test tool
So you can do:

spa-acp-tool -c 1 -p 'device.profile-set=behringer-umc202.conf'
2021-01-11 11:44:13 +01:00
Wim Taymans
dea4836203 alsa-pcm: always start device
Also start device after writing silence.

Fixes #558
2021-01-11 07:11:09 +01:00
Jarkko Sakkinen
7aabd50d1e udev: Make Udev optional
In order to further simplify "unprivileged" builds, add "udev" boolean,
which make installing Udev rules optional.

I.e. without requiring any ugly hacks (mktemp -d), an privileged build
capable of running PulseAudio and JACK applications, can be configured
trivially:

meson --prefix=~/.local build
meson configure build -Dsystemd-user-unit-dir=$HOME/.config/systemd/user
meson configure build -Dpipewire-alsa=false
meson configure build -Dudev=false

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
2021-01-09 23:42:05 +02:00
Wim Taymans
7f007b6bca resample: tweak the resampler to keep delay number of samples
Instead of requiring the upstream node to resubmit the delayed
samples, keep the samples ourselves. The benefit is probably too
small to measure but it simplifies things a lot.
2021-01-08 16:35:26 +01:00
Wim Taymans
1ca3998b41 alsa: remove unused field 2021-01-07 17:27:36 +01:00
Wim Taymans
18b5199d44 alsa: add read/write access mode
Add support for read/write access mode when mmap is not available.

See #526
2021-01-05 17:48:09 +01:00
Arnaud Ferraris
0d6ba3a032 alsa-acp-device: make sure EnumRoute is updated on profile change
When using UCM profiles, ports can have different priorities between 
profiles, meaning EnumRoute should be updated too.
2021-01-05 14:34:43 +00: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
87292432b7 alsa: add option to configure period-size
api.alsa.period-size can be set to something else than 1024 with
this config option.
2021-01-05 12:44:10 +01:00
Wim Taymans
62065ac263 acp: update to latest 2021-01-05 10:08:31 +01:00
Wim Taymans
134f27a201 alsa: log warning for unhandled formats
When we can't enumerate a single supported format, log a warning with
the supported formats and access.

See #526
2021-01-03 08:52:59 +01:00
Wim Taymans
4b076549f7 alsa: allow override of channel map 2020-12-28 14:24:59 +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
Jarkko Sakkinen
8f76d80fde spa: Fix a compiler warning caused by unchecked read()
Wrap read() with the CHECK() used elsewhre in the test program, in order
to render out the compiler warning represented by this transcript:

➜  pipewire (af38edea) ✔ make
ninja -C /home/jarkko/Projects/pipewire/build
ninja: Entering directory `/home/jarkko/Projects/pipewire/build'
[6/397] Compiling C object spa/plugins/alsa/test-timer.p/test-timer.c.o
../spa/plugins/alsa/test-timer.c: In function ‘main’:
../spa/plugins/alsa/test-timer.c:195:3: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  195 |   read(state.timerfd, &expirations, sizeof(expirations));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
2020-12-24 17:54:32 +02:00
Wim Taymans
c81fe38285 alsa-pcm: limit channels to MAX
We don't support more than MAX channels

See #507
2020-12-23 20:07:51 +01:00
Wim Taymans
a8937413e6 acp: add options to disable profile and port switching
See #498
2020-12-22 13:08:14 +01:00
Walter Lozano
9f766dd708 alsa: add warning in case of partial read/write
Currently alsa_read and alsa_write assumes that all the frames committed
using snd_pcm_mmap_commit are read or written, which is probably true.
However, as it could be some corner cases add a warning to notice this
fact.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
2020-12-20 00:23:52 -03:00
Wim Taymans
a25f1a6a1d acp: pass channelmap around
so that we can use it as a default in channelmix
2020-12-18 17:18:53 +01:00
Wim Taymans
c3973fd9ec pod: add a HINT_DICT flag
We can use this to mark the ROUTE_info property and hopefully improve
the debugging output later.
2020-12-18 16:40:35 +01:00
Wim Taymans
9fb1b02352 acp: when we have a device with no port, go to the next device
Fixes an issue where a device have no ports and then it would
stop enumerating the ports of the other devices.
2020-12-18 16:28:56 +01:00
Wim Taymans
67d10ad3c7 alsa-acp: collect channelmap from volume update
It's not used yet but would ideally need to be used to remap the
volumes.
2020-12-18 16:22:00 +01:00
Wim Taymans
b05dcacc99 alsa-acp: add channel map with soft volume 2020-12-18 16:21:18 +01:00
Wim Taymans
94ec34d138 alsa: rename seq-source -> seq-bridge 2020-12-18 11:28:31 +01:00
Wim Taymans
cdb6c94c8e acp: undo upstream change that breaks duplex mode 2020-12-17 13:05:37 +01:00
Wim Taymans
6e6cd0d684 acp: add new files as well 2020-12-17 12:07:31 +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
Wim Taymans
22c793aa87 v4l2: add inotify support
Wait with inotify until we can access the device node before emiting
the new device.
Clean up alsa-udev and make it more like v4l2-udev
2020-12-17 10:43:57 +01:00
Wim Taymans
69da2ec601 alsa: refactor some helpers to add/remove a card 2020-12-17 09:36:19 +01:00
Wim Taymans
1636e08368 alsa: first rough attempt at inotify support
Wait until the device is accessible before exposing it.
2020-12-16 19:18:32 +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
c61502f57c acp: rename fields
pulseaudio -> pipewire
PULSE_* -> ACP_*

Hopefully this does not interfere with pulseaudio anymore.

See #436
2020-12-14 15:01:05 +01:00
Wim Taymans
d71259a02c alsa: handle batch devices
For batch devices that are not usb devices, lower the period and
add an extra period of heardoom to avoid xruns.

See !330
2020-12-11 17:38:27 +01:00
Wim Taymans
8cb1db5a61 alsa-udev: add property to emit ACP devices 2020-12-11 10:10:20 +01:00
Wim Taymans
7768a87a0b alsa: make it possible to fix format 2020-12-09 20:33:57 +01:00
Wim Taymans
4e7be858e4 node: Add ParamBegin/End
Use these commands to mark the begin and end of a series of Param
enumerations and configuration, like when doing format negotiation. The
idea is that the device can remain open while we do this.
Use this in adapter when negotiating a format.
2020-12-09 17:10:52 +01:00