1local context = G.botContext
2
3context.getSoundChannel = function()
4 if not g_sounds then
5 return
6 end
7 return g_sounds.getChannel(SoundChannels.Bot)
8end
9
10context.playSound = function(file)
11 local botSoundChannel = context.getSoundChannel()
12 if not botSoundChannel then
13 return
14 end
15 botSoundChannel:setEnabled(true)
16 botSoundChannel:stop(0)
17 botSoundChannel:play(file, 0, 1.0)
18 return botSoundChannel
19end
20
21context.stopSound = function()
22 local botSoundChannel = context.getSoundChannel()
23 if not botSoundChannel then
24 return
25 end
26 botSoundChannel:stop()
27end
28
29context.playAlarm = function()
30 return context.playSound("/sounds/alarm.ogg")
31end
32