diff options
author | Joris | 2021-05-13 14:50:51 +0200 |
---|---|---|
committer | Joris | 2021-05-13 14:58:26 +0200 |
commit | 221b6451fb4f8559a10e7fefebd13ce125ef29d0 (patch) | |
tree | 3ab337b7b2d40e8235f887046a580b0850540f11 /src/audio.ml | |
parent | 5c636f11cdfed82634ee572645d765b704941b68 (diff) |
Rewrite in TypeScript
BuckleScript is no longer maintained. Choose a widely used techno that
will still be maintained in the following years.
Diffstat (limited to 'src/audio.ml')
-rw-r--r-- | src/audio.ml | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/audio.ml b/src/audio.ml deleted file mode 100644 index 1446440..0000000 --- a/src/audio.ml +++ /dev/null @@ -1,34 +0,0 @@ -type audio - -external create : string -> audio = "Audio" [@@bs.new] - -external play : audio -> unit = "play" [@@bs.send] - -external currentTime : audio -> int = "currentTime" [@@bs.get] - -external setCurrentTime : audio -> int -> unit = "currentTime" [@@bs.set] - -let playOrReplay audio = - let () = if currentTime audio > 0 then setCurrentTime audio 0 else () in - play audio - -(* Sounds *) - -let c3 = create "sounds/c3.mp3" - -let c4 = create "sounds/c4.mp3" - -let c5 = create "sounds/c5.mp3" - -(* Play from step *) - -let playFromStep (config: Config.config) (step : Step.state) = - match step.step with - | Step.Prepare when step.remaining == config.prepare -> - playOrReplay c3 - | Step.Work when step.remaining == config.work -> - playOrReplay c5 - | Step.Rest when step.remaining == config.rest -> - playOrReplay c3 - | Step.End -> playOrReplay c3 - | _ -> if step.remaining <= 3 then playOrReplay c4 else () |