config: make remaining non rule settings optional

This commit is contained in:
Julian Bouzas 2022-10-03 15:01:03 -04:00
parent f1fbeaa661
commit 6a612db57a
21 changed files with 213 additions and 110 deletions

View file

@ -23,23 +23,22 @@ wireplumber.settings = {
# monitor.alsa.jack-device = false
## The properties used when constructing the 'api.alsa.enum.udev' plugin
monitor.alsa.properties = {}
# monitor.alsa.properties = {}
## These properties override node defaults when running in a virtual machine.
## The rules below still override those.
monitor.alsa.vm.node.defaults = {
api.alsa.period-size = 256
api.alsa.headroom = 8192
}
# monitor.alsa.vm.node.defaults = {
# api.alsa.period-size = 256
# api.alsa.headroom = 8192
# }
## MIDI bridge node properties
monitor.alsa.midi.node-properties = {
# Name set for the node with ALSA MIDI ports
# node.name = "Midi-Bridge"
# Removes longname/number from MIDI port names
# api.alsa.disable-longname = true
}
# monitor.alsa.midi.node-properties = {
# ## Name set for the node with ALSA MIDI ports
# node.name = "Midi-Bridge"
# ## Removes longname/number from MIDI port names
# api.alsa.disable-longname = true
# }
## The list of monitor rules
monitor.alsa.rules = [

View file

@ -10,67 +10,67 @@ wireplumber.settings = {
# monitor.bluetooth.enable-logind = true
## The properties used when constructing the 'api.bluez5.enum.dbus' plugin
monitor.bluetooth.properties = {
## Whether to support connection info or not
api.bluez5.connection-info = true
# monitor.bluetooth.properties = {
# ## Whether to support connection info or not
# api.bluez5.connection-info = true
## These features do not work on all headsets, so they are enabled
## by default based on the hardware database. They can also be
## forced on/off for all devices by the following options:
# bluez5.enable-sbc-xq = true
# bluez5.enable-msbc = true
# bluez5.enable-hw-volume = true
# ## These features do not work on all headsets, so they are enabled
# ## by default based on the hardware database. They can also be
# ## forced on/off for all devices by the following options:
# bluez5.enable-sbc-xq = true
# bluez5.enable-msbc = true
# bluez5.enable-hw-volume = true
## Enabled roles (default: [ a2dp_sink a2dp_source bap_sink bap_source hfp_hf hfp_ag ])
##
## Currently some headsets (Sony WH-1000XM3) are not working with
## both hsp_ag and hfp_ag enabled, so by default we enable only HFP.
##
## Supported roles: hsp_hs (HSP Headset),
## hsp_ag (HSP Audio Gateway),
## hfp_hf (HFP Hands-Free),
## hfp_ag (HFP Audio Gateway)
## a2dp_sink (A2DP Audio Sink)
## a2dp_source (A2DP Audio Source)
## bap_sink (LE Audio Basic Audio Profile Sink)
## bap_source (LE Audio Basic Audio Profile Source)
# bluez5.roles = "[ a2dp_sink a2dp_source bap_sink bap_source hsp_hs hsp_ag hfp_hf hfp_ag ]"
# ## Enabled roles (default: [ a2dp_sink a2dp_source bap_sink bap_source hfp_hf hfp_ag ])
# ##
# ## Currently some headsets (Sony WH-1000XM3) are not working with
# ## both hsp_ag and hfp_ag enabled, so by default we enable only HFP.
# ##
# ## Supported roles: hsp_hs (HSP Headset),
# ## hsp_ag (HSP Audio Gateway),
# ## hfp_hf (HFP Hands-Free),
# ## hfp_ag (HFP Audio Gateway)
# ## a2dp_sink (A2DP Audio Sink)
# ## a2dp_source (A2DP Audio Source)
# ## bap_sink (LE Audio Basic Audio Profile Sink)
# ## bap_source (LE Audio Basic Audio Profile Source)
# # bluez5.roles = "[ a2dp_sink a2dp_source bap_sink bap_source hsp_hs hsp_ag hfp_hf hfp_ag ]"
## Enabled A2DP codecs (default: all).
# bluez5.codecs = "[ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex ]"
# ## Enabled A2DP codecs (default: all).
# bluez5.codecs = "[ sbc sbc_xq aac ldac aptx aptx_hd aptx_ll aptx_ll_duplex faststream faststream_duplex ]"
## HFP/HSP backend (default: native).
## Available values: any, none, hsphfpd, ofono, native
# bluez5.hfphsp-backend = "native"
# ## HFP/HSP backend (default: native).
# ## Available values: any, none, hsphfpd, ofono, native
# bluez5.hfphsp-backend = "native"
## HFP/HSP native backend modem (default: none).
## Available values: none, any or the modem device string as found in
## 'Device' property of org.freedesktop.ModemManager1.Modem interface
# bluez5.hfphsp-backend-native-modem = "none"
# ## HFP/HSP native backend modem (default: none).
# ## Available values: none, any or the modem device string as found in
# ## 'Device' property of org.freedesktop.ModemManager1.Modem interface
# bluez5.hfphsp-backend-native-modem = "none"
## HFP/HSP hardware offload SCO support (default: false).
# bluez5.hw-offload-sco = false
# ## HFP/HSP hardware offload SCO support (default: false).
# bluez5.hw-offload-sco = false
## Properties for the A2DP codec configuration
# bluez5.default.rate = 48000
# bluez5.default.channels = 2
# ## Properties for the A2DP codec configuration
# bluez5.default.rate = 48000
# bluez5.default.channels = 2
## Register dummy AVRCP player, required for AVRCP volume function.
## Disable if you are running mpris-proxy or equivalent.
# bluez5.dummy-avrcp-player = true
# ## Register dummy AVRCP player, required for AVRCP volume function.
# ## Disable if you are running mpris-proxy or equivalent.
# bluez5.dummy-avrcp-player = true
## Opus Pro Audio mode settings
# bluez5.a2dp.opus.pro.channels = 3
# bluez5.a2dp.opus.pro.coupled-streams = 1
# bluez5.a2dp.opus.pro.locations = "FL,FR,LFE"
# bluez5.a2dp.opus.pro.max-bitrate = 600000
# bluez5.a2dp.opus.pro.frame-dms = 50
# bluez5.a2dp.opus.pro.bidi.channels = 1
# bluez5.a2dp.opus.pro.bidi.coupled-streams = 0
# bluez5.a2dp.opus.pro.bidi.locations = "FC"
# bluez5.a2dp.opus.pro.bidi.max-bitrate = 160000
# bluez5.a2dp.opus.pro.bidi.frame-dms = 400
}
# ## Opus Pro Audio mode settings
# bluez5.a2dp.opus.pro.channels = 3
# bluez5.a2dp.opus.pro.coupled-streams = 1
# bluez5.a2dp.opus.pro.locations = "FL,FR,LFE"
# bluez5.a2dp.opus.pro.max-bitrate = 600000
# bluez5.a2dp.opus.pro.frame-dms = 50
# bluez5.a2dp.opus.pro.bidi.channels = 1
# bluez5.a2dp.opus.pro.bidi.coupled-streams = 0
# bluez5.a2dp.opus.pro.bidi.locations = "FC"
# bluez5.a2dp.opus.pro.bidi.max-bitrate = 160000
# bluez5.a2dp.opus.pro.bidi.frame-dms = 400
# }
## The properties used when constructing the 'api.bluez5.midi.enum' plugin
monitor.bluetooth-midi.properties = {}

View file

@ -5,7 +5,7 @@ wireplumber.settings = {
# monitor.libcamera.enable = true
## The properties used when constructing the 'api.libcamera.enum.manager' plugin
monitor.libcamera.properties = {}
# monitor.libcamera.properties = {}
## The list of monitor rules
monitor.libcamera.rules = [

View file

@ -30,10 +30,10 @@ wireplumber.settings = {
## Application names correspond to application.name in stream properties.
## Applications which do not set media.role but which should be considered
## for role based profile switching can be specified here.
policy.bluetooth.media-role.applications = [
"Firefox", "Chromium input", "Google Chrome input", "Brave input",
"Microsoft Edge input", "Vivaldi input", "ZOOM VoiceEngine",
"Telegram Desktop", "telegram-desktop", "linphone", "Mumble",
"WEBRTC VoiceEngine", "Skype"
]
# policy.bluetooth.media-role.applications = [
# "Firefox", "Chromium input", "Google Chrome input", "Brave input",
# "Microsoft Edge input", "Vivaldi input", "ZOOM VoiceEngine",
# "Telegram Desktop", "telegram-desktop", "linphone", "Mumble",
# "WEBRTC VoiceEngine", "Skype"
# ]
}

View file

@ -2,7 +2,7 @@
wireplumber.settings = {
## The properties used when constructing the 'api.v4l2.enum.udev' plugin
monitor.v4l2.properties = {}
# monitor.v4l2.properties = {}
## The list of monitor rules
monitor.v4l2.rules = [

View file

@ -8,8 +8,12 @@
-- create-item.lua script takes pipewire nodes and creates session items (a.k.a
-- linkable) objects out of them.
local defaults = {}
defaults.audio_no_dsp = false
local config = {}
config.audio_no_dsp = Settings.parse_boolean_safe ("policy.default.audio-no-dsp", false)
config.audio_no_dsp = Settings.parse_boolean_safe (
"policy.default.audio-no-dsp", defaults.audio_no_dsp)
items = {}

View file

@ -5,8 +5,15 @@
--
-- SPDX-License-Identifier: MIT
local defaults = {}
defaults.node_properties = Json.Object {
["node.name"] = "Midi-Bridge",
["api.alsa.disable-longname"] = true
}
local config = {}
config.node_properties = Settings.parse_object_safe ("monitor.alsa.midi.node-properties", Json.Object {})
config.node_properties = Settings.parse_object_safe (
"monitor.alsa.midi.node-properties", defaults.node_properties)
SND_PATH = "/dev/snd"
SEQ_NAME = "seq"

View file

@ -7,12 +7,27 @@
local cutils = require ("common-utils")
local defaults = {}
defaults.reserve_priority = -20
defaults.reserve_application_name = "WirePlumber"
defaults.jack_device = false
defaults.properties = Json.Object {}
defaults.vm_node_defaults = Json.Object {
["api.alsa.period-size"] = 256,
["api.alsa.headroom"] = 8192
}
local config = {}
config.reserve_priority = Settings.parse_int_safe ("monitor.alsa.reserve.priority", -20)
config.reserve_application_name = Settings.parse_string_safe ("monitor.alsa.reserve.application-name", "WirePlumber")
config.jack_device = Settings.parse_boolean_safe ("monitor.alsa.jack-device", false)
config.properties = Settings.parse_object_safe ("monitor.alsa.properties", Json.Object {})
config.vm_node_defaults = Settings.parse_object_safe ("monitor.alsa.vm.node.defaults", Json.Object {})
config.reserve_priority = Settings.parse_int_safe (
"monitor.alsa.reserve.priority", defaults.reserve_priority)
config.reserve_application_name = Settings.parse_string_safe (
"monitor.alsa.reserve.application-name", defaults.reserve_application_name)
config.jack_device = Settings.parse_boolean_safe (
"monitor.alsa.jack-device", defaults.jack_device)
config.properties = Settings.parse_object_safe (
"monitor.alsa.properties", defaults.properties)
config.vm_node_defaults = Settings.parse_object_safe (
"monitor.alsa.vm.node.defaults", defaults.vm_node_defaults)
-- unique device/node name tables
device_names_table = nil

View file

@ -7,9 +7,15 @@
local cutils = require ("common-utils")
local defaults = {}
defaults.properties = Json.Object {}
defaults.servers = Json.Array { "bluez_midi.server" }
local config = {}
config.properties = Settings.parse_object_safe ("monitor.bluetooth-midi.properties")
config.servers = Settings.parse_array_safe ("monitor.bluetooth-midi.servers")
config.properties = Settings.parse_object_safe (
"monitor.bluetooth-midi.properties", defaults.properties)
config.servers = Settings.parse_array_safe (
"monitor.bluetooth-midi.servers", defaults.servers)
-- unique device/node name tables
node_names_table = nil

View file

@ -9,8 +9,14 @@ local COMBINE_OFFSET = 64
local cutils = require ("common-utils")
local defaults = {}
defaults.properties = Json.Object {
["api.bluez5.connection-info"] = true
}
local config = {}
config.properties = Settings.parse_object_safe ("monitor.bluetooth.properties", Json.Object {})
config.properties = Settings.parse_object_safe (
"monitor.bluetooth.properties", defaults.properties)
devices_om = ObjectManager {
Interest {

View file

@ -7,8 +7,12 @@
local cutils = require ("common-utils")
local defaults = {}
defaults.properties = Json.Object {}
local config = {}
config.properties = Settings.parse_object_safe ("monitor.libcamera.properties", Json.Object {})
config.properties = Settings.parse_object_safe (
"monitor.libcamera.properties", defaults.properties)
function findDuplicate(parent, id, property, value)
for i = 0, id - 1, 1 do

View file

@ -7,8 +7,12 @@
local cutils = require ("common-utils")
local defaults = {}
defaults.properties = Json.Object {}
local config = {}
config.properties = Settings.parse_object_safe ("monitor.v4l2.properties", Json.Object {})
config.properties = Settings.parse_object_safe (
"monitor.v4l2.properties", defaults.properties)
function findDuplicate(parent, id, property, value)
for i = 0, id - 1, 1 do

View file

@ -28,13 +28,23 @@
local cutils = require ("common-utils")
local defaults = {}
defaults.use_persistent_storage = true
defaults.use_headset_profile = true
defaults.app_settings = Json.Array {
"Firefox", "Chromium input", "Google Chrome input", "Brave input",
"Microsoft Edge input", "Vivaldi input", "ZOOM VoiceEngine",
"Telegram Desktop", "telegram-desktop", "linphone", "Mumble",
"WEBRTC VoiceEngine", "Skype"
}
local config = {}
config.use_persistent_storage = Settings.parse_boolean_safe
("policy.bluetooth.use-persistent-storage", true)
config.use_headset_profile = Settings.parse_boolean_safe
("policy.bluetooth.media-role.use-headset-profile", true)
config.apps_setting = Settings.parse_array_safe
("policy.bluetooth.media-role.applications", Json.Array {})
config.use_persistent_storage = Settings.parse_boolean_safe (
"policy.bluetooth.use-persistent-storage", defaults.use_persistent_storage)
config.use_headset_profile = Settings.parse_boolean_safe (
"policy.bluetooth.media-role.use-headset-profile", defaults.use_headset_profile)
config.apps_setting = Settings.parse_array_safe (
"policy.bluetooth.media-role.applications", defaults.app_settings)
state = nil
headset_profiles = nil

View file

@ -20,10 +20,18 @@
local cutils = require ("common-utils")
local defaults = {}
defaults.use_persistent_storage = true
defaults.default_volume = 0.4 ^ 3
defaults.default_input_volume = 1.0
local config = {}
config.use_persistent_storage = Settings.parse_boolean_safe ("device.use-persistent-storage", true)
config.default_volume = Settings.parse_float_safe ("device.default-volume", 0.4^3)
config.default_input_volume = Settings.parse_float_safe ("device.default-input-volume", 1.0)
config.use_persistent_storage = Settings.parse_boolean_safe (
"device.use-persistent-storage", defaults.use_persistent_storage)
config.default_volume = Settings.parse_float_safe (
"device.default-volume", defaults.default_volume)
config.default_input_volume = Settings.parse_float_safe (
"device.default-input-volume", defaults.default_input_volume)
-- table of device info
dev_infos = {}

View file

@ -5,9 +5,15 @@
--
-- SPDX-License-Identifier: MIT
local defaults = {}
defaults.duck_level = 0.3
defaults.roles = Json.Object {}
local config = {}
config.duck_level = Settings.parse_float_safe ("policy.default.duck-level", 0.3)
config.roles = Settings.parse_object_safe ("endpoints-roles", Json.Object {})
config.duck_level = Settings.parse_float_safe (
"policy.default.duck-level", defaults.duck_level)
config.roles = Settings.parse_object_safe (
"endpoints-roles", defaults.roles)
function findRole(role)
if role and not config.roles[role] then

View file

@ -7,7 +7,12 @@
-- Receive script arguments from config.lua
local roles = Settings.parse_object_safe ("endpoints-roles", Json.Object {})
local defaults = {}
defaults.roles = Json.Object {}
local config = {}
config.roles = Settings.parse_object_safe (
"endpoints-roles", defaults.roles)
local self = {}
self.scanning = false
@ -38,9 +43,9 @@ function scheduleRescan ()
end
function findRole(role, tmc)
if role and not roles[role] then
if role and not config.roles[role] then
-- find the role with matching alias
for r, p in pairs(roles) do
for r, p in pairs(config.roles) do
-- default media class can be overridden in the role config data
mc = p["media.class"] or "Audio/Sink"
if (type(p.alias) == "table" and tmc == mc) then
@ -55,7 +60,7 @@ function findRole(role, tmc)
-- otherwise get the lowest priority role
local lowest_priority_p = nil
local lowest_priority_r = nil
for r, p in pairs(roles) do
for r, p in pairs(config.roles) do
mc = p["media.class"] or "Audio/Sink"
if tmc == mc and (lowest_priority_p == nil or
p.priority < lowest_priority_p.priority) then

View file

@ -5,8 +5,12 @@
--
-- SPDX-License-Identifier: MIT
local defaults = {}
defaults.follow = true
local config = {}
config.follow = Settings.parse_boolean_safe ("policy.default.follow", true)
config.follow = Settings.parse_boolean_safe (
"policy.default.follow", defaults.follow)
local self = {}
self.scanning = false

View file

@ -12,8 +12,12 @@
local putils = require ("policy-utils")
local cutils = require ("common-utils")
local defaults = {}
defaults.move = true
local config = {}
config.move = Settings.parse_boolean_safe("policy.default.move", true)
config.move = Settings.parse_boolean_safe (
"policy.default.move", defaults.move)
function settingsChangedCallback (_, setting, _)
config.move = Settings.parse_boolean_safe ("policy.default.move", config.move)

View file

@ -20,11 +20,18 @@
local putils = require ("policy-utils")
local cutils = require ("common-utils")
local defaults = {}
defaults.move = true
defaults.follow = true
defaults.filter_forward_format = false
local config = {}
config.move = Settings.parse_boolean_safe ("policy.default.move", true)
config.follow = Settings.parse_boolean_safe ("policy.default.follow", true)
config.filter_forward_format = Settings.parse_boolean_safe
("policy.default.filter-forward-format", false)
config.move = Settings.parse_boolean_safe (
"policy.default.move", defaults.move)
config.follow = Settings.parse_boolean_safe (
"policy.default.follow", defaults.follow)
config.filter_forward_format = Settings.parse_boolean_safe (
"policy.default.filter-forward-format", defaults.filter_forward_format)
local function settingsChangedCallback (_, setting, _)

View file

@ -20,10 +20,18 @@
local cutils = require ("common-utils")
local defaults = {}
defaults.restore_props = true
defaults.restore_target = true
defaults.default_channel_volume = 1.0
local config = {}
config.restore_props = Settings.parse_boolean_safe ("stream.restore-props", true)
config.restore_target = Settings.parse_boolean_safe ("stream.restore-target", true)
config.default_channel_volume = Settings.parse_float_safe ("stream.default-channel-volume", 1.0)
config.restore_props = Settings.parse_boolean_safe (
"stream.restore-props", defaults.restore_props)
config.restore_target = Settings.parse_boolean_safe (
"stream.restore-target", defaults.restore_target)
config.default_channel_volume = Settings.parse_float_safe (
"stream.default-channel-volume", defaults.default_channel_volume)
-- the state storage
state = State ("restore-stream")

View file

@ -6,7 +6,13 @@
-- SPDX-License-Identifier: MIT
-- Receive script arguments from config.lua
local endpoints = Settings.parse_object_safe ("endpoints", Json.Object {})
local defaults = {}
defaults.endpoints = Json.Object {}
local config = {}
config.endpoints = Settings.parse_object_safe (
"endpoints", defaults.endpoints)
function createEndpoint (factory_name, properties)
-- create endpoint
@ -30,7 +36,7 @@ function createEndpoint (factory_name, properties)
end
for name, properties in pairs(endpoints) do
for name, properties in pairs(config.endpoints) do
properties["name"] = name
createEndpoint ("si-audio-endpoint", properties)
end