Changes between Version 4 and Version 5 of misc/misc/processing/bvh_and_sound
- Timestamp:
- 09/20/14 00:03:54 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
misc/misc/processing/bvh_and_sound
v4 v5 117 117 bvh3 = new PBvh( loadStrings( "bvhfiles/nocchi.bvh" ) ); 118 118 119 //minim = new Minim(this); 120 //player = minim.loadFile("Perfume_globalsite_sound.wav"); 121 player =new SoundFile(this,"Perfume_globalsite_sound.wav"); 122 //player.play(); 123 124 player.loop(); 125 } 119 player =new SoundFile(this,"Perfume_globalsite_sound.wav"); 120 playing = 1; 121 player.play(); 122 //player.loop(); 123 } 126 124 127 125 public void draw() 128 126 { 129 background( 0 ); 127 int ms=millis()%70500; 128 129 background( color(240,240,128) ); 130 130 131 131 //camera 132 float _cos = cos(m illis()/ 5000.f);133 float _sin = sin(m illis()/ 5000.f);132 float _cos = cos(ms / 5000.f); 133 float _sin = sin(ms / 5000.f); 134 134 camera(width/4.f + width/4.f * _cos +200, height/2.0f-100, 550 + 150 * _sin,width/2.0f, height/2.0f, -400, 0, 1, 0); 135 135 … … 145 145 scale(-1, -1, -1); 146 146 147 //synchronize sound and animation 147 148 //model 148 bvh1.update( m illis());149 bvh2.update( m illis());150 bvh3.update( m illis());149 bvh1.update( ms ); 150 bvh2.update( ms ); 151 bvh3.update( ms ); 151 152 bvh1.draw(); 152 153 bvh2.draw(); 153 154 bvh3.draw(); 154 155 popMatrix(); 156 157 158 if (playing == 1) { 159 if (ms <= 64247){ 160 player.cue(ms); 161 } 162 else{ 163 player.stop(); 164 playing=0; 165 println("stop music", ms, player.duration(), player.sampleRate(),player.frames()); 166 } 167 } 168 else if (ms < 64247){ 169 player =new SoundFile(this,"Perfume_globalsite_sound.wav"); 170 player.play(); 171 playing=1; 172 println("start music",ms, 173 player.duration(), player.sampleRate(),player.frames()); 174 player.cue(ms); 175 } 155 176 } 177 156 178 157 179 void stop()