Skip to content

Default node fixes for ALSA USB nodes

This MR fixes a few issues that happen when an ALSA USB node is set as default node.

Currently, alsa.lua never clears the node name in the node names table when the parent device is destroyed. This is a problem when we plug and unplug an ALSA USB device many times, because the associated nodes will always appear with different names, not allowing the default nodes module to select it if it was previously configured as default node.

Apart from this, if the default a node appears without ports for a short period of time (which seems to happen very often for ALSA USB nodes), the default nodes module will never select it immediately because it does not listen for port changes. We want to listen for port changes to reevaluate again the nodes that did not have ports before. This allows switching to the default node as soon as it has ports if it did not had ports before.

This MR also improves the PtrArray iterator to skip NULL pointers. This is needed so that we can iterate in Lua all the managed objects of a device.

Fixes #293

Merge request reports