Check Firmware Version before enabling Levels menu item

The level meters don't work correctly on earlier kernel versions, so
they shouldn't be displayed in that case. The "Firmware Version" ALSA
control was added to the kernel at the same time as the level meters
were fixed, so use the presence of that to determine whether or not to
enable the menu item.
This commit is contained in:
Geoffrey D. Bennett
2023-11-19 13:12:50 +10:30
parent abee3e537c
commit befce0824f
3 changed files with 23 additions and 1 deletions

View File

@@ -149,7 +149,10 @@ void add_startup_action_map(struct alsa_card *card) {
static const GActionEntry mixer_entries[] = {
{"routing", activate_routing, NULL, "false"},
{"mixer", activate_mixer, NULL, "false"},
{"mixer", activate_mixer, NULL, "false"}
};
static const GActionEntry levels_entries[] = {
{"levels", activate_levels, NULL, "false"}
};
@@ -160,4 +163,13 @@ void add_mixer_action_map(struct alsa_card *card) {
G_N_ELEMENTS(mixer_entries),
card
);
if (card->firmware_version) {
g_action_map_add_action_entries(
G_ACTION_MAP(card->window_main),
levels_entries,
G_N_ELEMENTS(levels_entries),
card
);
}
}