summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Shangreaux <shshoshin@protonmail.com>2020-01-06 15:04:07 -0600
committerGrant Shangreaux <shshoshin@protonmail.com>2020-01-06 15:06:29 -0600
commitf62df330db236027e6f7d4aa04f33b9fdd3fda37 (patch)
treefaee7459b8ed657f6448ba5ca5d4d4cd4699af26
parent13175b907de620e372caae126f29bcabfbd329ce (diff)
Fix: remove button press sound logic for now
-rw-r--r--tape-deck.js19
1 files 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;
}