1998-08-13 15:42:56 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1998-08-30 21:08:44 +00:00
|
|
|
#include "../include/asoundlib.h"
|
1998-08-13 15:42:56 +00:00
|
|
|
|
1999-06-03 21:41:29 +00:00
|
|
|
int main(void)
|
1998-08-13 15:42:56 +00:00
|
|
|
{
|
1998-11-27 15:07:56 +00:00
|
|
|
int idx, idx1, cards, err;
|
1999-06-03 21:41:29 +00:00
|
|
|
snd_ctl_t *handle;
|
2001-02-07 15:13:15 +00:00
|
|
|
snd_ctl_card_info_t info;
|
1998-11-27 15:07:56 +00:00
|
|
|
snd_pcm_info_t pcminfo;
|
|
|
|
snd_mixer_info_t mixerinfo;
|
2000-02-03 19:41:43 +00:00
|
|
|
snd_rawmidi_info_t rawmidiinfo;
|
1998-11-27 15:07:56 +00:00
|
|
|
char str[128];
|
|
|
|
|
|
|
|
cards = snd_cards();
|
1999-06-03 21:41:29 +00:00
|
|
|
printf("Detected %i soundcard%s...\n", cards, cards != 1 ? "s" : "");
|
1998-11-27 15:07:56 +00:00
|
|
|
if (cards <= 0) {
|
|
|
|
printf("Giving up...\n");
|
1999-06-03 21:41:29 +00:00
|
|
|
return 0;
|
1998-11-27 15:07:56 +00:00
|
|
|
}
|
|
|
|
for (idx = 0; idx < cards; idx++) {
|
|
|
|
if ((err = snd_ctl_open(&handle, idx)) < 0) {
|
|
|
|
printf("Open error: %s\n", snd_strerror(err));
|
|
|
|
continue;
|
|
|
|
}
|
2001-02-07 15:13:15 +00:00
|
|
|
if ((err = snd_ctl_card_info(handle, &info)) < 0) {
|
1998-11-27 15:07:56 +00:00
|
|
|
printf("HW info error: %s\n", snd_strerror(err));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
printf("Soundcard #%i:\n", idx + 1);
|
|
|
|
printf(" type - %i\n", info.type);
|
1999-05-02 16:21:30 +00:00
|
|
|
printf(" pcm devs - %i\n", info.pcmdevs);
|
|
|
|
printf(" mixer devs - %i\n", info.mixerdevs);
|
|
|
|
printf(" midi devs - %i\n", info.mididevs);
|
1998-11-27 15:07:56 +00:00
|
|
|
memset(str, 0, sizeof(str));
|
|
|
|
strncpy(str, info.id, sizeof(info.id));
|
|
|
|
printf(" id - '%s'\n", str);
|
|
|
|
printf(" abbreviation - '%s'\n", info.abbreviation);
|
|
|
|
printf(" name - '%s'\n", info.name);
|
|
|
|
printf(" longname - '%s'\n", info.longname);
|
|
|
|
for (idx1 = 0; idx1 < info.pcmdevs; idx1++) {
|
|
|
|
printf("PCM info, device #%i:\n", idx1);
|
|
|
|
if ((err = snd_ctl_pcm_info(handle, idx1, &pcminfo)) < 0) {
|
|
|
|
printf(" PCM info error: %s\n", snd_strerror(err));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
printf(" type - %i\n", pcminfo.type);
|
|
|
|
printf(" flags - 0x%x\n", pcminfo.flags);
|
|
|
|
printf(" id - '%s'\n", pcminfo.id);
|
|
|
|
printf(" name - '%s'\n", pcminfo.name);
|
1999-06-22 13:18:24 +00:00
|
|
|
printf(" playback - %i\n", pcminfo.playback);
|
|
|
|
printf(" capture - %i\n", pcminfo.capture);
|
1998-11-27 15:07:56 +00:00
|
|
|
}
|
|
|
|
for (idx1 = 0; idx1 < info.mixerdevs; idx1++) {
|
|
|
|
printf("MIXER info, device #%i:\n", idx1);
|
|
|
|
if ((err = snd_ctl_mixer_info(handle, idx1, &mixerinfo)) < 0) {
|
|
|
|
printf(" MIXER info error: %s\n", snd_strerror(err));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
printf(" type - %i\n", mixerinfo.type);
|
1999-05-02 16:21:30 +00:00
|
|
|
printf(" elements - %i\n", mixerinfo.elements);
|
|
|
|
printf(" groups - %i\n", mixerinfo.groups);
|
1999-06-03 21:41:29 +00:00
|
|
|
printf(" attrib - 0x%x\n", mixerinfo.attrib);
|
1998-11-27 15:07:56 +00:00
|
|
|
printf(" id - '%s'\n", mixerinfo.id);
|
|
|
|
printf(" name - '%s'\n", mixerinfo.name);
|
|
|
|
}
|
2000-02-03 19:41:43 +00:00
|
|
|
for (idx1 = 0; idx1 < info.mididevs; idx1++) {
|
|
|
|
printf("RAWMIDI info, device #%i:\n", idx1);
|
|
|
|
if ((err = snd_ctl_rawmidi_info(handle, idx1, &rawmidiinfo)) < 0) {
|
|
|
|
printf(" MIXER info error: %s\n", snd_strerror(err));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
printf(" type - %i\n", rawmidiinfo.type);
|
|
|
|
printf(" flags - 0x%x\n", rawmidiinfo.flags);
|
|
|
|
printf(" id - '%s'\n", rawmidiinfo.id);
|
|
|
|
printf(" name - '%s'\n", rawmidiinfo.name);
|
|
|
|
}
|
1998-11-27 15:07:56 +00:00
|
|
|
snd_ctl_close(handle);
|
|
|
|
}
|
1999-06-03 21:41:29 +00:00
|
|
|
return 0;
|
1998-08-13 15:42:56 +00:00
|
|
|
}
|