~technomancy/tremendous-quest-iv

tremendous-quest-iv/sound.fnl -rw-r--r-- 823 bytes
a3c24536Phil Hagelberg Bump to Fennel 0.9.1; fix some bugs. 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(local sounds
       {:arcana (doto (love.audio.newSource "assets/arcana.mp3" "stream")
                  (: :setLooping true))
        :encounter (doto (love.audio.newSource "assets/last-encounter.mp3" "stream")
                     (: :setLooping true))})

{:toggle (fn toggle [name]
           (if (love.filesystem.getInfo "mute")
               (do (love.filesystem.remove "mute")
                   (: (. sounds (or name :arcana)) :play))
               (do (love.filesystem.write "mute" "true")
                   (each [_ sound (pairs sounds)]
                     (: sound :pause)))))
 :play (fn play [name]
         (when (and (not (: (. sounds name) :isPlaying))
                    (not (love.filesystem.getInfo "mute")))
           (: (. sounds name) :play)))
 :stop (fn stop [name] (: (. sounds name) :stop))}