Explorar o código

lovr.audio.getDevice;

bjorn %!s(int64=2) %!d(string=hai) anos
pai
achega
fece8014df
Modificáronse 3 ficheiros con 39 adicións e 0 borrados
  1. 37 0
      api/lovr/audio/getDevice.lua
  2. 1 0
      api/lovr/audio/getDevices.lua
  3. 1 0
      api/lovr/audio/setDevice.lua

+ 37 - 0
api/lovr/audio/getDevice.lua

@@ -0,0 +1,37 @@
+return {
+  tag = 'devices',
+  summary = 'Switch audio devices.',
+  description = 'Returns information about the active playback or capture device.',
+  arguments = {
+    type = {
+      type = 'AudioType',
+      default = [['playback']],
+      description = 'The type of device to query.'
+    }
+  },
+  returns = {
+    name = {
+      type = 'string',
+      description = 'The name of the device.'
+    },
+    id = {
+      type = 'userdata',
+      description = 'The opaque id of the device.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'type' },
+      returns = { 'name', 'id' }
+    }
+  },
+  notes = [[
+    If no device has been set yet, this function returns `nil`.
+
+    The device doesn't need to be started.
+  ]],
+  related = {
+    'lovr.audio.getDevices',
+    'lovr.audio.setDevices'
+  }
+}

+ 1 - 0
api/lovr/audio/getDevices.lua

@@ -45,6 +45,7 @@ return {
   },
   related = {
     'lovr.audio.setDevice',
+    'lovr.audio.getDevice',
     'lovr.audio.start',
     'lovr.audio.stop'
   }

+ 1 - 0
api/lovr/audio/setDevice.lua

@@ -58,6 +58,7 @@ return {
     }
   },
   related = {
+    'lovr.audio.getDevice',
     'lovr.audio.getDevices',
     'lovr.audio.start',
     'lovr.audio.stop'