Version: 2.6 (using KDE KDE 3.5.1) Installed from: Gentoo Packages Compiler: g++ (GCC) 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8) OS: Linux KMix currently tries to open 20 devices and records the ones where it successfully detects a soundcard. While it does not pose a severe problem, this could be circumvented (at least for the ALSA backend) by the following code (found in alsactl and slightly modified): <code> #include <stdio.h> #include <alsa/asoundlib.h> int main() { int card, first = 1; int counter = 0; card = -1; /* find each installed soundcards */ while (1) { if (snd_card_next(&card) < 0) break; if (card < 0) { if (first) { fprintf(stderr,"No soundcards found..."); return -ENODEV; } break; } first = 0; counter++; } printf("%d card(s) found\n", counter); } </code> A similar approach might be useful for other backends. It is probably not too difficult to implement, but the mixer interface needs to be extended. I am sure how to best do that, so I provided this wish.
It is NOT possible with other backends, as there are no "iterators" or find-like methods in OSS, Solaris, AIX, and so on. There is no way of finding out where to scan, because there can be "holes" in the soundcard lists (like there exists card 0, 1, 3). So I cannot do that. Also the snd_card_next() library call is not preperly documented by ALSA, so I'll rather stay away from that.