main.lua 456 B

123456789101112131415161718
  1. function lovr.load()
  2. source = lovr.audio.newSource('sine.wav', { spatial = true })
  3. source:setEffectEnabled('spatialization', true)
  4. source:setEffectEnabled('falloff', true)
  5. source:setLooping(true)
  6. source:play()
  7. end
  8. function lovr.update()
  9. lovr.audio.setPose(lovr.headset.getPose())
  10. local x = math.sin(lovr.timer.getTime() * 2)
  11. source:setPose(x, 1, -1)
  12. end
  13. function lovr.draw()
  14. lovr.graphics.sphere(mat4(source:getPose()):scale(.05))
  15. end