Hint strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

shouldn't shortname be more appropriate for hint strings than
longname?  For example, a longname version appears like

	default:CARD=Live
	    SB Live 5.1 (rev.7, serial:0x80641102) at 0xd200, irq 50, ADC Capture/Standard PCM Playback
	    Default Audio Device

while a shortname version looks more obvious like

	default:CARD=Live
	    SB Live 5.1, ADC Capture/Standard PCM Playback
	    Default Audio Device


Also, I feel the basic filtering could be better implemented in
alsa-lib, such as playback/capture selection.  I also prefer separate
device name and description lists.  For example, we can add a
PCM-specific name_hint function, snd_pcm_name_hint().

	int snd_pcm_name_hint(int stream, char ***devices,
		char ***cards, char ***descs);
			
where cards or descs can be NULL optionally.

Then, pcm_list() in aplay.c, which is currently like below: 

static void pcm_list(void)
{
	char **hints, **n, *delim, *filter;

	if (snd_device_name_hint(-1, "pcm", &hints) < 0)
		return;
	n = hints;
	filter = stream == SND_PCM_STREAM_CAPTURE ? "{Playback}" : "{Capture}";
	while (*n != NULL) {
		delim = strchr(*n, '|');
		if (delim) {
			*delim = '\0';
			if (strstr(delim + 1, filter) != NULL)
				goto __end;
		}
		printf("%s\n", *n);
		if (delim++) {
			printf("    ");
			while (*delim) {
				if (*delim == '\n')
					printf("\n    ");
				else
					putchar(*delim);
				delim++;
			}
			putchar('\n');
		}
	      __end:
		n++;
	}
	snd_device_name_free_hint(hints);
}

would be simplified like:

static void pcm_list(void)
{
	char **devices, **cards, **descs;
	int i, n;

	n = snd_pcm_name_hint(stream, &devices, &cards, &descs);
	if (n <= 0)
		return;
	for (i = 0; i < n; i++) {
		printf("%s\n", devices[i]);
		if (cards[i])
			printf("    %s\n", cards[i]);
		if (descs[i])
			printf("    %s\n", descs[i]);
	}
	snd_device_name_free_hint(devices);
	snd_device_name_free_hint(cards);
	snd_device_name_free_hint(descs);
}

We can add some optional flags to search all or search only items with
hints, etc, if needed.


Takashi

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux