diff --git a/src/js/HuesCore.js b/src/js/HuesCore.js index a061814..04ff7a7 100644 --- a/src/js/HuesCore.js +++ b/src/js/HuesCore.js @@ -415,8 +415,10 @@ HuesCore.prototype.fillBuildup = function() { // update loop length for flash style filling this.updateBeatLength(); if(this.currentSong.buildup) { - // TODO CHECK IF OLD OR NEW BEHAVIOUR - if(true) { + if(this.currentSong.independentBuild) { + console.log("New behaviour - separate build/loop lengths"); + // Do nothing + } else { console.log("Flash behaviour - filling buildup"); var buildBeats = Math.floor(this.soundManager.buildLength / this.loopLength); if(buildBeats < 1) { @@ -425,8 +427,6 @@ HuesCore.prototype.fillBuildup = function() { while (this.currentSong.buildupRhythm.length < buildBeats) { this.currentSong.buildupRhythm = this.currentSong.buildupRhythm + "."; } - } else { - console.log("New behaviour - separate build/loop lengths"); } console.log("Buildup length:", buildBeats); } diff --git a/src/js/ResourcePack.js b/src/js/ResourcePack.js index 3602a85..e506a94 100644 --- a/src/js/ResourcePack.js +++ b/src/js/ResourcePack.js @@ -436,6 +436,7 @@ Respack.prototype.parseSongFile = function(text) { } song.buildupRhythm = el.getTag("buildupRhythm"); + song.independentBuild = el.getTag("independentBuild"); song.source = el.getTag("source"); song.charsPerBeat = parseFloat(el.getTag("charsPerBeat")); diff --git a/src/js/SoundManager.js b/src/js/SoundManager.js index 19a051a..3979218 100644 --- a/src/js/SoundManager.js +++ b/src/js/SoundManager.js @@ -169,9 +169,9 @@ SoundManager.prototype.playSong = function(song, playBuild, forcePlay) { return this.context.suspend() }).then(() => { if(playBuild) { - this.seek(-this.buildLength); + this.seek(-this.buildLength, true); } else { - this.seek(0); + this.seek(0, true); } return this.context.resume(); @@ -213,7 +213,7 @@ SoundManager.prototype.setRate = function(rate) { this.seek(time); } -SoundManager.prototype.seek = function(time) { +SoundManager.prototype.seek = function(time, noPlayingUpdate) { if(!this.song) { return; } @@ -243,6 +243,9 @@ SoundManager.prototype.seek = function(time) { } this.startTime = this.context.currentTime - (time / this.playbackRate); + if(!noPlayingUpdate) { + this.playing = true; + } this.core.recalcBeatIndex(); }