Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local options = require "optionsData"
- local music = {}
- local musicChannel = 1
- local volume = options.Music.Volume
- function music:Play(file)
- local file = audio.loadStream("snd/" .. file .. ".mp3")
- audio.setVolume(volume, {channel = musicChannel})
- local play = audio.play(file, {channel = musicChannel, fadein = 500, loops = -1})
- end
- function music:Options(event)
- if event.Music then
- if event.Music.Volume then
- volume = event.Music.Volume
- audio.pause(musicChannel)
- audio.setVolume(volume, {channel = musicChannel})
- audio.resume(musicChannel)
- end
- end
- end
- Runtime:addEventListener("Options", music)
- return music
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement