Skip to content

Commit

Permalink
Minor cleaning and fix #29
Browse files Browse the repository at this point in the history
  • Loading branch information
mon committed Jul 3, 2017
1 parent 7a116b9 commit 52e8d31
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/js/HuesCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class HuesCanvas {
}

doBlackout(whiteout) {
if (typeof(whiteout)==='undefined') whiteout = false;
if(typeof(whiteout) === 'undefined') whiteout = false;
if(whiteout) {
this.blackoutColour = "#FFF";
} else {
Expand All @@ -489,7 +489,6 @@ class HuesCanvas {
}
}

// for song changes
clearBlackout() {
this.blackout = false;
this.blackoutTimeout = 0;
Expand All @@ -500,10 +499,15 @@ class HuesCanvas {
}

doShortBlackout(beatTime) {
this.doBlackout();
this.blackoutTimeout = this.audio.currentTime + beatTime / 1.7;
// looks better if we go right to black
this.blackoutStart = 0;
this.doInstantBlackout();
this.blackoutTimeout = this.audio.currentTime + beatTime / 1.7;
}

doInstantBlackout() {
this.doBlackout();
// sufficiently negative
this.blackoutStart = -Math.pow(2, 32);
}

doColourFade(length) {
Expand Down
8 changes: 4 additions & 4 deletions src/js/HuesCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ class HuesCore {
*/
frame : [],

/* callback songstarted()
/* callback songstarted(song)
*
* Called when the song actually begins to play, not just when the
* new song processing begins
* new song processing begins. Song object passed.
*/
songstarted : [],

Expand Down Expand Up @@ -524,12 +524,12 @@ class HuesCore {
}
}
this.setInvert(false);
this.renderer.doBlackout();
this.renderer.doInstantBlackout();
return this.soundManager.playSong(this.currentSong, this.doBuildup)
.then(() => {
this.resetAudio();
this.fillBuildup();
this.callEventListeners("songstarted");
this.callEventListeners("songstarted", this.currentSong);
});
}

Expand Down

0 comments on commit 52e8d31

Please sign in to comment.