void controlEvent(ControlEvent theEvent) { // ScrollList is if type ControlGroup. // when an item in a scrollList is activated, // 2 controlEvents will be broadcasted. // the first one from the ScrollList, the second // one from the button that has been pressed // inside the scrollList. // to avoid an error message from controlP5, you // need to check what type of item triggered the // event, either a controller or a group. if(theEvent.isController()) { // an event from a controller e.g. button if (theEvent.controller().id() >= 100) { port = int (theEvent.controller().value()); } else { switch(theEvent.controller().id()) { case(1): medidda = constrain (int (theEvent.controller().value()), 4, 24); controlP5.controller("medida").setValue(float (medidda)); break; case(2): feeel = constrain (int (theEvent.controller().value()), 2, 3); controlP5.controller("feel").setValue(float (feeel)); break; case(3): repeticciones = constrain (int (theEvent.controller().value()), 1, 8); controlP5.controller("repeticiones").setValue(float (repeticciones)); break; } } } else if (theEvent.isGroup()) { // an event from a group e.g. scrollList port = int (theEvent.group().value()); } } void Tempo (int theValue) { temmpo = 320 - theValue; } void mousePressed() { if(port >= 0) { port = -1; } } /* if (keyPressed) { i = repeticiones; port = -1; break; } */