alsa: Register the card ID instead of the name
In ALSA, only the ID is guaranteed to be unique. The name can be duplicated, expecially whe using multiple (nearly) identical cards.
There is a hint of handling duplicate card names in the registerCard() function, but this code is flawed on multiple aspects:
- The "discriminator" counter (s_mixerNums[cardBaseName]) is never incremented, so it will always return 0.
- The class in which the counter is stored, is instantiated for every card separately, so the discrimination will never be possible across multiple cards.
To circumvent, implement getId() and return the ALSA ID. This will create DBUS names based on the ID, so selecting the right card is now possible.
Because the GUI requirers unique names, the ID is also added to the name.
Fixes BKO#340502
Edited by Alex Hermann