ok threads and timer/ worker apart, that makes sense.
cont.clkset(7,237); // starts the swingclock on 7 milli sec.
starttime = System.currentTimeMillis();
do {
if (cont.getescFlag()) {
exit=true; //exit the soundblock
}
if (cont.clkpls>=tel*7 && tel<=60) { // clkpls augments with each 7 mili
tel=tel+1;
cont.ed.midi_vel(1,4,67+tel);
}
if (cont.clkpls>=50*teller) {
teller=teller+1;
System.out.println(" teller " + teller);
if (teller>10 && teller<=40) cont.ed.midi_vel(5,8,97+teller-10);
}
if (teller==8) cont.ed.midi_data(algemeen,"fdb",1,1,2);
if (teller==12) cont.ed.midi_data(algemeen,"fdb",1,3,4);
if (teller==14) cont.ed.midi_data(algemeen,"fdb",2,1,2);
if (teller==19) cont.ed.midi_data(operator4,"lev",8,1,2);
if (teller==23) cont.ed.midi_data(operator4,"lev",8,3,4);
if (teller==25) cont.ed.midi_data(algemeen,"fdb",3,3,4);
if (teller==29) cont.ed.midi_data(algemeen,"fdb",3,1,2);
if (teller==31) cont.ed.midi_data(algemeen,"fdb",4,1,2);
if (teller==34) cont.ed.midi_data(algemeen,"fdb",5,3,4);
if (teller==38) cont.ed.midi_data(algemeen,"fdb",5,1,2);
if (teller==40) cont.ed.midi_data(operator4,"lev",7,1,2);
if (teller==43) cont.ed.midi_data(operator4,"lev",7,3,4);
if (teller==45) cont.ed.midi_data(operator4,"lev",6,1,2);
if (teller==49) cont.ed.midi_data(operator4,"lev",6,3,4);
if (teller==52) cont.ed.midi_data(operator4,"lev",5,1,4);
if (teller==53) cont.ed.midi_data(operator4,"lev",4,1,4);
if (teller==55) cont.ed.midi_data(operator4,"lev",3,1,4);
if (teller==56) cont.ed.midi_data(operator4,"lev",1,1,4);
if (teller==57) {
cont.ed.midi_data(operator4,"lev",0,1,4);
cont.ed.midi_data(operator4,"d1r",6,1,4);
cont.ed.midi_data(operator3,"lev",3,1,4);
cont.ed.midi_data(algemeen,"fdb",7,1,4);
}
if (teller==12) waarde=134;
if (teller==19) waarde=259;
if (teller==23) waarde=378;
if (teller==30) waarde=491;
if (teller==37) waarde=598;
if (teller==43) waarde=700;
if (teller==52) waarde=798;
if (teller==6) cont.ed.midi_vel(5,8,97);
if (cont.clkpls>=tijd1) {
tijd1=cont.ed.random(startgetal,80-teller,400-(6*teller))+tijd1; //?
//System.out.println("tijd1 " + tijd1);
if (teller<=58) {
boo1=false; boo2=false; boo3=false; boo4=false;
}
x = cont.ed.random(startgetal,1,4);
y = cont.ed.random(startgetal,1,2);
// System.out.println("boo1-4 " + x);
if (x==1) boo1=true;
else
if (x==2) boo2=true;
if (y==1) boo3=true;
else
if (y==2) boo4=true;
}
if (cont.clkpls>=7*i1) { //3
i1=i1+1;
if (boo1 || boo2) {
toon=cont.ed.random(startgetal,1,waarde);
fractie= toon % 127;
toon= toon / 127;
vel=cont.ed.random(startgetal,80,100);
stem=cont.ed.random(startgetal,1,2);
if (boo1=true) stem=2;
if (boo2=true) stem=1;
cont.ed.midi_toon(stem,50+toon,fractie,vel);
}
}
if (cont.clkpls>=9*i2) { //4
i2=i2+1;
if (boo3 || boo4) {
toon=cont.ed.random(startgetal,1,waarde);
fractie= toon % 127;
toon= toon / 127;
vel=cont.ed.random(startgetal,80,100);
stem=cont.ed.random(startgetal,3,4);
if (boo3=true) stem=4;
if (boo4=true) stem=3;
cont.ed.midi_toon(stem,50+toon,fractie,vel);
}
}
if (cont.clkpls>=tijd3) {
cont.ed.midi_toon(5,20,cont.ed.random(startgetal,0,127),cont.ed.random(startgetal,50,80));
tijd3 = cont.ed.random(startgetal,10,60)+tijd3;
}
if ((cont.clkpls>=400+tijd2) || (teller==56) || (teller==58)) {
tijd2=cont.ed.random(startgetal,30,600)+tijd2;
cont.ed.midi_data(algemeen,"fdb",cont.ed.random(startgetal,5,7),5,8);
if (teller>=58) {
cont.ed.midi_data(algemeen,"fdb",7,5,8);
cont.ed.midi_data(operator4,"lev",0,5,8);
}
toon=cont.ed.random(startgetal,16,17);
// System.out.println("ransdom 16-7 " + toon);
fractie=cont.ed.random(startgetal,0,127);
cont.ed.midi_toon(5,toon,fractie,127);
toon=cont.ed.random(startgetal,17,18);
fractie=cont.ed.random(startgetal,0,127);
cont.ed.midi_toon(6,toon,fractie,127);
toon=cont.ed.random(startgetal,18,19);
fractie=cont.ed.random(startgetal,0,127);
cont.ed.midi_toon(7,toon,fractie,127);
}
} while (teller<61 && !exit);
System.out.println(" end of loop " + (System.currentTimeMillis() - starttime) + " teller " + teller);