getFrames.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. return {
  2. summary = 'Read frames from the Sound.',
  3. description = 'Reads frames from the Sound into a table, Blob, or another Sound.',
  4. arguments = {
  5. t = {
  6. type = 'table',
  7. description = 'An existing table to read frames into.'
  8. },
  9. blob = {
  10. type = 'Blob',
  11. description = 'A Blob to read frames into.'
  12. },
  13. sound = {
  14. type = 'Sound',
  15. description = 'Another Sound to copy frames into.'
  16. },
  17. count = {
  18. type = 'number',
  19. default = 'nil',
  20. description = [[
  21. The number of frames to read. If nil, reads as many frames as possible.
  22. Compressed sounds will automatically be decoded.
  23. Reading from a stream will ignore the source offset and read the oldest frames.
  24. ]]
  25. },
  26. srcOffset = {
  27. type = 'number',
  28. default = '0',
  29. description = 'A frame offset to apply to the sound when reading frames.'
  30. },
  31. dstOffset = {
  32. type = 'number',
  33. default = '0',
  34. description = [[
  35. An offset to apply to the destination when writing frames (indices for tables, bytes for
  36. Blobs, frames for Sounds).
  37. ]]
  38. }
  39. },
  40. returns = {
  41. t = {
  42. type = 'table',
  43. description = 'A table containing audio frames.'
  44. },
  45. count = {
  46. type = 'number',
  47. description = 'The number of frames read.'
  48. }
  49. },
  50. variants = {
  51. {
  52. arguments = { 'count', 'srcOffset' },
  53. returns = { 't', 'count' }
  54. },
  55. {
  56. arguments = { 't', 'count', 'srcOffset', 'dstOffset' },
  57. returns = { 't', 'count' }
  58. },
  59. {
  60. arguments = { 'blob', 'count', 'srcOffset', 'dstOffset' },
  61. returns = { 'count' }
  62. },
  63. {
  64. arguments = { 'sound', 'count', 'srcOffset', 'dstOffset' },
  65. returns = { 'count' }
  66. }
  67. }
  68. }