# Register well-known SPA factories
add-spa-lib audio.convert* audioconvert/libspa-audioconvert
add-spa-lib api.alsa.* alsa/libspa-alsa
add-spa-lib api.v4l2.* v4l2/libspa-v4l2
add-spa-lib api.bluez5.* bluez5/libspa-bluez5
add-spa-lib api.vulkan.* vulkan/libspa-vulkan
add-spa-lib api.jack.* jack/libspa-jack

# the client-device pipewire module is needed for libwireplumber-module-monitor
load-pipewire-module libpipewire-module-client-device

# Basic pipewire integration - do not remove
load-module C libwireplumber-module-pipewire

# Grants access to security confined clients
load-module C libwireplumber-module-client-permissions

# Endpoint that provides high-level volume controls for the AGL mixer
# The streams specified here are the ones that will appear in the mixer.
# They must match the stream names in the alsa-udev module,
# except for "Master", which is treated specially.
load-module C libwireplumber-module-mixer {
  "streams": <["Master", "Multimedia", "Navigation", "Communication", "Emergency"]>
}

load-module C libwireplumber-module-monitor {
  "factory": <"api.alsa.monitor">,
  "flags": <["use-adapter"]>
}

load-module C libwireplumber-module-monitor {
  "factory": <"api.bluez5.monitor">,
  "flags": <["local-nodes", "use-adapter"]>
}

load-module C libwireplumber-module-monitor {
  "factory": <"api.v4l2.monitor">
}

# Monitors the ALSA devices that are discovered via udev
# and creates softdsp-endopints for each one of them
# The streams specified here are the ones that will be available for linking
# clients. Currently, they are matched against the client's role string.
load-module C libwireplumber-module-pw-alsa-udev {
  "streams": <["Multimedia", "Navigation", "Communication", "Emergency"]>
}

# Monitors the bluetooth devices that are discovered via bluez
# and creates the endpoints for each one of them
load-module C libwireplumber-module-pw-bluez

# Monitors the Audio clients that are discovered via pipewire
# and creates simple-endpoints for each one of them
load-module C libwireplumber-module-pw-audio-client

# Implements linking clients to devices and maintains
# information about the devices to be used.
# Notes:
# - Devices must be specified in hw:X,Y format, where X and Y are integers.
#   Things like hw:Intel,0 or paths are not understood.
# - Roles and priorities can be arbitrary strings and arbitrary numbers
# - Roles are matched against the stream names specified in the modules above.
load-module C libwireplumber-module-simple-policy {
  "default-playback-device": <"hw:0,0">,
  "default-capture-device": <"hw:0,0">,
  "role-priorities": <{
    "Multimedia": 1,
    "Communication": 5,
    "Navigation": 8,
    "Emergency": 10
  }>
}