Thanks, this is very good refactoring. Just two remarks below: On Tue, 2016-03-01 at 11:41 +0100, David Henningsson wrote: > +static int element_ask_vol_dB(snd_mixer_elem_t *me, int dir, long value, long *dBvalue) { Shouldn't the dir type be pa_alsa_direction_t? > +Â Â Â Â } else if (e->n_channels > 2) { > +Â Â Â Â Â Â Â Â /* FIXME: In some places code like this is used: > +Â Â Â Â Â Â Â Â Â * > +Â Â Â Â Â Â Â Â Â *Â Â Â Â Â e->masks[alsa_channel_ids[p]][e->n_channels-1] > +Â Â Â Â Â Â Â Â Â * > +Â Â Â Â Â Â Â Â Â * The definition of e->masks is > +Â Â Â Â Â Â Â Â Â * > +Â Â Â Â Â Â Â Â Â *Â Â Â Â Â pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST + 1][2]; > +Â Â Â Â Â Â Â Â Â * > +Â Â Â Â Â Â Â Â Â * Since the array size is fixed at 2, we obviously > +Â Â Â Â Â Â Â Â Â * don't support elements with more than two > +Â Â Â Â Â Â Â Â Â * channels... */ > +Â Â Â Â Â Â Â Â pa_log_warn("Volume element %s has %u channels. That's too much! I can't handle that!", e->alsa_name, e->n_channels); > +Â Â Â Â Â Â Â Â e->n_channels = 2; As I mentioned earlier, this assignment can be dropped. --Â Tanu