# 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_fc",
              "label": "mixer"
            },
            {
              "type": "builtin",
              "name": "mixer_s",
              "label": "mixer"
            },
            {
              "type": "builtin",
              "name": "s_phased",
              "label": "convolver",
              "config": {
                "filename": "/hilbert",
                "length": 90
              }
            },
            {
              "type": "builtin",
              "name": "mixer_lt",
              "label": "mixer",
              "control": {
                "Gain 1": 1,
                "Gain 2": 0,
                "Gain 3": 0.7071067811865475,
                "Gain 4": -0.7071067811865475
              }
            },
            {
              "type": "builtin",
              "name": "mixer_rt",
              "label": "mixer",
              "control": {
                "Gain 1": 0,
                "Gain 2": 1,
                "Gain 3": 0.7071067811865475,
                "Gain 4": 0.7071067811865475
              }
            }
          ],
          "links": [
            {
              "output": "mixer_fc:Out",
              "input": "mixer_lt:In 3"
            },
            {
              "output": "mixer_fc:Out",
              "input": "mixer_rt:In 3"
            },
            {
              "output": "mixer_s:Out",
              "input": "s_phased:In"
            },
            {
              "output": "s_phased:Out",
              "input": "mixer_lt:In 4"
            },
            {
              "output": "s_phased:Out",
              "input": "mixer_rt:In 4"
            }
          ],
          "inputs": [
            "mixer_lt:In 1",
            "mixer_rt:In 2",
            "mixer_fc:In 1",
            "mixer_fc:In 2",
            "mixer_s:In 1",
            "mixer_s:In 2"
          ],
          "outputs": [
            "mixer_lt:Out",
            "mixer_rt:Out"
          ]
        },
        "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"
          ]
        }
      }
    }
  ]
}
