2
0
Эх сурвалжийг харах

Document *Data has-a blob

Documents the changes in:
* https://github.com/bjornbytes/lovr/pull/193
* and https://github.com/bjornbytes/lovr/commit/a5424a19321ed25da1c1f6bad753bc96fc01239d
Nevyn Bengtsson 5 жил өмнө
parent
commit
3b147053d7

+ 42 - 4
api/lovr/audio/Microphone/getData.lua

@@ -3,12 +3,50 @@ return {
   description = [[
     Returns a new SoundData with all of the buffered audio samples that the Microphone has recorded.
   ]],
-  arguments = {},
-  returns = {
+  arguments = {
+    {
+      name = 'soundData',
+      type = 'soundData',
+      description = 'The `SoundData` to fill with audio (instead of this method creating a new one).'
+    },
+    {
+      name = 'sampleCount',
+      type = 'number',
+      description = 'How many samples of audio to get right now, at most. If less is available, you will get less.'
+    },
     {
-      name = 'channels',
+      name = 'offset',
       type = 'number',
-      description = 'The number of channels recorded.'
+      description = 'Index in samples into `soundData` at which to start to overwrite with new audio data from the microphone\'s internal buffer.'
+    }
+  },
+  returns = {
+    {
+      name = 'soundData',
+      type = 'soundData',
+      description = 'A `SoundData` with `sampleCount` of samples in it (or less if less was available; or all if sampleCount was not given). Nothing is returned if no data is available.'
+    }
+  },
+  variants = {
+    {
+        description = "Get all available audio as a newly created `SoundData`",
+        arguments = { },
+        returns = { 'soundData' }
+    },
+    {
+      description = "Get at most `sampleCount` samples from the microphone\'s internal queue as a newly created `SoundData`",
+      arguments = { 'sampleCount' },
+      returns = { 'soundData' }
+    },
+    {
+      description = "Get at all available audio and write it into `soundData`.",
+      arguments = { 'soundData' },
+      returns = { 'soundData' }
+    },
+    {
+      description = "Get at all available audio and write it into `soundData` starting at 'offset' samples into `soundData`.",
+      arguments = { 'soundData', 'offset' },
+      returns = { 'soundData' }
     }
   },
   notes = [[

+ 13 - 0
api/lovr/data/SoundData/getBlob.lua

@@ -0,0 +1,13 @@
+return {
+    summary = 'Get the bytes backing this SoundData as a `Blob`.',
+    description = 'This replaces `SoundData:getPointer()`, since you can get that through the blob.',
+    arguments = {},
+    returns = {
+      {
+        name = 'blob',
+        type = 'blob',
+        description = 'The blob instance containing the bytes for the `SoundData`.'
+      }
+    }
+  }
+  

+ 13 - 0
api/lovr/data/TextureData/getBlob.lua

@@ -0,0 +1,13 @@
+return {
+    summary = 'Get the bytes backing this `TextureData` as a `Blob`.',
+    description = 'This replaces `TextureData:getPointer()`, since you can get that through the blob.',
+    arguments = {},
+    returns = {
+      {
+        name = 'blob',
+        type = 'blob',
+        description = 'The blob instance containing the bytes for the `TextureData`.'
+      }
+    }
+  }
+