I was having trouble setting up surround sound on a PC with an integrated Realtek HD Sound Card ALC898. My problem was that although I had a 7.1 soundcard and a 7.1 sound system, not all my speakers where playing.
After checking pulseaudio I noticed that my soundcard was detected only as 5.1 compatible but with two audio inputs, so I was left with the task of turning one of the inputs jacks into an output (preserving one of the inputs for my microphone).
On Arch Linux hdajackretask is part of the alsa-tools package, so simply install it with:
# pacman -S alsa-tools
On Ubuntu you will want to install it with:
# apt-get install alsa-tools
If on Ubuntu that does not work, or hdajackretask is not contained in alsa-tools, try the following alternative. Also, do not forget to sudo in all cases if needed.
# apt-get install alsa-tools-gui hdajackretask
With hdajackretask you can now simply redirect your audio channels though any of your jacks. This can be used to up mix stereo to 7.1 surround, on laptops to override your microphone and have 4 output channels, or as in my case, to restore an audio output which has been detected as input.
Simply launch hdajackretask in your terminal (maybe you will need super-user rights, although I didn't)
You will be prompted with a window like the following where all detected audio inputs and outputs are displayed. You can now simply override any of them and assign any desired audio line to them.
The screenshot shows my current configuration. Notice how I have assigned my blue back-jack to act as side line out.