Browse Source

Fix Microphone:getData;

bjorn 5 years ago
parent
commit
ce0efb4976
2 changed files with 58 additions and 15 deletions
  1. 54 7
      api/init.lua
  2. 4 8
      api/lovr/audio/Microphone/getData.lua

+ 54 - 7
api/init.lua

@@ -1400,22 +1400,69 @@ return {
                 {
                 {
                   description = "Get all available audio as a newly created `SoundData`.",
                   description = "Get all available audio as a newly created `SoundData`.",
                   arguments = {},
                   arguments = {},
-                  returns = {}
+                  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."
+                    }
+                  }
                 },
                 },
                 {
                 {
                   description = "Get at most `sampleCount` samples from the microphone's internal queue as a newly created `SoundData`.",
                   description = "Get at most `sampleCount` samples from the microphone's internal queue as a newly created `SoundData`.",
-                  arguments = {},
-                  returns = {}
+                  arguments = {
+                    {
+                      name = "sampleCount",
+                      type = "number",
+                      description = "How many samples of audio to get right now, at most. If less is available, you will get less (use `Microphone:getSampleCount` to check the exact number)."
+                    }
+                  },
+                  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."
+                    }
+                  }
                 },
                 },
                 {
                 {
                   description = "Get at all available audio and write it into `soundData`.",
                   description = "Get at all available audio and write it into `soundData`.",
-                  arguments = {},
-                  returns = {}
+                  arguments = {
+                    {
+                      name = "soundData",
+                      type = "soundData",
+                      description = "The `SoundData` to fill with audio (instead of creating a new one)."
+                    }
+                  },
+                  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."
+                    }
+                  }
                 },
                 },
                 {
                 {
                   description = "Get at all available audio and write it into `soundData` starting at `offset` samples into `soundData`.",
                   description = "Get at all available audio and write it into `soundData` starting at `offset` samples into `soundData`.",
-                  arguments = {},
-                  returns = {}
+                  arguments = {
+                    {
+                      name = "soundData",
+                      type = "soundData",
+                      description = "The `SoundData` to fill with audio (instead of creating a new one)."
+                    },
+                    {
+                      name = "offset",
+                      type = "number",
+                      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."
+                    }
+                  }
                 }
                 }
               },
               },
               notes = "There's a limit on the number of samples the Microphone is able to hold, which can be set at creation time in `lovr.audio.newMicrophone`.  While the Microphone is recording, be sure to call this function periodically to get a new chunk of audio in order to make room for more.\n\nYou can use `Microphone:getSampleCount` to figure out how many samples the Microphone is currently holding."
               notes = "There's a limit on the number of samples the Microphone is able to hold, which can be set at creation time in `lovr.audio.newMicrophone`.  While the Microphone is recording, be sure to call this function periodically to get a new chunk of audio in order to make room for more.\n\nYou can use `Microphone:getSampleCount` to figure out how many samples the Microphone is currently holding."

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

@@ -4,21 +4,18 @@ return {
     Returns a new SoundData with all of the buffered audio samples that the Microphone has recorded.
     Returns a new SoundData with all of the buffered audio samples that the Microphone has recorded.
   ]],
   ]],
   arguments = {
   arguments = {
-    {
-      name = 'soundData',
+    soundData = {
       type = 'soundData',
       type = 'soundData',
       description = 'The `SoundData` to fill with audio (instead of creating a new one).'
       description = 'The `SoundData` to fill with audio (instead of creating a new one).'
     },
     },
-    {
-      name = 'sampleCount',
+    sampleCount = {
       type = 'number',
       type = 'number',
       description = [[
       description = [[
         How many samples of audio to get right now, at most. If less is available, you will get
         How many samples of audio to get right now, at most. If less is available, you will get
         less (use `Microphone:getSampleCount` to check the exact number).
         less (use `Microphone:getSampleCount` to check the exact number).
       ]]
       ]]
     },
     },
-    {
-      name = 'offset',
+    offset = {
       type = 'number',
       type = 'number',
       description = [[
       description = [[
         Index in samples into `soundData` at which to start to overwrite with new audio data from
         Index in samples into `soundData` at which to start to overwrite with new audio data from
@@ -27,8 +24,7 @@ return {
     }
     }
   },
   },
   returns = {
   returns = {
-    {
-      name = 'soundData',
+    soundData = {
       type = 'soundData',
       type = 'soundData',
       description = [[
       description = [[
         A `SoundData` with `sampleCount` of samples in it (or less if less was available; or all if
         A `SoundData` with `sampleCount` of samples in it (or less if less was available; or all if