40-stream-defaults.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. stream_defaults = {}
  2. stream_defaults.enabled = true
  3. stream_defaults.properties = {
  4. -- whether to restore the last stream properties or not
  5. ["restore-props"] = true,
  6. -- whether to restore the last stream target or not
  7. ["restore-target"] = true,
  8. -- the default channel volume for new streams whose props were never saved
  9. -- previously. This is only used if "restore-props" is set to true.
  10. ["default-channel-volume"] = 1.0,
  11. }
  12. stream_defaults.rules = {
  13. -- Rules to override settings per node
  14. -- {
  15. -- matches = {
  16. -- {
  17. -- { "application.name", "matches", "pw-play" },
  18. -- },
  19. -- },
  20. -- apply_properties = {
  21. -- ["state.restore-props"] = false,
  22. -- ["state.restore-target"] = false,
  23. -- ["state.default-channel-volume"] = 0.5,
  24. -- },
  25. -- },
  26. }
  27. function stream_defaults.enable()
  28. if stream_defaults.enabled == false then
  29. return
  30. end
  31. -- Save and restore stream-specific properties
  32. load_script("restore-stream.lua", {
  33. properties = stream_defaults.properties,
  34. rules = stream_defaults.rules,
  35. })
  36. end