Make the Level Meter check compatible with alsa-sim.c
Rather than retrieving the firmware version in alsa_scan_cards(), use get_elem_by_name() to check if the control is present. Update alsa-sim.c alsa_config_to_new_elem() to read iface=CARD controls.
This commit is contained in:
@@ -249,12 +249,13 @@ static int alsa_config_to_new_elem(
|
||||
}
|
||||
}
|
||||
|
||||
// check iface value; only interested in MIXER and PCM
|
||||
// check iface value; only interested in CARD, MIXER, and PCM
|
||||
if (!iface) {
|
||||
printf("missing iface node in control id %d\n", id);
|
||||
goto fail;
|
||||
}
|
||||
if (strcmp(iface, "MIXER") != 0 &&
|
||||
if (strcmp(iface, "CARD") != 0 &&
|
||||
strcmp(iface, "MIXER") != 0 &&
|
||||
strcmp(iface, "PCM") != 0)
|
||||
goto fail;
|
||||
|
||||
|
||||
@@ -473,14 +473,6 @@ static void alsa_add_card_callback(struct alsa_card *card) {
|
||||
);
|
||||
}
|
||||
|
||||
static void alsa_get_firmware_version(struct alsa_card *card) {
|
||||
struct alsa_elem *elem = get_elem_by_name(card->elems, "Firmware Version");
|
||||
|
||||
if (!elem)
|
||||
return;
|
||||
card->firmware_version = alsa_get_elem_value(elem);
|
||||
}
|
||||
|
||||
static void alsa_subscribe(struct alsa_card *card) {
|
||||
int count = snd_ctl_poll_descriptors_count(card->handle);
|
||||
|
||||
@@ -535,7 +527,6 @@ void alsa_scan_cards(void) {
|
||||
card->handle = ctl;
|
||||
|
||||
alsa_get_elem_list(card);
|
||||
alsa_get_firmware_version(card);
|
||||
alsa_subscribe(card);
|
||||
|
||||
create_card_window(card);
|
||||
|
||||
@@ -145,7 +145,6 @@ struct alsa_card {
|
||||
char *name;
|
||||
snd_ctl_t *handle;
|
||||
struct pollfd pfd;
|
||||
int firmware_version;
|
||||
GArray *elems;
|
||||
struct alsa_elem *sample_capture_elem;
|
||||
struct alsa_elem *level_meter_elem;
|
||||
|
||||
@@ -210,7 +210,10 @@ void add_mixer_action_map(struct alsa_card *card) {
|
||||
card
|
||||
);
|
||||
|
||||
if (card->firmware_version) {
|
||||
// Hide the levels menu item if there is no "Firmware Version"
|
||||
// control (working kernel support for level meters was added in the
|
||||
// same version as the "Firmware Version" control)
|
||||
if (get_elem_by_name(card->elems, "Firmware Version")) {
|
||||
g_action_map_add_action_entries(
|
||||
G_ACTION_MAP(card->window_main),
|
||||
levels_entries,
|
||||
|
||||
Reference in New Issue
Block a user