boolean taskAtom = false; boolean taskLive = false; boolean taskDrone= false; // screen input ratio------------------------------ int inputW=160; int inputH=120; int outputW=800; int outputH=600; int ratioScreen=outputW/inputW; int halfInW=outputW/2; int halfInH=outputH/2; int countArray; float countF=0; float midiRatio=outputW/128; // atoms control boolean done=true; int counterGen=30; // //---------------------------------------------------------------------------------------------- // initialize flowfield-------------------------------------------------------------------- int ratioFlowField=50; int nodeLength=((outputW/ratioFlowField)*(outputH/ratioFlowField)); Node [] area =new Node[nodeLength]; //------------------------------------------------------------------------------------- // initialize Atoms --------------------------------------------------------------------- int atomNum=8; Atom[] atomArray=new Atom[atomNum]; //-------------------------------------------------------------------------------------- //initialize LiveObject int liveNum=2; LiveObject[] liveArray=new LiveObject[liveNum]; //--------------------------------------------------------------------------------------- OscP5 oscFrame; OscP5 oscR; OscP5 oscG; OscP5 oscB; OscP5 oscTaskAtom; OscP5 oscTaskLive; OscP5 oscTaskDrone; OscP5 oscLiveSendContact; OscP5 oscDroneSendContact; OscP5 oscAtomsSendCollision; OscP5 oscLiveStart; OscP5 oscLiveCursorSample; OscP5 oscloadLivePitch; // ______________________________________________________________ int liNum=9; //initialize arrays virtual light ------------------------------------- VirtualLight[] redLights= new VirtualLight[liNum]; VirtualLight[] blueLights= new VirtualLight[liNum]; VirtualLight[] greenLights= new VirtualLight[liNum]; //---------------------------------------------------------------------- LightReal[] lightsOnArray= new LightReal[liNum]; // split address var & arrays //String redAdd[]; String redAdd; String blueAdd; String greenAdd; int redValue; int redIndex; String redProperty; int greenValue; int greenIndex; String greenProperty; int blueValue; int blueIndex; String blueProperty; //_---------------------------------------------------------------- int globalFrame; OscBundle osb; int receiveAtPort; int sendToPort; String host; String oscP5event; float dimX=0; float dimY=0; float dimW=0; float dimH=0; float p=0; void initOsc() { receiveAtPort = 2510; sendToPort = 5701; host = "127.0.0.1"; //193.179.25.240 //it host = "193.179.25.240"; oscP5event = "oscEvent"; oscFrame= new OscP5(this,host,sendToPort,receiveAtPort,"oscEventFrame"); oscR = new OscP5(this,host,sendToPort,2501,"oscEventRed"); oscG = new OscP5(this,host,sendToPort,2503,"oscEventGreen"); oscB = new OscP5(this,host,sendToPort,2502,"oscEventBlue"); //task controller: atoms oscTaskAtom = new OscP5(this,host,sendToPort,2600,"osc_Atom"); oscTaskLive = new OscP5(this,host,sendToPort,2700,"osc_Live"); oscTaskDrone = new OscP5(this,host,sendToPort,2900,"osc_Drone"); //send out ot max oscLiveSendContact=new OscP5(this,"192.168.0.3",2710,2711,"osc_Live"); oscAtomsSendCollision=new OscP5(this,"192.168.0.3",2611,2612,"osc_Live"); oscDroneSendContact=new OscP5(this,"192.168.0.3",3710,3711,"osc_sdrone"); //osc live star-stop recording // oscLiveStart=new OscP5(this,host,sendToPort,2701,"osc_LiveStart"); oscLiveStart=new OscP5(this,host,sendToPort,2701,"osc_LiveStart"); //osc live //oscLiveCursorSample=new OscP5(this,host,sendToPort,2728,"osc_LiveCursorS"); oscLiveCursorSample=new OscP5(this,host,sendToPort,2728,"osc_LiveCursorS"); // // test object oscloadLivePitch= new OscP5(this,host,sendToPort,4000,"osc_loadLivePitch"); } void osc_loadLivePitch(OscIn oscIn) { ArrayList o=oscIn.getDataList(); int numPitch=o.size(); //println("ARRIVA"); if(oscIn.checkAddrPattern("pitch_lp1")) { liveArray[0].pArray=new int[numPitch]; for(int i=0; i0){ counterGen--; } else { done=true; } // //println("frame"+globalFrame); for (int r=0;rglobalFrame-3){ active=true; //rect(_x,_y,_width,_height); drawRect(); upDateMainArray(); } else { active=false; resetOld(); } //sendDronetoMax(); } void drawRect(){ // draw bounding rect halfW=Math.abs(int(_width*.5)); halfH=Math.abs(int(_height*.5)); realX=_x+halfW; //realY=_y-halfH; realY=_y; line(realX-halfW,realY-halfH,realX-halfW+3,realY-halfH); line(realX-halfW,realY-halfH,realX-halfW,realY-halfH+3); line(realX-halfW,realY+halfH,realX-halfW+3,realY+halfH); line(realX-halfW,realY+halfH,realX-halfW,realY+halfH-3); line(realX+halfW,realY-halfH,realX+halfW-3,realY-halfH); line(realX+halfW,realY-halfH,realX+halfW,realY-halfH+3); line(realX+halfW,realY+halfH,realX+halfW-3,realY+halfH); line(realX+halfW,realY+halfH,realX+halfW,realY+halfH-3); drawTarget(); } void drawTarget(){ // draw delay cross stroke(255,255,255,100); difX=realX-oldX; difY=realY-oldY; oldY+=int(difY*motionDelay); oldX+=int(difX*motionDelay); line(oldX-2,oldY,oldX+2,oldY); line(oldX,oldY-2,oldX,oldY+2); // draw bouncing line stroke(255,255,255,100); line(oldX,oldY,realX,realY); } void upDateMainArray(){ // load data into main array if(countArray0){ timer--; } checkX=int(floor(_x*.005)); checkY=int(floor(_y*.005)); oldX=_x; oldY=_y; energy=area[checkX*16+checkY].distSum; vectX+=area[checkX*16+checkY].xVect*energy; vectY+=area[checkX*16+checkY].yVect*energy; float lightvectx=0; float lightvecty=0; // energy=1; // vectX+=1; // vectY+=1; if(idCollision!=-1){ if(Math.abs(dist(_x,_y,lightsOnArray[idCollision]._x,lightsOnArray[idCollision]._y))>120){ idCollision=-1; } } for(int n=0; n < countArray; n++){ float cx=lightsOnArray[n]._x; float cy=lightsOnArray[n]._y; float ndist=dist(cx,cy,_x,_y); float nDistAb=Math.abs(ndist); //float newDist=float(Math.abs(Math.sqrt(lightsOnArray[n]._width*lightsOnArray[n]._height))); if(idCollision!=n){ if(nDistAbwidth-1){ _x=width-1; vectX=-vectX*.95; } if(_y<1){ _y=1; vectY=-vectY*.95; } if(_y>height-1){ _y=height-1; vectY=-vectY*.95; } generation(); for(int k=0;k