00-functions.lua 963 B

12345678910111213141516171819202122232425262728293031323334353637
  1. components = {}
  2. function load_module(m, a)
  3. assert(type(m) == "string", "module name is mandatory, bail out");
  4. if not components[m] then
  5. components[m] = { "libwireplumber-module-" .. m, type = "module", args = a }
  6. end
  7. end
  8. function load_optional_module(m, a)
  9. assert(type(m) == "string", "module name is mandatory, bail out");
  10. if not components[m] then
  11. components[m] = { "libwireplumber-module-" .. m, type = "module", args = a, optional = true }
  12. end
  13. end
  14. function load_pw_module(m)
  15. assert(type(m) == "string", "module name is mandatory, bail out");
  16. if not components[m] then
  17. components[m] = { "libpipewire-module-" .. m, type = "pw_module" }
  18. end
  19. end
  20. function load_script(s, a)
  21. if not components[s] then
  22. components[s] = { s, type = "script/lua", args = a }
  23. end
  24. end
  25. function load_monitor(s, a)
  26. load_script("monitors/" .. s .. ".lua", a)
  27. end
  28. function load_access(s, a)
  29. load_script("access/access-" .. s .. ".lua", a)
  30. end