Setting the order of multiple sound devices

In a terminal, run

cat /proc/asound/modules

to find out which sound modules are loaded. Say we get:

0 snd_emu10k1
1 snd_hda_intel
2 snd_usb_audio
3 snd_virmidi

and say we want to rearrange them, so that:

0 will be the hda_intel,
1 will be the usb_audio,
2 will be the emu10k1 and
3 will be the virmidi

Edit

/etc/modprobe.d/alsa-base.conf

and add to the end of the file the following line:

options snd slots=snd_hda_intel,snd-emu10k1,snd-virmidi,

Reboot the machine and the above order will be enforced

In a terminal, if we now run

cat /proc/asound/modules

we get:

0 snd_hda_intel
1 snd_usb_audio
2 snd_emu10k1
3 snd_virmidi