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