default node improvements
This MR improves the logic when finding and setting the default node in module-default-nodes
:
-
An extra check is added to make 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.
-
The logic to find a default node has also been improved, allowing virtual sources to be set as default sources.
Fixes #85 (closed) and #130 (closed)