Configuring default alsa device (hw:0,0) in asoundrc

alsaaudio

I am using a multimedia application (XBMC Frodo RC3) that does not allow me to select custom pcm device. It just asks the hardware device (in this case it is hw:0,0).

Given this limitation I have to write an asoundrc (or asound.conf) file where I can configure the hw:0,0 device.

I test the configuration by running:

    speaker-test -D hw:0,0 -c6

This simulates how the XBMC will produce surround sound.

My asound.conf looks like this at the moment:

pcm.surroundsw {
    type    route
    slave {
            pcm surround51
    }
    ttable {
            0.2 1
            1.3 1
            2.1 8
            3.0 8
            4.4 1
            5.5 1
    }
 }

This is the working routing table so when I run speaker-test -Dsurroundsw -c6 I get the desired behavior.

What kind of asound.conf should I write to get the desired behavior when I run speaker-test -D hw:0,0 -c6? This is purely an ALSA configuration problem.

Best Answer

Just define a device named hw, but use ! to ensure that the built-in definition is overridden, and use @args to allow parameters (which are ignored if you don't use them in the definition):

pcm.!hw {
    @args [ CARD DEV SUBDEV ]
    @args.CARD   { type string }
    @args.DEV    { type integer }
    @args.SUBDEV { type integer }
    # normal definition here:
    type route
    ...
}
Related Question