Mercurial > hg > Members > e105711
view webGL/src/Note.js @ 16:b322a8557f93 draft
draw text
author | e105711 <yomitan.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 03 Jul 2012 23:20:21 +0900 |
parents | 80789d11de5c |
children | 3f8305d62106 |
line wrap: on
line source
var Note = function(time,lane,BPM){ this.time = time;// + (60/BPM*4); //60/BPM*4 = Time of a bar this.lane = lane; this.BPM = BPM; // this.locate = - (this.time*BPM/(Interval*0.1)); this.locate = 105.0 - ((this.time-audioBGM.currentTime)*BPM*ALPHA/Interval); this.alive = true; }; Note.prototype.getTime = function(){ return this.time; }; Note.prototype.getLane = function(){ return this.lane; }; Note.prototype.getLocate = function(){ return this.locate; }; Note.prototype.getBPM = function(){ return this.BPM; }; Note.prototype.updateLocate = function(BPM,sp){ //sp:HI-SPEED,BPM:Music's BPM if(this.locate<105.0) this.locate = 105.0 - ((this.time-audioBGM.currentTime)*BPM*ALPHA/Interval); if(this.locate>105.0) this.locate = 105.0; }; Note.prototype.isAlive = function(){ return this.alive; }; Note.prototype.kill = function(){ console.log(this.time+","+audioBGM.currentTime); this.alive = false; }; Note.prototype.autoSound = function(){ switch(this.lane){ case 1: audioHClose = audioPlay(audioHClose); break; case 2: audioSnare = audioPlay(audioSnare); break; case 3: audioKick = audioPlay(audioKick); break; case 4: audioTomA = audioPlay(audioTomA); break; case 5: audioTomB = audioPlay(audioTomB); break; case 6: audioFtom = audioPlay(audioFtom); break; case 7: audioRide = audioPlay(audioRide); break; case 8: audioCymbal = audioPlay(audioCymbal); break; } };