Minor cleaning and fix #29

master
William Toohey 8 years ago
parent 7a116b9101
commit 52e8d31869
  1. 14
      src/js/HuesCanvas.js
  2. 8
      src/js/HuesCore.js

@ -471,7 +471,7 @@ class HuesCanvas {
} }
doBlackout(whiteout) { doBlackout(whiteout) {
if (typeof(whiteout)==='undefined') whiteout = false; if(typeof(whiteout) === 'undefined') whiteout = false;
if(whiteout) { if(whiteout) {
this.blackoutColour = "#FFF"; this.blackoutColour = "#FFF";
} else { } else {
@ -489,7 +489,6 @@ class HuesCanvas {
} }
} }
// for song changes
clearBlackout() { clearBlackout() {
this.blackout = false; this.blackout = false;
this.blackoutTimeout = 0; this.blackoutTimeout = 0;
@ -500,10 +499,15 @@ class HuesCanvas {
} }
doShortBlackout(beatTime) { doShortBlackout(beatTime) {
this.doBlackout();
this.blackoutTimeout = this.audio.currentTime + beatTime / 1.7;
// looks better if we go right to black // 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) { doColourFade(length) {

@ -97,10 +97,10 @@ class HuesCore {
*/ */
frame : [], frame : [],
/* callback songstarted() /* callback songstarted(song)
* *
* Called when the song actually begins to play, not just when the * Called when the song actually begins to play, not just when the
* new song processing begins * new song processing begins. Song object passed.
*/ */
songstarted : [], songstarted : [],
@ -524,12 +524,12 @@ class HuesCore {
} }
} }
this.setInvert(false); this.setInvert(false);
this.renderer.doBlackout(); this.renderer.doInstantBlackout();
return this.soundManager.playSong(this.currentSong, this.doBuildup) return this.soundManager.playSong(this.currentSong, this.doBuildup)
.then(() => { .then(() => {
this.resetAudio(); this.resetAudio();
this.fillBuildup(); this.fillBuildup();
this.callEventListeners("songstarted"); this.callEventListeners("songstarted", this.currentSong);
}); });
} }

Loading…
Cancel
Save