GNOME Bugzilla – Bug 332442
multiple sound devices with the same name aren't shown
Last modified: 2013-01-28 10:52:09 UTC
Please describe the problem: well, that's basically it And, BTW, this bugzilla stuff sucks - the amount of work I had to do, just to let you know this single line of text: first, I had to create an account with some made-up information totally unrelated to the bug and then I even had to enable cookies in the browser or enter the login information after every step. Steps to reproduce: 1. 2. 3. Actual results: Expected results: Does this happen every time? Other information:
ALSA plugin limitation ?
Yes.
What can be done to fix this limitation ?
Append #1, #2, ... to identical names and make sure the function that is doing the Open() can determine which soundcard to open in such a case.
I had an idea tonight : let's write a dictionary/mapping/associative array/whatever you want to call it, which maps strings to "device descriptors" (the plugin puts whatever it wants here), with an Add (key, descriptor) method, which would do the following : - if key is not in here already, just Set(key, descriptor) ; - if it is in there, see if key + "[2]", key + "[3]", etc are there, and when we find one which isn't, just Set(newKey, descriptor). Now our device plugins would have a dict of this type in them, and : (1) GetDeviceNames would dict.Flush (), then Add (not Set) all detected plugins to dict (2) Open would search the name in the dict, and use the descriptor associated to it. This would allow sharing the code to solve device name collision between all the plugins easily (and simplify their code...). Good idea ?
I think it is a good idea...
Ok, yet another bug in my list... sigh.
Created attachment 72043 [details] New class to make life easier for plugin writers Ok, I took a few minutes to write my idea down. How does that look ?
Created attachment 72044 [details] Sample test for the PNoCollisionDictionary class If you put this file in the same directory as no_collision_dict.h, you should be able to just do : g++ test.cxx -lpt -o test to see it in action.
Hmmmm... where is the GetKeys method I would need ?
Looks good, now you need the opposite method.
Created attachment 72085 [details] Updated code This one has the GetKeys method too.
Created attachment 77140 [details] [review] Patch for the alsa plugin Ok, this patch uses my little PNoCollisionDictionary class, and is mostly clean (it just has a silly #include on the class header in my home directory). Some testing by someone else would be appreciated.
Created attachment 81681 [details] [review] Patch for the alsa plugin This patch is now current with cvs -- notice that for some reason the "Default" devices don't work. But since those are added brute-force, I don't know why they should work either ; here is the error message in console using them : ALSA lib pcm.c:2017:(snd_pcm_open_conf) Invalid type for PCM default definition (id: default, value: cards.pcm.default) But it does detect all devices libasound2 makes available.
Is there a way to make a "please-fellow-developpers-review" tag? ;-)
Sigh, I guess I'll write patches replicating this for each and every plugin...
What about this in 3.x with current ptlib?
Well, Jan, you see the comments... I'm still waiting for feedback!
As long as the "default" devices do not work, we can not use it... Are you using plughw ?
Any news?
None. I'd prefer having a single good-working gstreamer plugin (which would relieve us from the care of such things).
Is this bug still valid, since I see in the changelog for 3.2.0: - Allow several ALSA devices to have the same name
This is fixed in the future 4.0.1. ALSA added [1], [2] etc., and moreover the sub-device name is added to the device name.