Skip to content

Commit

Permalink
Fixed spectograph triggering again.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-McGee committed Nov 6, 2021
1 parent 41be06e commit 170252e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function playnew(pointer) {
// Update the document title with the song and artist
document.getElementById("length").textContent = sec2mins(Math.round(trk01.duration()));
// Start the spectograph animation
specto();
specto('on');
// Start upating the progress slider and playtime of the track.
requestAnimationFrame(progress);
},
Expand Down Expand Up @@ -81,10 +81,10 @@ function playnew(pointer) {
document.title = "foam"; // update doc title back to default
parent.pointer = 0; // reset our position in the queue back to the start
trk01.unload(); // Unload the track from howler to free up mem
specto(); // Stop the spectograph animation
specto('off'); // Stop the spectograph animation
} else {
trk01.unload(); // Unload the track from howler to free up mem
specto(); // Stop the spectograph animation
specto('off'); // Stop the spectograph animation
// We're not finished the queue yet so lets keep going
playnew(pointer); // Call the playnew function again with our updated pointer
}
Expand All @@ -99,7 +99,7 @@ function playToggle() {
parent.pause = true;
trk01.pause(); // Pause the sound & show play button
document.getElementById("playBtn").className = "bordered play icon";
specto(); // Stop the spectograph animation
specto('off'); // Stop the spectograph animation
} else {
if (parent.pause === true) {
parent.pause = false;
Expand Down Expand Up @@ -140,8 +140,8 @@ function changeVol(newVol) {
}

// Start or stop the spectograph
function specto() {
if (document.getElementById("specto1").className == "spectrograph__off") {
function specto(state) {
if (state == 'on') {
document.getElementById("specto1").className = "spectrograph__bar";
document.getElementById("specto2").className = "spectrograph__bar";
document.getElementById("specto3").className = "spectrograph__bar";
Expand Down

0 comments on commit 170252e

Please sign in to comment.