[pulseaudio-discuss] {PATCH][RFC] AC3 passthrough support

Michael Rans mcarans at yahoo.co.uk
Sun Jul 11 14:02:21 PDT 2010

Finally I got it all working!

These are the steps on Ubuntu Lucid 10.04 LTS:
1. Open from Pulse source code: src/modules/alsa/alsa-sink.c
2. Replace: pa_sink_set_max_rewind(u->sink, u->hwbuf_size);      with:      
    if(strcmp(u->device_name, "a52") == 0) {
        pa_sink_set_max_rewind(u->sink, 0);
    } else {
        pa_sink_set_max_rewind(u->sink, u->hwbuf_size);
3. Add Colin's patch:

             if (PA_UNLIKELY((sframes = snd_pcm_mmap_commit(u->pcm_handle, 
offset, frames)) < 0)) {

+                if (!after_avail && (int) sframes == -EAGAIN)
+                    break;
                 if ((r = try_recover(u, "snd_pcm_mmap_commit", (int) sframes)) 
== 0)
4. Compile and install Pulseaudio with udev support: make and sudo make install 
5. Edit /usr/local/share/pulseaudio/alsa-mixer/profile-sets/default.conf: change 
a52:%f to a52
6. Copy /etc/pulse/daemon.conf to ~/.pulse/daemon.conf and ensure it has 
uncommented: default-sample-rate = 48000
7.  Edit ~/.asoundrc
8.  Put in it:
# Encode AC3 -> Directly on hardware
pcm.Filter_A52Encode {
    type a52
    bitrate 448
    channels 6
    card NVidia

# Rate Converter to 48kHz, needed for some applications
pcm.a52 {
    type rate
    slave {
        pcm "Filter_A52Encode"
        rate 48000
9. Change NVidia to your card's name from: cat /proc/asound/cards
10. sudo alsa reload
11. Make sure you do not have a ~/.pulse/default.pa or if you do, that it is 
using load-module module-udev-detect to load Alsa sinks not load-module 
module-alsa-sink ... 

12. pulseaudio -k
13. pulseaudio -D

I hope I didn't miss anything.

This will give you sinks you can switch between in Sound Preferences for A52 and 
stereo that work even with libsdl (I tried Oolite). However, you cannot switch 
between A52 and stereo while the music is playing eg. in Rhythmbox - you will 
get that the resource is unavailable in the logs (at least, I did). It will 
resolve itself if you stop and restart the music.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20100711/284ee915/attachment.htm>

More information about the pulseaudio-discuss mailing list