# This is an example configuration file that shows how to setup a smart filter
# (an equalizer using filter-chain in this case)

wireplumber.profiles = {
  main = {
    filter.sink.smart-equalizer = required
  }
}

wireplumber.components = [
  {
    name = libpipewire-module-filter-chain, type = pw-module
    arguments = {
      node.name = "filter.sink.smart-equalizer"
      node.description = "2ch Equalizer Sink"
      media.name       = "2ch Equalizer Sink"
      filter.graph = {
        nodes = [
          {
              type  = builtin
              name  = bass
              label = bq_lowshelf
              control = { "Freq" = 250.0, "Q" = 1.0, "Gain" = 0.0 }
          }
          {
              type  = builtin
              name  = treble
              label = bq_peaking
              control = { "Freq" = 6000.0, "Q" = 1.0, "Gain" = 0.0 }
          }
        ]
        links = [
          { output = "bass:Out", input = "treble:In" }
        ]
      }
      audio.channels = 2
      audio.position = [ FL, FR ]
      capture.props = {
        # this is a sink filter, so it will appear as a sink in wpctl/pactl/etc,
        # it will target a sink and can be chained with other sink smart filters
        media.class = Audio/Sink

        # treat this as a smart filter
        filter.smart = true

        # the unique name of the filter
        filter.smart.name = "filter.sink.smart-equalizer"

        ## set this to always link the filter to a particular sink
        ## or leave it unset in order to follow the default sink
        #filter.smart.target = { node.name = "alsa_output.pci-0000_00_01.0.analog-stereo" }

        ## here you can specify filter dependencies, using their names
        ## (filter.smart.name) if you set up many of them to be linked in a chain
        #filter.smart.before = []
        #filter.smart.after = []
      }
      playback.props = {
        # This must be set to ensure that the real audio sink is suspended
        # when there is no active client stream linked
        node.passive = true

        # Set this to avoid linking the filter to role-based sinks when
        # role-based sinks are defined and node.stream.default-media-role is
        # configured in the settings
        media.role = "DSP"
      }
    }
    provides = filter.sink.smart-equalizer
  }
]
