There is a very old thread [1] on alsa-user on this topic which seems to go through some yucky solutions. I have the same use case, and post some findings here.
Since pre-2003 alsa-lib calls wordexp(3) on the filenames. I am using the patch below in /usr/share/alsa/alsa.conf
It follows a precedent set by other files such as .Xdefaults-hostname.
I'd submit a patch, except there seems to be no guarantee that HOSTNAME is in the environment (on Slackware it is explicitly set in /etc/profile.) Without it I can only see a bash local variable.
From the old thread I imagine this function (or at least this mail) would
be useful to others.
Would it be better to patch the C code to provide a token (eg. '\h') that is substituted by the hostname? Or is it enough to assume that HOSTNAME would be set?
I didn't consider short vs. long hostnames, I suppose $HOSTNAME gives the user/admin some control over this.
This:
~/.asoundrc-$(hostname -s)
may work, but I don't see that forking a process is an option.
[1] http://thread.gmane.org/gmane.linux.alsa.user/27532/focus=27542