getDevices.lua 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. return {
  2. tag = 'devices',
  3. summary = 'Get a list of audio devices.',
  4. description = [[
  5. Returns a list of playback or capture devices. Each device has an `id`, `name`, and a `default`
  6. flag indicating whether it's the default device.
  7. To use a specific device id for playback or capture, pass it to `lovr.audio.setDevice`.
  8. ]],
  9. arguments = {
  10. type = {
  11. type = 'AudioType',
  12. default = [['playback']],
  13. description = 'The type of devices to query (playback or capture).'
  14. }
  15. },
  16. returns = {
  17. devices = {
  18. type = 'table',
  19. description = 'The list of devices.',
  20. table = {
  21. {
  22. name = '[].id',
  23. type = 'userdata',
  24. description = 'A unique, opaque id for the device.'
  25. },
  26. {
  27. name = '[].name',
  28. type = 'string',
  29. description = 'A human readable name for the device.'
  30. },
  31. {
  32. name = '[].default',
  33. type = 'boolean',
  34. description = 'Whether the device is the default audio device.'
  35. }
  36. }
  37. }
  38. },
  39. variants = {
  40. {
  41. arguments = { 'type' },
  42. returns = { 'devices' }
  43. }
  44. },
  45. related = {
  46. 'lovr.audio.setDevice',
  47. 'lovr.audio.getDevice',
  48. 'lovr.audio.start',
  49. 'lovr.audio.stop'
  50. }
  51. }