# Dolby Surround encoder sink
#
# Copy this file into a conf.d/ directory such as
# ~/.config/pipewire/filter-chain.conf.d/
#
context.modules = [
    { name = libpipewire-module-filter-chain
        flags = [ nofail ]
        args = {
            node.description = "Dolby Surround Sink"
            media.name       = "Dolby Surround Sink"
            filter.graph = {
                nodes = [
                    {
                        type  = builtin
                        name  = mixer
                        label = mixer
                        control = { "Gain 1" = 0.5 "Gain 2" = 0.5 }
                    }
                    {
                        type   = ladspa
                        name   = enc
                        plugin = surround_encoder_1401
                        label  = surroundEncoder
                    }
                ]
                links = [
                    { output = "mixer:Out" input = "enc:S" }
                ]
                inputs  = [ "enc:L" "enc:R" "enc:C" null "mixer:In 1" "mixer:In 2" ]
                outputs = [ "enc:Lt" "enc:Rt" ]
            }
            capture.props = {
                node.name      = "effect_input.dolby_surround"
                media.class    = Audio/Sink
                audio.channels = 6
                audio.position = [ FL FR FC LFE SL SR ]
            }
            playback.props = {
                node.name      = "effect_output.dolby_surround"
                node.passive   = true
                audio.channels = 2
                audio.position = [ FL FR ]
            }
        }
    }
]
