aboutsummaryrefslogtreecommitdiff
path: root/src/audio.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.ts')
-rw-r--r--src/audio.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/audio.ts b/src/audio.ts
index 4147164..350093a 100644
--- a/src/audio.ts
+++ b/src/audio.ts
@@ -1,21 +1,21 @@
import * as Config from 'config'
-import * as State from 'state'
+import * as Step from 'step'
const start = new Audio('sound/start.mp3')
const stop = new Audio('sound/stop.mp3')
const endTabata = new Audio('sound/end-tabata.mp3')
const endTraining = new Audio('sound/end-training.mp3')
-export function playFromStep(config: Config.Config, state: State.State) {
- if (state.step === State.Step.WarmUp && state.remaining === config.warmup) {
+export function playFromStep(config: Config.Config, step: Step.Step, elapsed: number) {
+ if (step.name === 'warmup' && step.remaining === config.warmup) {
start.play()
- } else if (state.step === State.Step.Work && state.remaining === config.work) {
+ } else if (step.name === 'work' && step.remaining === config.work) {
start.play()
- } else if (state.step === State.Step.Rest && state.remaining === config.rest) {
+ } else if (step.name === 'rest' && step.remaining === config.rest) {
stop.play()
- } else if (state.step === State.Step.Prepare && state.remaining === config.prepare && state.elapsed > 0) {
+ } else if (step.name === 'prepare' && step.remaining === config.prepare && elapsed > 0) {
endTabata.play()
- } else if (state.step === State.Step.End && state.elapsed === Config.getDuration(config)) {
+ } else if (step.name === 'end' && elapsed === Config.getDuration(config)) {
endTraining.play()
}
}