# filter-chain example config file for PipeWire version "0.3.51" #
context.properties = {
    ## Configure properties in the system.
    #mem.warn-mlock  = false
    #mem.allow-mlock = true
    #mem.mlock-all   = false
    log.level        = 0
}

context.spa-libs = {
    #<factory-name regex> = <library-name>
    #
    # Used to find spa factory names. It maps an spa factory name
    # regular expression to a library name that should contain
    # that factory.
    #
    audio.convert.* = audioconvert/libspa-audioconvert
    support.*       = support/libspa-support
}

context.modules = [
    # Uses realtime scheduling to boost the audio thread priorities
    { name = libpipewire-module-rt
        args = {
            #rt.prio      = 88
            #rt.time.soft = -1
            #rt.time.hard = -1
        }
        flags = [ ifexists nofail ]
    }

    # The native communication protocol.
    { name = libpipewire-module-protocol-native }

    # Allows creating nodes that run in the context of the
    # client. Is used by all clients that want to provide
    # data to PipeWire.
    { name = libpipewire-module-client-node }

    # Makes a factory for wrapping nodes in an adapter with a
    # converter and resampler.
    { name = libpipewire-module-adapter }

    { name = libpipewire-module-filter-chain
        args = {
            #audio.format    = F32
            #audio.rate      = 48000
            audio.channels   = 2
            audio.position   = [ FL FR ]
            node.description = "Demonic example"
            media.name       = "Demonic example"
            filter.graph = {
                nodes = [
                    {
                        name   = rev
                        type   = ladspa
                        plugin = revdelay_1605
                        label  = revdelay
                        control = {
                            "Delay Time (s)" = 2.0
                        }
                    }
                    {
                        name   = pitch
                        type   = ladspa
                        plugin = am_pitchshift_1433
                        label  = amPitchshift
                        control = {
                            "Pitch shift" = 0.6
                        }
                    }
                    {
                        name   = rev2
                        type   = ladspa
                        plugin = g2reverb
                        label  = G2reverb
                        control = {
                            "Reverb tail" = 0.5
                            "Damping"     = 0.9
                        }
                    }
                ]
                links = [
                    { output = "rev:Output"   input = "pitch:Input" }
                    { output = "pitch:Output" input = "rev2:In L" }
                ]
                inputs  = [ "rev:Input" ]
                outputs = [ "rev2:Out L" ]
            }
            capture.props = {
                node.name        = "effect_input.filter-chain-demonic"
                #media.class = Audio/Sink
            }
            playback.props = {
                node.name        = "effect_output.filter-chain-demonic"
                #media.class = Audio/Source
            }
        }
    }
]
