main.lua 355 B

1234567891011121314
  1. -- Play a continuous sine wav
  2. function lovr.load()
  3. source = lovr.audio.newSource('sine.wav')
  4. source:setLooping(true)
  5. source:play()
  6. end
  7. -- Oscillate volume
  8. function lovr.update()
  9. local time = lovr.timer.getTime()
  10. local average, spread, speed = .5, .25, 4
  11. local volume = average + math.sin(time * speed) * spread
  12. source:setVolume(volume)
  13. end