hello,
I want to know , how it's possible to create some Array of Note Object to use in another object.
I have created an game like a chess board, and when you move over the square of the chess board with your mouse, you send midinote.
So i have created 16 objects for 16 squares, and i want to send 16 notes out, so how can i do to put 16 different notes into my square Class?
i hope i'm clear
i have writen this:
Carre[] carre = new Carre[numCarre];
Note [] noteLevelOne = new Note[numCarre];
Note [] noteLevelTwo = new Note[numCarre];
to declare, and this to construct:
for(int i=0;i<carre.length;i++){
noteLevelOne[i]=new Note(numeros1[i],velocity1,length1);
noteLevelTwo[i]=new Note(numeros2[i],velocity2,length2);
carre[i]=new Carre(x[i],y[i],diameter,colorc[i],colord[i],noteLevelOne[i],noteLevelTwo[i]);
}
and in my class:
class Carre{
int colorc,colord,x,y,diameter;
Note note1;
Note note2;
Carre(int xpos,int ypos,int dia,int icolorc,int icolord,Note inote1,Note inote2){
x=xpos;
y=ypos;
diameter=dia;
icolorc=colorc;
icolord=colord;
inote1=note1;
inote2=note2;
}
and finally the method to send the note:
void update(){
if(level==false){
if(over(x,y,diameter,mick1.x1,mick1.y1,mick2.x1,mick2.y1)){
if (colorc > 0) {
colorc=colorc-5;
}
if(colorc>=250){
//note1=new Note(60,126,400);
midiOut.sendNote(note1);
println(" "+note1);
println(note1);
}
}
else {
colorc=255;
colord=255;
}
}
}
but when i run the sketch processing send me an error message said that :
NullPointerException
He doesn't find any Note midi!
i don't understand why..
please help me
thanks