Hey Olympia,
Another modification... this time to the sound configuration.
I followed your setup instructions and successfully used the hdmi device as provided by ALSA. However I soon found a problem that (I'm kind of assuming) is probably affecting a lot of other people....
Whenever I play music (which is naturally 44.1kHz) it was playing at 48kHz. Sacre bleu! Suffice to say it sounded like the singers were on low hits of helium
Investigation into my on-board sound (MCP78S in case you're wondering) reveals 2 codecs:
codec#0:Codec: Realtek ALC883
codec#3:Codec: Nvidia MCP78 HDMI
codec#0 is the "normal" codec used by the system for analog and iec958
codec#3 is for HDMI Audio (which is my point of interest)
when I cat /proc/asound/card0/codec#3 I see that 44.1kHz is not a supported samplerate for the HDMI Audio codec:
PCM:
rates [0xc0]: 48000 88200
bits [0xf]: 8 16 20 24
formats [0x1]: PCM
indeed this is confirmed by the helium voices and /var/tmp/xbmc-xbmc.log
19:24:42 T:3052422976 M:156991488 DEBUG: CALSADirectSound::CALSADirectSound - Channels: 2 - SampleRate: 44100 - SampleBit: 16 - Resample false - Codec - IsMusic true - IsPassthrough false - audioDevice: hdmi
19:24:42 T:3052422976 M:160346112 DEBUG: Initialize - using alsa device hdmi
19:24:42 T:3052422976 M:160346112 DEBUG: CALSADirectSound::Initialize - packet size:2048, packet count:16, buffer size:8192
19:24:42 T:3052422976 M:160346112 WARNING: CALSADirectSound::CALSADirectSound - requested samplerate (44100) not supported by hardware, using 48000 instead
So it seems that 3 things are not happening here. XBMC is not resampling, ALSA is not resampling and the HW itself is not resampling. Ugh.
I looked around and found docs on how to create a virtual device and use libsamplerate to resample the audio, but for reasons beyond logic I just didn't really like that solution. I decided instead to slave the hdmi (codec#3) off the realtek (codec#0)
I added the following to my /etc/asound.conf
Code:
pcm.!default {
type plug
slave {
pcm "hdmi"
}
}
In "Settings > Audio hardware" I have chosen the following options:
Audio output: Analog
Audio output device: default
Downmix multichannel to stereo: enabled
If people have the following setup:
PC[HDMI] --> RECEIVER[HDMI] --> TV
then I assume the following would work:
Audio output: Digital
AC3 passthrough: Enabled
DTS passthrough: Enabled
Audio output device: default (remember, it's slaved)
Passthrough output device: hdmi
Downmix multichannel: Disabled
What I've found is that if I do not enable the downmix multichannel option, when I play movies with 5.1 soundtracks, I get no audio over HDMI. This is because when I choose "default" as the device, XBMC will choose "surround51" as the output device for multichannel soundtracks. This could probably be fixed by modifying surround51 and slaving hdmi off that too, but since I am going from PC --> TV, I have no need for multichannel audio anyway.
Another benefit (if you can call it that) is that you will be able to hear the menu/navigation sounds again.
My tests have confirmed that 44.1kHz music files are now being properly resampled instead of played in helium mode, and movies are still playing properly. The only thing I'm not sure is, what is actually doing the resampling? My *hope* is that it is the audio hardware, but for all I know it could be ALSA. Either way, it works and navigation sounds are back!
Edit: adding a pcm.!surround51 section to /etc/asound.conf and slaving hdmi also works, however some additional work needs to be done to get alsa to remap/downmix the channels to 2 speakers. easier to just have xbmc do it, though it could be useful if you have a receiver setup and need/can support multichannel pcm (i don't think any receivers support that though, do they?)