getDevices.lua 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. {
  11. name = 'type',
  12. type = 'AudioType',
  13. default = [['playback']],
  14. description = 'The type of devices to query (playback or capture).'
  15. }
  16. },
  17. returns = {
  18. {
  19. name = 'devices',
  20. type = 'table',
  21. description = 'The list of devices.',
  22. table = {
  23. {
  24. name = '[].id',
  25. type = 'userdata',
  26. description = 'A unique, opaque id for the device.'
  27. },
  28. {
  29. name = '[].name',
  30. type = 'string',
  31. description = 'A human readable name for the device.'
  32. },
  33. {
  34. name = '[].default',
  35. type = 'boolean',
  36. description = 'Whether the device is the default audio device.'
  37. }
  38. }
  39. }
  40. },
  41. related = {
  42. 'lovr.audio.setDevice',
  43. 'lovr.audio.start',
  44. 'lovr.audio.stop'
  45. }
  46. }