Beispiel #1
0
/**
 * \brief return ASCII CTL element identifier name
 * \param id CTL identifier
 * \return ascii identifier of CTL element
 *
 * The string is allocated using strdup().
 */
char *snd_ctl_ascii_elem_id_get(snd_ctl_elem_id_t *id)
{
	unsigned int index, device, subdevice;
	char buf[256], buf1[32];

	snprintf(buf, sizeof(buf), "numid=%u,iface=%s,name='%s'",
				snd_ctl_elem_id_get_numid(id),
				snd_ctl_elem_iface_name(
					snd_ctl_elem_id_get_interface(id)),
				snd_ctl_elem_id_get_name(id));
	buf[sizeof(buf)-1] = '\0';
	index = snd_ctl_elem_id_get_index(id);
	device = snd_ctl_elem_id_get_device(id);
	subdevice = snd_ctl_elem_id_get_subdevice(id);
	if (index) {
		snprintf(buf1, sizeof(buf1), ",index=%i", index);
		if (strlen(buf) + strlen(buf1) < sizeof(buf))
			strcat(buf, buf1);
	}
	if (device) {
		snprintf(buf1, sizeof(buf1), ",device=%i", device);
		if (strlen(buf) + strlen(buf1) < sizeof(buf))
			strcat(buf, buf1);
	}
	if (subdevice) {
		snprintf(buf1, sizeof(buf1), ",subdevice=%i", subdevice);
		if (strlen(buf) + strlen(buf1) < sizeof(buf))
			strcat(buf, buf1);
	}
	return strdup(buf);
}
static char *id_str(snd_ctl_elem_id_t *id)
{
	static char str[128];
	assert(id);
	sprintf(str, "%i,%i,%i,%s,%i", 
		snd_ctl_elem_id_get_interface(id),
		snd_ctl_elem_id_get_device(id),
		snd_ctl_elem_id_get_subdevice(id),
		snd_ctl_elem_id_get_name(id),
		snd_ctl_elem_id_get_index(id));
	return str;
}
Beispiel #3
0
static void show_control_id(snd_ctl_elem_id_t *id)
{
  unsigned int index, device, subdevice;
  printf("numid=%u,iface=%s,name='%s'",
         snd_ctl_elem_id_get_numid(id),
         control_iface(id),
         snd_ctl_elem_id_get_name(id));
  index = snd_ctl_elem_id_get_index(id);
  device = snd_ctl_elem_id_get_device(id);
  subdevice = snd_ctl_elem_id_get_subdevice(id);
  if (index)
    printf(",index=%i", index);
  if (device)
    printf(",device=%i", device);
  if (subdevice)
    printf(",subdevice=%i", subdevice);
}
Beispiel #4
0
static void show_control_id(snd_ctl_elem_id_t *id)
{
	unsigned int index, device, subdevice;
	const char *hctlname;
	hctlname = snd_ctl_elem_id_get_name(id);
	LOGV("numid=%u,name='%s'",
	       snd_ctl_elem_id_get_numid(id),
	       hctlname);
	index = snd_ctl_elem_id_get_index(id);
	device = snd_ctl_elem_id_get_device(id);
	subdevice = snd_ctl_elem_id_get_subdevice(id);
	if (index)
		LOGV(",index=%i", index);
	if (device)
		LOGV(",device=%i", device);
	if (subdevice)
		LOGV(",subdevice=%i", subdevice);

	/* For we just need to get to know that whether there is a control for "Playback" and "control"
	 * we just pick up these two elements
	 */
	if (strstr(hctlname,"Playback Volume")|| strstr(hctlname, "Capture Volume"))
		LOGD("found placback/capture volume");
}