SDLAudioInterface.lua 861 B

1234567891011121314151617181920212223242526272829303132
  1. require "Polycode/Polycode::AudioInterface"
  2. class "SDLAudioInterface" (Polycode::AudioInterface)
  3. function SDLAudioInterface:SDLAudioInterface(...)
  4. local arg = {...}
  5. if type(arg[1]) == "table" and count(arg) == 1 then
  6. if ""..arg[1].__classname == "Polycode::AudioInterface" then
  7. self.__ptr = arg[1].__ptr
  8. return
  9. end
  10. end
  11. for k,v in pairs(arg) do
  12. if type(v) == "table" then
  13. if v.__ptr ~= nil then
  14. arg[k] = v.__ptr
  15. end
  16. end
  17. end
  18. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  19. self.__ptr = Polycode.SDLAudioInterface(unpack(arg))
  20. end
  21. end
  22. function SDLAudioInterface:sdlCallback(userData, _stream, _length)
  23. local retVal = Polycode.SDLAudioInterface_sdlCallback(self.__ptr, userData.__ptr, _stream.__ptr, _length)
  24. end
  25. function SDLAudioInterface:__delete()
  26. if self then Polycode.delete_SDLAudioInterface(self.__ptr) end
  27. end