My USB DAC exposes two controls with the same name but different index numbers to ALSA.
I created the following function to find a mixer control by index and name.
import qualified Sound.ALSA.Mixer as AM
getMixerControl :: AM.Mixer -> AM.CUInt -> String -> IO (Maybe AM.Control)
getMixerControl m i n = do
cs <- AM.controls m
return $ foldr helper Nothing cs
where helper c cs =
if (AM.index c == i) && (AM.name c == n)
then Just c
else cs
My USB DAC exposes two controls with the same name but different index numbers to ALSA.
I created the following function to find a mixer control by index and name.