2
0

SoundManager.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. class "SoundManager"
  2. function SoundManager:SoundManager(...)
  3. local arg = {...}
  4. for k,v in pairs(arg) do
  5. if type(v) == "table" then
  6. if v.__ptr ~= nil then
  7. arg[k] = v.__ptr
  8. end
  9. end
  10. end
  11. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  12. self.__ptr = Polycode.SoundManager(unpack(arg))
  13. end
  14. end
  15. function SoundManager:setListenerPosition(position)
  16. local retVal = Polycode.SoundManager_setListenerPosition(self.__ptr, position.__ptr)
  17. end
  18. function SoundManager:setListenerOrientation(orientation)
  19. local retVal = Polycode.SoundManager_setListenerOrientation(self.__ptr, orientation.__ptr)
  20. end
  21. function SoundManager:recordSound(rate, sampleSize)
  22. local retVal = Polycode.SoundManager_recordSound(self.__ptr, rate, sampleSize)
  23. return retVal
  24. end
  25. function SoundManager:stopRecording(generateFloatBuffer)
  26. local retVal = Polycode.SoundManager_stopRecording(self.__ptr, generateFloatBuffer)
  27. if retVal == nil then return nil end
  28. local __c = _G["Sound"]("__skip_ptr__")
  29. __c.__ptr = retVal
  30. return __c
  31. end
  32. function SoundManager:setAudioInterface(audioInterface)
  33. local retVal = Polycode.SoundManager_setAudioInterface(self.__ptr, audioInterface.__ptr)
  34. end
  35. function SoundManager:Update()
  36. local retVal = Polycode.SoundManager_Update(self.__ptr)
  37. end
  38. function SoundManager:setGlobalVolume(globalVolume)
  39. local retVal = Polycode.SoundManager_setGlobalVolume(self.__ptr, globalVolume)
  40. end
  41. function SoundManager:registerSound(sound)
  42. local retVal = Polycode.SoundManager_registerSound(self.__ptr, sound.__ptr)
  43. end
  44. function SoundManager:unregisterSound(sound)
  45. local retVal = Polycode.SoundManager_unregisterSound(self.__ptr, sound.__ptr)
  46. end
  47. function SoundManager:__delete()
  48. if self then Polycode.delete_SoundManager(self.__ptr) end
  49. end