Mercurial > hg > Members > e105711
view webGL/src/Note.js @ 13:74dc1d5f2e47 draft
can select music
author | e105711 <yomitan.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 07 Jun 2012 02:47:08 +0900 |
parents | 98a90bc478b3 |
children | 80789d11de5c |
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; } };