hey there, i have a program which is designed to run at a low frame rate(2fps) but i also want to be able to update the frame in between the draw loop running(via event driven).
Is there a way to update the frame from outside the draw method without calling the draw method?
import arb.soundcipher.*;
int rows; int columns; int[] pitches = {71,70,69,67,65,64,62,60}; float[] playing = {0}; note[][] notes; int beatcounter; int tracklength; int playercounter; SoundCipher[] players; void setup(){ rows = pitches.length; columns = 29; playercounter = 0; players = new SoundCipher[4]; for(int x = 0;x<4;x+=1){ players[x] = new SoundCipher(); } beatcounter = 0; notes= new note[columns][rows]; size(columns * 20, rows * 20); for(int y = 0; y < rows; y += 1){ for(int x = 0; x<columns; x+= 1){ notes[x][y] = new note(x * 20, y * 20, pitches[y]); notes[x][y].display(false); } }
here's my code, the boxes drawn in toggle() don't appear until the next frame, up to half a second later, which can be confusing if you're trying to rapidly change things.
note[][] beats; int beatcounter; int[] playing; SoundCipher sc;
void setup(){ size(400,400); background(100); beats = new note[8][8]; sc = new SoudCipher(); frameRate(2); for(int x = 0; x< height; x +=50){ for(int y = 0; y < width; y+=50){ switch(x){ case = 0: beats[x][y] = new note(x*50,y*50,72); case = 1: beats[x][y] = new note(x*50,y*50,71); case = 2: beats[x][y] = new note(x*50,y*50,69); case = 3: beats[x][y] = new note(x*50,y*50,67); case = 4: beats[x][y] = new note(x*50,y*50,65); case = 5: beats[x][y] = new note(x*50,y*50,64); case = 6: beats[x][y] = new note(x*50,y*50,62); case = 7: beats[x][y] = new note(x*50,y*50,60); case = 8: beats[x][y] = new note(x*50,y*50,59); } } }
}
and when i hit run, it says 'unexpected token: void', highlighting the setup method.
i've tried commenting out the soundcipher lines, the global declarations, removing the return method, changing the return method, adding a return statement, and no progress was made=[