Commit graph

1000 commits

Author SHA1 Message Date
Julian Bouzas
bec20fc054 create-item: Only configure audio device sink nodes in MONO
This allows multi channel mixing in the graph, even if MONO is enabled.
2025-12-08 09:43:56 -05:00
Torkel Niklasson
6ebf81453c rescan: Optimize linking for simple stream nodes
Add immediate linking for common cases to reduce latency when new
audio/video streams are added. The full rescan mechanism is preserved
and still triggers for all session-item-added events via the
rescan-trigger hook.
2025-11-28 11:05:34 +00:00
Julian Bouzas
f196d10e87 linking/rescan.lua: Clean a bit the code using the new properties API 2025-11-24 19:42:07 +02:00
Julian Bouzas
5071a85997 scripts: Fix compatibility issues with new Lua Properties API
We need to explicitly use Properties() in those cases as {} construct tables.
2025-11-24 19:42:07 +02:00
Julian Bouzas
15d98f59e5 state-routes: use get_count() instead of next()
We cannot use next() as the properties are not a Lua table anymore.
2025-11-24 19:42:07 +02:00
Julian Bouzas
c0e047c241 apply-default-node: Make sure the metadata is valid
This fixes some warnings in the Lua tests scripts from tests/scripts/scripts/*
2025-11-24 19:42:07 +02:00
qaqland
7ca21699a9 wpctl: add bash completions 2025-11-17 18:00:48 +08:00
Julian Bouzas
551353482a monitor/alsa: Also include alsa.* device properties for rule matching
UCM alsa nodes don't seem to have the 'alsa.*' properties from the device
included, which make it harder to match those nodes with alsa rules. This
patch adds all the 'alsa.*' properties in the UCM node to solve this.
2025-11-13 11:09:41 -05:00
Charles
27f97f6c45 monitors/alsa: Increase headroom for VMware and VirtualBox
Ubuntu received reports of very bad audio stuttering when running
25.10 in VMware & Virtualbox on Windows 11 hosts.

ac0d8ee4a8 dropped the headroom from
8192 samples to 2048. This seems fine for QEMU+KVM, but for unknown
reasons, the system emulation on Windows with these VMware/Virtualbox
is much slower, and xruns become frequent.

See:
https://bugs.launchpad.net/ubuntu/+source/wireplumber/+bug/2127250
https://discourse.ubuntu.com/t/vm-ubuntu2025-10-on-vmware-workstation-and-sound-problem/71066/3
2025-10-28 04:49:03 +00:00
Guido Günther
c095ae5254 role-based-policy: Allow to set target sink for media role loopbacks
There are streams that should go to a speaker rather than a headphone
or earpiece by default. Examples are alarms and emergency alerts on
phones. Allow to set a preference via
`policy.role-based.preferred-target` which then looks up the target
via `node.name` and `node.nick`.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-10-25 16:12:01 +03:00
Julian Bouzas
ae30b4f022 state-profile: Handle new 'session.dont-restore-off-profile' property
This avoids restoring the Off profile if it was saved before. The property can
be set using the 'monitor.alsa.rules' section of the configuration.
2025-10-25 15:36:00 +03:00
Guido Günther
962be34a2b docs: Update rescan-for-linking priority
`rescan-for-linking` is the lowest priority linking event but the
`rescan-for-media-role-volume` event is lower overall priority.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-10-24 12:24:25 +02:00
Guido Günther
6f5ca5a79d wireplumber.conf: Enable default volume control tracking
Track a suitable default volume for media role based policies.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-10-24 12:20:33 +02:00
Guido Günther
5ecfe9f555 scripts: Add script to find a suitable volume control
When using role based priorities a volume slider presented to the
user should adjust the volume of the currently playing role.

E.g. when a phone has an incoming call and is ringing the default volume
slider should adjust the ringing volume and once the call has been
picked up it should adjust the call volume and once the call ended it
should adjust the media volume again.

It's currently hard for e.g. desktop shells to find out what a suitable
sink for volume control is so add a script to find a suitable target for
volume control (based on media role priority) by storing it's name in
the metadata.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2025-10-24 12:20:33 +02:00
Julian Bouzas
e30c2a7cd9 state-routes.lua: Use the returned iterator from enum_params() to update routes info
This does not really fix anything but it saves some CPU cycles as we don't need
to get the route params from the cache anymore.
2025-10-17 09:05:27 -04:00
Julian Bouzas
fb1738932b audio-group.lua: Demote creation of audio group log to info
This was never meant to be a warning message.
2025-10-17 15:49:02 +03:00
Julian Bouzas
6cfaf3f70d automute-alsa-routes.lua: Don't register/remove hooks if never registered/removed before
This avoids avent dispatcher errors in the log.
2025-10-13 16:15:34 +03:00
Julian Bouzas
2942903d0e scripts: Add node/filter-graph.lua 2025-10-13 15:48:41 +03:00
Arun Raghavan
38a21ea191 monitor/alsa: Add a setting to use HDMI channel detection
This allows us to set up the device to use HDMI ELD information for
channels. Not yet documented while we experiment with different ways to
make this work.
2025-10-10 15:44:48 -07:00
Julian Bouzas
f82247c42c config: Add new 'node.features.audio.mono' setting
This setting allows users to toggle between MONO audio or not at runtime.
2025-10-01 18:59:13 +03:00
Julian Bouzas
71f98c40f0 create-item: Reconfigure audio adapters if 'node.features.audio.*' settings changed
Up until now, all the 'node.features.audio.*' settings did not have any effect
if changed at runtime. This patch fixes this by reconfiguring the audio adapters
every time those settings have changed.
2025-10-01 18:59:13 +03:00
Julian Bouzas
35d63a7847 scripts: Add automute-alsa-routes.lua to auto-mute ALSA routes
This script mutes available output ALSA routes if an audio node that was
previously running was removed. This is useful for cases where users might
unplug their headset accidentaly, causing undesired loud audio to play on the
Speakers.

Two new settings are added to chose whether the user wants to do this for
ALSA devices, Bluetooth devices or both. The settings are set to false by
default.

Finally, a notification is also sent to notify the user that the devices were
muted.
2025-10-01 18:04:58 +03:00
Julian Bouzas
d21ff24ea1 modules: Add notifications-api module
This allows sending Desktop notifications using D-Bus.
2025-10-01 18:04:58 +03:00
Julian Bouzas
ebd9d2a7d5 state-routes.lua: Make sure the device is still valid after doing enum_params() 2025-09-10 15:43:57 +03:00
Pablo Correa Gómez
7eacea9da9
apply-profile: add find-calling-profile to after array 2025-09-07 10:23:26 +02:00
Pablo Correa Gómez
dcf083ef3b
find-voice-call-profile: improve logging
To make it more specific to the hook and avoid confusion with the
best-profile one.
2025-09-07 10:23:26 +02:00
Pablo Correa Gómez
a6c0bb202d
scripts: document device/find-calling-profile hook 2025-09-07 10:23:26 +02:00
Pablo Correa Gómez
97d8761914
scripts: document device/find-preferred-profile hook 2025-09-07 10:23:26 +02:00
Yukari Chiba
1bde4f2cdf device-info-cache: use Log.warning instead of Log.critical
Log.critical does not actually exist.
When logging error, it will in fact throw an exception:

[string "device-info-cache.lua"]:36: attempt to call a nil value
(field 'critical')

Change Log.critical to Log.warning to fix it.
2025-09-05 01:40:05 +08:00
George Kiagiadakis
865cdcb89c conf: remove std-event-source dependency from the find-voice-call hook
This dependency must not be added here because it creates a circle.
m-standard-event-source is loaded after the hooks, as specified in the
wireplumber.components.rules section.
2025-08-29 19:55:18 +03:00
Pauli Virtanen
8fdf726a66 linking: remove/add mpris-pause hooks on setting enable/disable
Remove mpris-pause hooks when the controlling setting is disabled,
and re-add when enabled, to avoid unnecessary processing.

Fix link tracking initialization, which previously never run. It worked
earlier since the event hook was registered early, but now it's needed.
2025-08-29 18:51:44 +03:00
Richard Acayan
0fd1b05b01 device-profile-hooks: add hook to select Voice Call profile
A "Voice Call" profile is supposed to be active during a call, even if
there is a higher priority device profile. Add a hook to select the
Voice Call profile when a call is active, and select a profile when
transitioning in and out of an active call.
2025-08-29 18:13:02 +03:00
Richard Acayan
2794764d5a m-modem-manager: add module for tracking status of voice calls
Voice calls can require special audio routing to work, such as by
switching the profile or opening an audio stream. Add a module to
monitor for the starting and stopping of a voice call.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2025-08-29 18:02:59 +03:00
Julian Bouzas
bc026593d6 m-dbus-connection: Add 'plugin.name' and 'bus.system' args
These allow creating a shared system D-Bus connection.
2025-08-29 18:02:59 +03:00
Julian Bouzas
ed58f65184 state-routes.lua: Don't save again the route when restoring it
There is no need to save the route again after it has been restored because its
value has not changed.
2025-08-22 12:15:13 -04:00
Julian Bouzas
5060b27a9e apply-routes.lua: Always set save=false when applying routes
When applying new routes, we always want the save property to be false because
it is done by WirePlumber (not the user). WirePlumber applies routes when
restoring them from the state file, or when finding the best routes after the
profile has changed. In both cases, it does not make sense to set save=true.
2025-08-22 12:15:13 -04:00
Julian Bouzas
ea6f24e861 state-routes: Don't save routes that are not available
If the user changed the volume on a ACP 'Headphones' route to a value different
than 100%, and then unplugs the jack headset, the ACP 'Headphones' route becomes
unavailable with volume set to 100% and the save flag not cleared.

Since the save flag is not cleared when the ACP 'Headphones' route becomes
unavailable, WirePlumber will save it with 100% volume, overriding the previous
volume value set by the user. This is not ideal because the volume will be
restored to 100% by WirePlumber when plugging back the headset.

This change fixes this by never saving routes that are not available.
2025-08-22 12:15:13 -04:00
Julian Bouzas
ebd6d49a81 state-routes.lua: Make sure routes cache is always updated when evaluating them
The Route params changed event can be emitted before the EnumRoute params with
some devices, causing wrong evaluation of the routes because their cached info
is not updated. This change always enumerates the EnumRoute params before
evaluating them to make sure the cache info is always valid.

Fixes: #762
2025-08-22 12:15:13 -04:00
Pauli Virtanen
36f809fb50 lib: settings: make settings name optional
The "name" field needs to be optional, to be backward compatible with
old settings spec format.  If it's omitted, make it NULL.
2025-07-24 12:14:33 +03:00
Pauli Virtanen
a32e31ffa1 wpctl: localize settings descriptions + show names 2025-07-24 11:44:04 +03:00
Pauli Virtanen
8d26e9f73c wireplumber.conf: provide human-readable names for settings 2025-07-24 11:44:04 +03:00
Pauli Virtanen
a8283001d9 po: extract translatable strings from wireplumber.conf
Add rules to extract translatable strings from wireplumber.conf.

Meson i18n.gettext does not support extracting strings from
autogenerated files. Hence, we must commit conf.pot to repository.

These setting descriptions are meant to be user-facing. Translating them
allows also 3rd party apps to get the translations from 'wireplumber'
domain.
2025-07-24 11:29:44 +03:00
Pauli Virtanen
e070260c5c tools: add utility to extract strings from SPA-JSON for translation
Add utility that extracts strings from SPA-JSON files in POT format.
2025-07-24 11:29:20 +03:00
Pauli Virtanen
f6912ec23c wireplumber.conf: improve settings descriptions
The setting descriptions are in principle user-facing, so try to make
their descriptions more clear.
2025-07-24 11:29:16 +03:00
Pauli Virtanen
fb218fe016 scripts: add mpris-pause.lua to pause media streams when target removed
When current output target of a media player application is removed, it
can be useful if playback is paused (to avoid e.g. music playback to
going to speakers when headset is accidentally unplugged).  Android etc.
implement a policy like this.

Add a policy script that monitors stream target removals. When it
detects a media player application that is linked to a no longer present
output target, it checks whether the stream is associated with a media
player seen in MPRIS. If yes, it sends MPRIS Pause() command to the
media player.

Enable this policy by default.
2025-07-23 10:19:44 +03:00
Pauli Virtanen
bc713acafd m-mpris: add MPRIS plugin
Add a plugin module that can list active MPRIS media players, and send
Pause commands to them.
2025-07-23 10:19:44 +03:00
George Kiagiadakis
faf042a82b wpctl: set-profile: set the "save" flag on the selected profile
Fixes: #808
2025-07-01 13:37:02 +03:00
George Kiagiadakis
e9928b4beb default-nodes/README: update documentation regarding the select-default-node event 2025-07-01 13:20:22 +03:00
George Kiagiadakis
754c805061 default-nodes/find-best: skip the hook if a very high priority node is selected
Just to optimize a bit more for performance
2025-07-01 13:13:21 +03:00
George Kiagiadakis
f1c96843ee default-nodes/rescan: remove unused table and access node.properties only once 2025-07-01 12:52:36 +03:00