Some devices have different nodes for speakers and headphones. In that scenario,
this change notifies the policy to re-link all clients to the new default node
when the user plugs and unplugs the headset.
This reverts commit ad80faaa8d.
The same issue is fixed by the intermediate commit by Wim. Let's revert
this to keep the logic in-sync with policy-node.lua and media-session.
This makes sure nodes are ready before finding the default node, avoiding audio
glitch in wrong device if profile was also changed while changing the default
node (can happen with Gnome Sound Settings).
Since nodes are destroyed and recreated again when a device profile changes, the
only way to make sure device nodes are ready is to check the profile classes
structure, which tell us how many total nodes the device has, and then check
that those nodes exist for that device. A rescan is triggered whenever devices,
nodes or ports changed.
This patch also improves the logic when finding default nodes, allowing virtual
sources to be set as default sources.
Fixes#85 and #130
Previously a default source had to be Audio/Source and a default sink
had to be Audio/Sink. This did not account for:
- monitor sources (Audio/Sink)
- duplex nodes (Audio/Duplex)
- virtual sources (Audio/Source/Virtual)
With this change the restriction is now on the number of input/output
ports, so any Audio/* node with output ports is a valid target to select
as a default source, while any Audio/* node with input ports is a valid
target for a default sink.
Fixes#60
There is no real use for groups in our API. Just use the name of
the file as the default group and be done with it...
Storing multiple groups with this API is problematic because it
forces flushing the file to disk multiple times, one for each group,
and it's just more performant if we use a prefix in the keys
to implement some form of logical separation.
This commit also makes the GKeyFile a temporary object. As we
always load the file from the file system in _load()
and we always replace its contents with a new dictionary in _save(),
there is no point in keeping the keyfile's internal data structures
stored in memory.
Save errors are now also propagated to adhere to the programming
practices of GObject