From f62df330db236027e6f7d4aa04f33b9fdd3fda37 Mon Sep 17 00:00:00 2001 From: Grant Shangreaux Date: Mon, 6 Jan 2020 15:04:07 -0600 Subject: Fix: remove button press sound logic for now --- tape-deck.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tape-deck.js b/tape-deck.js index 631de23..f730600 100644 --- a/tape-deck.js +++ b/tape-deck.js @@ -5,13 +5,6 @@ const tape = new Audio(`audio/2019-mix-side-${currentSide}.mp3`); const pressPlaySound = new Audio("audio/tape-start.mp3"); const buttonPressSound = new Audio("audio/button-press.mp3"); pressPlaySound.onended = (event) => { tape.play(); }; -buttonPressSound.onended = (event) => { - if (isPlaying()) { - playing = false; - } else { - tape.play(); - } -}; const stopImage = "images/cool-deck.png"; const playImage = "images/cool-deck.gif"; @@ -25,11 +18,7 @@ let notes = document.getElementById("notes"); let trackData = []; let currentTrackIndex = 0; let hasStarted = false; -let playing = false; - -function isPlaying() { - return playing; -} +let isPlaying = false; function loadTrackData() { fetch(`side${currentSide}.json`) @@ -40,11 +29,12 @@ function loadTrackData() { } function play() { - if (isPlaying()) { + if (isPlaying) { playButton.src = playButtonUp; buttonPressSound.play(); tape.pause(); deck.src = stopImage; + isPlaying = false; return; } @@ -53,9 +43,10 @@ function play() { hasStarted = true; } else { buttonPressSound.play(); + tape.play(); } - playing = true; + isPlaying = true; playButton.src = playButtonDown; deck.src = playImage; } -- cgit v1.2.3