+#define ALSA_VOLUME(channel) \
+ err = snd_mixer_selem_get_##channel##_dB_range(elem, &min, &max) || \
+ snd_mixer_selem_get_##channel##_dB(elem, 0, &val); \
+ if (err != 0 || min >= max) { \
+ err = snd_mixer_selem_get_##channel##_volume_range(elem, &min, &max) || \
+ snd_mixer_selem_get_##channel##_volume(elem, 0, &val); \
+ force_linear = true; \
+ }
+
+#define ALSA_MUTE_SWITCH(channel) \
+ if ((err = snd_mixer_selem_get_##channel##_switch(elem, 0, &pbval)) < 0) \
+ fprintf(stderr, "i3status: ALSA: " #channel "_switch: %s\n", snd_strerror(err)); \
+ if (!pbval) { \
+ START_COLOR("color_degraded"); \
+ fmt = fmt_muted; \
+ }
+
+static char *apply_volume_format(const char *fmt, char *outwalk, int ivolume, const char *devicename) {