This follow up is an attempt to summarize what I've learned over the last couple days, and to improve on this post. For starts, the topic of this thread isn't particularly accurate. It should be something more along the lines of:
**No 5.1 Digital Surround Sound over S/PDIF (Solved!)**
To clarify the important components of my hardware, I have a receiver that can decode Dolby Digital and DTS (that 5.1 soundtrack you'll find on DVD's) and my sound card is connected via optical S/PDIF.
Aside from capabilities, my use of an X-Fi card and Logitech receiver is mostly irrelevant information.
=== Initial confusion: un-confuse-ified ===
*No channels listed in my mixer worked except "Front/Wave In". Figuring out why that was the case, and more importantly why the "Surround Sound" channel didn't work started this little time-sink.
-> This turned out to be an analog channel, and I had no analog connection between my receiver and soundcard. After connecting the appropriate cables, I was able to get sound out of this channel, however, that doesn't necessarily equate to me or you having true surround sound. Depending on several factors, the sound could just be matrixed to emulate surround sound.
*I have a sound card that doesn't have its support status fully listed on ALSA, it just says "Partially Supported"
-> This made me jump to the conclusion that any issues or non-functionality I had was probably due to non-functioning hardware. To test, I installed a fully supported card along side the X-Fi to compare results with. In the end, it didn't matter since things that appeared not to work, simply turned out to be my lack of understanding about digital vs analog signals and connection capabilities, rather then non-functioning hardware.
*When running a speaker-test, I would only hear audio out of 2 speakers and not the other 3 + subwoofer.
-> This was because I was using a digital S/PDIF connection of which there are only 2 channels.
=== Connections ===
S/PDIF (digital): The S/PDIF connection can carry 2 PCM channels, or, with the help of some lossy formats, compressed surround sound. This is why its necessary to do some extra work to get those multi-channel soundtracks over to your receiver for decoding. You will need either a Coaxial or Optical (TOSLINK) cable to connect your receiver to your soundcard. S/PDIF can't carry any of the new HD formats, so I'm guessing many consumer soundcards will phase it out in favor of HDMI.
HDMI (digital): HDMI supports 8 channel PCM streams and the newer lossless formats Dolby True-HD and DTS-HD. Since DD/DTS is only 6 channels, it seems reasonable to assume that the additional work needed to get DD/DTS over S/PDIF is not necessary with HDMI.
TRS (stereo/jack) (analog): Digital formats are first decoded and then converted to analog via your soundcards DAC (Digital-Audio-Converter). To get 6 individual channels (5.1), you will need 3 cables, or 4 cables for 7.1.
=== Step 1: Getting digital audio out of S/PDIF ===[/B]
1. Connect your Optical or Coaxial cable, and make sure your receiver is set to to play audio from the appropriate input.
2. Check your mixer for "IEC958", this is what you'll use to control S/PDIF. Some cards provide various options for output, if so, make sure it is set to "PCM Out". Here's an example from my M-Audio Delta 1010LT (My X-Fi has no options):
3. Now test to ensure you are getting sound (you should only hear 2 channels):
$ speaker-test -D plug:spdif -c 6 -t wav
=== Step 2: Patents FTL ===
Both Dolby Digital and DTS are patent encumbered. Consider this before continuing as there may be ramifications for using these plugins where you live.
If you want to continue, add the packman repo if you don't have it already:
Additional package repositories - openSUSE
Now to get 5.1 working! Of the options, Step 2B is probably better because a) the Dolby Digital format is more common, b) this was what everyone else was doing. I came across no posts regarding the DTS option, however, there is a package for this plugin making it easier to set-up and test.
=== Step 2A: DTS Pass-through ===
Using the alsa dca plugin will allow you to send DTS encoded audio to your receiver.
1. Install the DTS plugin & configure it:
2. Configure it:
# zypper in alsa-plugins-dca
$ cp /usr/share/alsa/pcm/dca.conf > ~/.asoundrc
At this point you should hear individual sound out of each speaker.
$ speaker-test -D plug:dca -c 6 -t wav
=== Step 2B: Dolby Digital Pass-Through ===
Using the a52 alsa plugin will allow you to send Dolby Digital (AC3) encoded audio to your receiver. As of this writing, there isn't an alsa-plugins-a52 package (maybe there never has been, or ever will be). So, you must build it yourself:
1. Get the source code and dependecies:
# | Alias | Name | Enabled | Refresh
$ zypper lr | grep source
24 | repo-source | openSUSE-12.1-Source | No | Yes
If your source repo isn't enabled, enable it:
Repository 'repo-source' has been successfully enabled.
# zypper mr -e 'openSUSE-12.1-Source'
# zypper in libffmpeg-devel
# zypper source-install alsa-plugins
# cd /usr/src/packages/SOURCES
# tar xvf alsa-plugins-*
# cd alsa-plugins-*
4. Restart alsa:
# cd a52/.libs
64: # cp libasound_module_pcm_a52.so /usr/lib64/alsa-lib/
32: # cp libasound_module_pcm_a52.so /usr/lib/alsa-lib/
5. Add an entry to ~/.asoundrc:
# rcalsasound restart
rate 48000 #required somehow, otherwise nothing happens in PulseAudio
This is as far as I got. I get the error "[ac3 @ 0x60d460] Specified sample_fmt is not supported" and I haven't invested any time to really figure it out. I'll try again at some point in the future.
$ speaker-test -D plug:a52 -c 6 -t wav
=== Additional Configurations ===
If you plan on using either, or both of the dca and a52 plugins, you'll want to sift through some of the links below. There's quite a bit more to concern yourself with beyond just getting them to "work". For instance, configuring upmixing so your 2 channel audio isn't sent to the receiver with 4 empty channels. I now understand why it sounded horribad!
=== Disclaimer ===
<-- is an audio noob! Feel free to correct me!
=== References ===
*Dmix - ALSA wiki
*SurroundSound - ALSA wiki
*DigitalOut - ALSA wiki
*Surround sound in Linux
*Gentoo Wiki Archives - HOWTO_Dolby_Digital_and_DTS
*Dolby Digital with Linux and ALSA