russellp
YaBB Newbies
Offline
Posts: 3
sketch cannot find class
Mar 18th , 2010, 11:08am
Hi, I have a sketch which has an object called Die, which is then used in an array to store data about dice being used in a game. The class structure looks fine, but the main sketch cannot see it, and I can not find my error. import TUIO.*; import themidibus.*; //Import the library import javax.sound.midi.MidiMessage; //Import the MidiMessage class Die[] dice;//Declare the array TuioProcessing tuioClient; //Tuio client for reacTIVision TuioObject tobj;//for Tuio MidiBus myBus; // The MidiBus int numdice = 10; int i = 100; void setup() { size(10,10); noStroke(); } void draw() { dice= new Die[numdice]; TuioProcessing tuioClient = new TuioProcessing(this); myBus = new MidiBus(this,"IAC Bus 1","IAC Bus 1");// Create a new MidiBus object for (int i=0; i< dice.length; i++) { //load dice details into array??? dice[i] = new Die(tobj.getSymbolID(), tobj.getX(), tobj.getY(), tobj.getAngle() ); } for (i = 0; i < dice.length; i++) { dice[i].midisend(); } } void addTuioObject(TuioObject tobj) { println("add object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+ ") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()); } void removeTuioObject(TuioObject tobj) { println("remove object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")"); } // called when an object is moved void updateTuioObject (TuioObject tobj) { println("update object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle() +" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel()); } // called when a cursor is added to the scene void addTuioCursor(TuioCursor tcur) { println("add cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY()); } // called when a cursor is moved void updateTuioCursor (TuioCursor tcur) { println("update cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+ ") " +tcur.getX()+" "+tcur.getY() +" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel()); } // called when a cursor is removed from the scene void removeTuioCursor(TuioCursor tcur) { println("remove cursor "+tcur.getCursorID()+" ("+tcur.getSessionID()+")"); } // called after each message bundle // representing the end of an image frame void refresh(TuioTime bundleTime) { redraw(); } } class Die { //properties float dieX, dieY, dieAngle; int dieface; Die(int dieface, float dieX, float dieY, float dieAngle) { this.dieface = dieface; this.dieX = dieX; this.dieY = dieY; this.dieAngle = dieAngle; } //methods void setdieface(int dieface) { this.dieface = dieface; } int getdieface() { return dieface; } void setdieX(float dieX) { this.dieX = dieX; } float getdieX() { return dieX; } void setdieY(float dieY) { this.dieY = dieY; } float getdieY() { return dieY; } void setdieAngle(float dieAngle) { this.dieAngle = dieAngle; } float getdieAngle() { return dieAngle; } void midisend(){ int channel = 0; int velocity = 99; myBus.sendNoteOn(channel, Die.getdieface(), velocity); //myBus.sendMessage(0xB0,0, getdieface(), velocity);//(0xB0 = continous ctllr,channel,pitch,velocity) //myBus.sendMessage( } } } Thanks, Russell