DEST="${1:-${HOME}}"

sudo apt-get install -y libasound2-plugin-equal

if [ -n /etc/asound.conf ]; then
	sudo cp /etc/asound.conf.bak /etc/asound.conf.bak-old
fi
sudo cp /etc/asound.conf /etc/asound.conf.bak


# cat <<-EOF | sudo tee /etc/asound.conf
#	pcm.!default {
#	  type plug
#	  slave.pcm plugequal;
#	}
#	ctl.!default {
#	  type hw card 0
#	}
#	ctl.equal {
#	  type equal;
#	}
#	pcm.plugequal {
#	  type equal;
#	  slave.pcm "plughw:0,0";
#	}
#	pcm.equal {
#	  type plug;
#	  slave.pcm plugequal;
#	}
#EOF

cat <<-EOF | sudo tee /etc/asound.conf
	ctl.equal {
	  type equal;
	}
	pcm.plugequal {
	  type equal;
	  slave.pcm "plughw:0,0";
	}
	pcm.equal {
	  type plug;
	  slave.pcm plugequal;
	}
EOF

cat <<-EOF | sudo tee "${DEST}"/.zsh_aliases.d/010_alsa-eq.zsh
	alias alsaeq="alsamixer -D equal"
EOF

