# Matrix Spatialiser sink
#
# start with pipewire -c filter-chain/sink-matrix-spatialiser.conf
# ( Jean-Philippe Guillemin <hyp3ri0n@sfr.fr> )

context.properties = {
    log.level = 0
}

context.spa-libs = {
    audio.convert.* = audioconvert/libspa-audioconvert
    support.*       = support/libspa-support
}

context.modules = [
    { name = libpipewire-module-rt
        args = {
            #rt.prio      = 88
            #rt.time.soft = -1
            #rt.time.hard = -1
        }
        flags = [ ifexists nofail ]
    }
    { name = libpipewire-module-protocol-native }
    { name = libpipewire-module-client-node }
    { name = libpipewire-module-adapter }

    { name = libpipewire-module-filter-chain
        args = {
            node.description = "Matrix Spatialiser"
            media.name       = "Matrix Spatialiser"
            filter.graph = {
                nodes = [
                    {
                        type   = ladspa
                        name   = matrix
                        plugin = matrix_spatialiser_1422
                        label  = matrixSpatialiser
                        control = {
                            "Width" = 80
                        }
                    }
                ]
                inputs  = [ "matrix:Input L" "matrix:Input R" ]
                outputs = [ "matrix:Output L" "matrix:Output R" ]
            }
            audio.channels = 2
            audio.position = [ FL FR ]
            capture.props = {
                node.name      = "effect_input.matrix_spatialiser"
                media.class    = Audio/Sink
            }
            playback.props = {
                node.name      = "effect_output.matrix_spatialiser"
                node.passive   = true
            }
        }
    }
]
