modify a two dimensionnal array after declare it
in
Contributed Library Questions
•
10 months ago
hi
i try to use jm etude
in this sketch i want to declare a 2d array because if i put my 2d array in setup() jm etude can not use my 2d array.
i want to modify the values contained in my 2d array in draw with key Pressed
can i do this? could explain me how i can modify in a dynamic mode my 2d array values after declare it?
thanks
////////////////
import jmetude.*;
Etude e;
float notes[][] = { { 80, 4.0 } };
void setup() {
noLoop();
size(200, 100);
e = new Etude(this);
e.createPhrase("phrase");
}
void draw() {
fill(notes[0][0]);
rect(50, 50, 50, 50);
if (keyPressed) {
float notes[][] = { { 50, 4.0} };
splice(notes, "50 + 4", 0);
}
e.addPhraseNoteList("phrase", notes);
}
void mousePressed() {
e.stopMIDI();
int inst =0;
e.setPhraseInstrument("phrase", inst);
e.playMIDI("phrase");
}
/////////////////////////
1