diff options
author | Grant Shangreaux <shshoshin@protonmail.com> | 2020-01-06 14:24:49 -0600 |
---|---|---|
committer | Grant Shangreaux <shshoshin@protonmail.com> | 2020-01-06 14:24:49 -0600 |
commit | f54dc303b751722b7c9616141de102a6cb6c4d1d (patch) | |
tree | be4309094ecc943c7ce9d2d27b57d9e2e68a39c8 | |
parent | 3c68b4ea1a9372ff6f64abde0d5031de01dfd305 (diff) |
Fix: timing of button press sound on play
-rw-r--r-- | tape-deck.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tape-deck.js b/tape-deck.js index e0ee376..7485c92 100644 --- a/tape-deck.js +++ b/tape-deck.js @@ -3,7 +3,9 @@ const currentSide = urlParams.get("side"); 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) => { tape.play(); }; const stopImage = "images/cool-deck.png"; const playImage = "images/cool-deck.gif"; @@ -11,7 +13,6 @@ const playImage = "images/cool-deck.gif"; let playButton = document.getElementById("play-button"); const playButtonUp = "images/play-button-up.png"; const playButtonDown = "images/play-button-down.png"; -const buttonPressSound = new Audio("audio/button-press.mp3"); let deck = document.getElementById("tape-deck"); let notes = document.getElementById("notes"); @@ -43,7 +44,6 @@ function play() { hasStarted = true; } else { buttonPressSound.play(); - tape.play(); } isPlaying = true; |