static void hammerfall_check_sync (hammerfall_t *h, snd_ctl_elem_value_t *ctl) { const char *name; int val; snd_ctl_elem_id_t *ctl_id; jack_info ("check sync"); snd_ctl_elem_id_alloca (&ctl_id); snd_ctl_elem_value_get_id (ctl, ctl_id); name = snd_ctl_elem_id_get_name (ctl_id); if (strcmp (name, "ADAT1 Sync Check") == 0) { val = snd_ctl_elem_value_get_enumerated (ctl, 0); hammerfall_check_sync_state (h, val, 0); } else if (strcmp (name, "ADAT2 Sync Check") == 0) { val = snd_ctl_elem_value_get_enumerated (ctl, 0); hammerfall_check_sync_state (h, val, 1); } else if (strcmp (name, "ADAT3 Sync Check") == 0) { val = snd_ctl_elem_value_get_enumerated (ctl, 0); hammerfall_check_sync_state (h, val, 2); } else { jack_error ("Hammerfall: unknown control \"%s\"", name); } }
/** * \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; }
static snd_ctl_ext_key_t sco_ctl_find_elem(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id) { const char *name = snd_ctl_elem_id_get_name(id); DBG(""); if(strcmp(name, vol_devices[0]) == 0) { return HS_SPEAKER; } else if(strcmp(name, vol_devices[1]) == 0) { return HS_MICROPHONE; } else { return SND_CTL_EXT_KEY_NOT_FOUND; } }
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); }
static snd_ctl_ext_key_t pulse_find_elem(snd_ctl_ext_t * ext, const snd_ctl_elem_id_t * id) { const char *name; unsigned int numid; numid = snd_ctl_elem_id_get_numid(id); if (numid > 0 && numid <= 4) return numid - 1; name = snd_ctl_elem_id_get_name(id); if (strcmp(name, SOURCE_VOL_NAME) == 0) return 0; if (strcmp(name, SOURCE_MUTE_NAME) == 0) return 1; if (strcmp(name, SINK_VOL_NAME) == 0) return 2; if (strcmp(name, SINK_MUTE_NAME) == 0) return 3; return SND_CTL_EXT_KEY_NOT_FOUND; }
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"); }