소스 검색

Keep position in bounds when getting spectrum

Thomas Dy 11 년 전
부모
커밋
9b5c47bedf
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      scripts/game.js

+ 2 - 2
scripts/game.js

@@ -386,8 +386,8 @@ var SoundSafari = function(canvas, beatInfo, pSoundManager) {
     if(isNaN(this.shimmerFactor) || this.shimmerFactor < 0) {
       this.shimmerFactor = 0;
     }
-
-    this.spectrum = this.beat.sound.getSpectrum(t%this.beat.info.duration);
+    var pos = t%this.beat.info.duration;
+    if(pos < this.beat.sound.duration) this.spectrum = this.beat.sound.getSpectrum(pos);
   };
 
   var player = {