Changes between Version 4 and Version 5 of misc/misc/processing/bvh_and_sound


Ignore:
Timestamp:
09/20/14 00:03:54 (10 years ago)
Author:
noboru.yamamoto
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • misc/misc/processing/bvh_and_sound

    v4 v5  
    117117    bvh3 = new PBvh( loadStrings( "bvhfiles/nocchi.bvh" ) ); 
    118118 
    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} 
    126124 
    127125public void draw() 
    128126{ 
    129   background( 0 ); 
     127  int ms=millis()%70500; 
     128  
     129  background( color(240,240,128) ); 
    130130   
    131131  //camera 
    132   float _cos = cos(millis() / 5000.f); 
    133   float _sin = sin(millis() / 5000.f); 
     132  float _cos = cos(ms / 5000.f); 
     133  float _sin = sin(ms / 5000.f); 
    134134  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); 
    135135   
     
    145145  scale(-1, -1, -1); 
    146146   
     147  //synchronize sound and animation 
    147148  //model 
    148   bvh1.update( millis() ); 
    149   bvh2.update( millis() ); 
    150   bvh3.update( millis() ); 
     149  bvh1.update( ms ); 
     150  bvh2.update( ms ); 
     151  bvh3.update( ms ); 
    151152  bvh1.draw(); 
    152153  bvh2.draw(); 
    153154  bvh3.draw(); 
    154155  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   } 
    155176} 
     177 
    156178 
    157179void stop()