Ticket #604: 0001-Virtualized-surround-support-with-alsa-vdownmix-plug.patch

File 0001-Virtualized-surround-support-with-alsa-vdownmix-plug.patch, 7.2 KB (added by Rudd-O, 3 years ago)

adds support for vdownmix if vdownmix is present.

  • src/modules/alsa/alsa-mixer.c

    From 40b563b3e6355bc74388abdb0ad2960ddf5476d6 Mon Sep 17 00:00:00 2001
    From: Manuel Amador (Rudd-O) <rudd-o@rudd-o.com>
    Date: Mon, 13 Jul 2009 08:52:33 -0500
    Subject: [PATCH] Virtualized surround support with alsa vdownmix plugin.
    
    PLEASE CHECK THIS PATCH, file src/pulse/channelmap.c, I am not sure if that change is needed at all, or if I missed something obvious.
    
    Given the following additional ALSA configuration and the vdownmix plugin if installed, if any of the new profiles is selected, that should cause multichannel audio to be written to the underlying audio device, which will trigger the vdownmix plugin into remixing audio in a virtualized fashion:
    ------------------------------------------------
    pcm.!vdownmix51 {
            @args [ CARD DEV ]
            @args.CARD {
                    type string
                    default {
                            @func getenv
                            vars [
                                    ALSA_VDOWNMIX51_CARD
                                    ALSA_PCM_CARD
                                    ALSA_CARD
                            ]
                            default {
                                    @func refer
                                    name defaults.pcm.vdownmix51.card
                            }
                    }
            }
            @args.DEV {
                    type integer
                    default {
                            @func igetenv
                            vars [
                                    ALSA_VDOWNMIX51_DEVICE
                            ]
                            default {
                                    @func refer
                                    name defaults.pcm.vdownmix51.device
                            }
                    }
            }
            type vdownmix
            slave.pcm {
                    @func refer
                    name {
                            @func concat
                            strings [
                                    "cards."
                                    {
                                            @func card_driver
                                            card $CARD
                                    }
                                    ".pcm.vdownmix51." $DEV ":CARD=" $CARD
                            ]
                    }
            }
            hint {
                    description "Downmix to stereo 5.1 Surround output to Front, Center, Rear and Subwoofer speakers"
                    device $DEV
            }
    }
    
    pcm.!vdownmix40 {
            @args [ CARD DEV ]
            @args.CARD {
                    type string
                    default {
                            @func getenv
                            vars [
                                    ALSA_VDOWNMIX51_CARD
                                    ALSA_PCM_CARD
                                    ALSA_CARD
                            ]
                            default {
                                    @func refer
                                    name defaults.pcm.vdownmix40.card
                            }
                    }
            }
            @args.DEV {
                    type integer
                    default {
                            @func igetenv
                            vars [
                                    ALSA_VDOWNMIX51_DEVICE
                            ]
                            default {
                                    @func refer
                                    name defaults.pcm.vdownmix40.device
                            }
                    }
            }
            type vdownmix
            slave.pcm {
                    @func refer
                    name {
                            @func concat
                            strings [
                                    "cards."
                                    {
                                            @func card_driver
                                            card $CARD
                                    }
                                    ".pcm.vdownmix51." $DEV ":CARD=" $CARD
                            ]
                    }
            }
            hint {
                    description "Downmix to stereo 4.0 Surround output to Front, Center, Rear and Subwoofer speakers"
                    device $DEV
            }
    }
    ------------------------------------------------------
    ---
     src/modules/alsa/alsa-mixer.c                    |    2 ++
     src/modules/alsa/mixer/profile-sets/default.conf |   14 ++++++++++++++
     src/pulse/channelmap.c                           |    4 ++--
     3 files changed, 18 insertions(+), 2 deletions(-)
    
    diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
    index a5515e1..6fc16bb 100644
    a b  
    28032803        { "analog-surround-61",     N_("Analog Surround 6.1") }, 
    28042804        { "analog-surround-70",     N_("Analog Surround 7.0") }, 
    28052805        { "analog-surround-71",     N_("Analog Surround 7.1") }, 
     2806        { "analog-vdownmix-40",     N_("Virtualized Analog Surround 4.0 (for stereo headphones)") }, 
     2807        { "analog-vdownmix-51",     N_("Virtualized Analog Surround 5.1 (for stereo headphones)") }, 
    28062808        { "iec958-stereo",          N_("Digital Stereo (IEC958)") }, 
    28072809        { "iec958-surround-40",     N_("Digital Surround 4.0 (IEC958)") }, 
    28082810        { "iec958-ac3-surround-40", N_("Digital Surround 4.0 (IEC958/AC3)") }, 
  • src/modules/alsa/mixer/profile-sets/default.conf

    diff --git a/src/modules/alsa/mixer/profile-sets/default.conf b/src/modules/alsa/mixer/profile-sets/default.conf
    index ac41a8d..de80eae 100644
    a b  
    137137priority = 4 
    138138direction = output 
    139139 
     140[Mapping analog-vdownmix-40] 
     141device-strings = vdownmix40:%f 
     142channel-map = front-left,front-right,rear-left,rear-right 
     143paths-output = analog-output analog-output-lfe-on-mono 
     144priority = 11 
     145direction = output 
     146 
     147[Mapping analog-vdownmix-51] 
     148device-strings = vdownmix51:%f 
     149channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe 
     150paths-output = analog-output analog-output-lfe-on-mono 
     151priority = 11 
     152direction = output 
     153 
    140154; An example for defining multiple-sink profiles 
    141155#[Profile output:analog-stereo+output:iec958-stereo+input:analog-stereo] 
    142156#description = Foobar 
  • src/pulse/channelmap.c

    diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c
    index 8882301..8f405e8 100644
    a b  
    533533        map.map[0] = PA_CHANNEL_POSITION_LEFT; 
    534534        map.map[1] = PA_CHANNEL_POSITION_RIGHT; 
    535535        goto finish; 
    536     } else if (pa_streq(s, "surround-40")) { 
     536    } else if (pa_streq(s, "surround-40") || pa_streq(s, "vdownmix-40")) { /* i am not so sure whether this change is needed, Lennart, ideas? */ 
    537537        map.channels = 4; 
    538538        map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT; 
    539539        map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT; 
     
    556556        map.map[3] = PA_CHANNEL_POSITION_REAR_RIGHT; 
    557557        map.map[4] = PA_CHANNEL_POSITION_FRONT_CENTER; 
    558558        goto finish; 
    559     } else if (pa_streq(s, "surround-51")) { 
     559    } else if (pa_streq(s, "surround-51") || pa_streq(s, "vdownmix-51")) { /* i am not so sure whether this change is needed, Lennart, ideas? */ 
    560560        map.channels = 6; 
    561561        map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT; 
    562562        map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;