AudioMixer.lua 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. class "AudioMixer"
  2. function AudioMixer:__getvar(name)
  3. if name == "globalVolume" then
  4. return Polycore.AudioMixer_get_globalVolume(self.__ptr)
  5. elseif name == "mixerMutex" then
  6. local retVal = Polycore.AudioMixer_get_mixerMutex(self.__ptr)
  7. if retVal == nil then return nil end
  8. local __c = _G["CoreMutex"]("__skip_ptr__")
  9. __c.__ptr = retVal
  10. return __c
  11. end
  12. end
  13. function AudioMixer:__setvar(name,value)
  14. if name == "globalVolume" then
  15. Polycore.AudioMixer_set_globalVolume(self.__ptr, value)
  16. return true
  17. end
  18. return false
  19. end
  20. function AudioMixer:AudioMixer(...)
  21. local arg = {...}
  22. for k,v in pairs(arg) do
  23. if type(v) == "table" then
  24. if v.__ptr ~= nil then
  25. arg[k] = v.__ptr
  26. end
  27. end
  28. end
  29. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  30. self.__ptr = Polycore.AudioMixer(unpack(arg))
  31. end
  32. end
  33. function AudioMixer:mixIntoBuffer(buffer, numSamples)
  34. local retVal = Polycore.AudioMixer_mixIntoBuffer(self.__ptr, buffer.__ptr, numSamples)
  35. end
  36. function AudioMixer:__delete()
  37. if self then Polycore.delete_AudioMixer(self.__ptr) end
  38. end