Rather than having widget/widget2/widget_callback fields in the struct
alsa_elem, have a list of callbacks and allow private data to be
passed to callbacks.
As create_routing_grid() and routing_grid_label() are called 1:1 now,
the code from routing_grid_label() can be moved inside
create_routing_group_id() if we add descr and align parameters.
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.
The search for routing sink ALSA elements should only include PCM,
Mixer, and DSP Capture Enums. The previous search for Capture Enum
excluding Line In Level Capture Enums is too broad for Gen 4 as the
Air control is a Capture Enum as well.
Partial cherry-pick from 5dc3ab Sebastian Kaminski
"dial ... shows focus indication".
Use has_focus() rather than has_visible_focus() as I found
has_visible_focus() to be unreliable.
Passing a double to abs() truncates it to an integer, which is probably
not intended, and also causes fatal errors on clang.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
The compilation flags that are necessary for building and part of the
developer's intentions belong in the `+=` section, but the base flags
that distros like to override belong in a `?=` section, so that build
systems using their own are respected.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
The Clarett 8Pre layout was very wide; it would be preferable if the
main window output controls were placed below the global & input
controls like for the Gen 3 18i8 and 18i20.
Rather than use the presence of speaker switching to determine which
main window layout to use, check the number of input & output
controls, and use the taller layout if the total is 12 or more.
jandejongh reported:
In the USB Levels display, user can (attempt to) set the level of the
"slider".
Expected: These "sliders" are read-only and should not allow setting a
value (makes no sense to me?).
Fixes: #78.
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.