Browse Source

Source:getSound;

bjorn 4 years ago
parent
commit
651fc660f1
2 changed files with 44 additions and 0 deletions
  1. 24 0
      api/init.lua
  2. 20 0
      api/lovr/audio/Source/getSound.lua

+ 24 - 0
api/init.lua

@@ -1890,6 +1890,30 @@ return {
                 }
                 }
               }
               }
             },
             },
+            {
+              name = "getSound",
+              tag = "sourceUtility",
+              summary = "Get the `Sound` object backing the Source.",
+              description = "Returns the `Sound` object backing the Source.  Multiple Sources can share one Sound, allowing its data to only be loaded once.  An easy way to do this sharing is by using `Source:clone`.",
+              key = "Source:getSound",
+              module = "lovr.audio",
+              related = {
+                "Source:clone",
+                "lovr.audio.newSource"
+              },
+              variants = {
+                {
+                  arguments = {},
+                  returns = {
+                    {
+                      name = "sound",
+                      type = "Sound",
+                      description = "The Sound object."
+                    }
+                  }
+                }
+              }
+            },
             {
             {
               name = "getVolume",
               name = "getVolume",
               tag = "sourcePlayback",
               tag = "sourcePlayback",

+ 20 - 0
api/lovr/audio/Source/getSound.lua

@@ -0,0 +1,20 @@
+return {
+  tag = 'sourceUtility',
+  summary = 'Get the `Sound` object backing the Source.',
+  description = [[
+    Returns the `Sound` object backing the Source.  Multiple Sources can share one Sound, allowing
+    its data to only be loaded once.  An easy way to do this sharing is by using `Source:clone`.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'sound',
+      type = 'Sound',
+      description = 'The Sound object.'
+    }
+  },
+  related = {
+    'Source:clone',
+    'lovr.audio.newSource'
+  }
+}