match_sound_device_setting

match_sound_device_setting(name: Any, possible_values: list[str]) str | None[source]

Matches a saved SOUND_DEVICE value to one of possible_values.

SOUND_DEVICE may have been saved in a format older than what get_sound_devices() returns today: a bare card ID, an explicit ‘hw:N,D’, or the current ‘ID (longname)’. Used by the settings UI so a value saved under an old format still selects the right entry in the dropdown instead of silently falling back to whichever one happens to be first.

Returns:

The matching entry from possible_values, or None if nothing matches.

Return type:

str | None