hi
here is the order that the code employs:
entertext
black record button is made visible
press record button turns red theEvent.getController().getName() feeds back recording
press record button disappears and save button appears theEvent.getController().getName() feeds back recording
press save button theEvent.getController().getName() feeds back recording why is it not returning saving as button pushed
import controlP5.*; ControlP5 cp5; import oscP5.*; import netP5.*; String kissersNames; Table writeTable, readTable; int buttonStatus; boolean oscStatus = true; OscP5 oscP5; NetAddress myRemoteLocation1, myRemoteLocation2, myRemoteLocation3; void setup() { size(300, 150); noStroke(); cp5 = new ControlP5(this); PImage replayPlay = loadImage("replay.png"); PImage replayStop = loadImage("replayStop.png"); PImage recordPlay = loadImage("recording.png"); PImage recordStop = loadImage("stopRecording.png"); PImage saves = loadImage("saved.png"); buttonStatus =0;
cp5.addTextfield("enterKissers") .setPosition(10, 20) .setSize(250, 20) .setAutoClear(false) ; cp5.addToggle("replay") .setPosition(150, 60) .setImages(replayStop, replayPlay) .updateSize() ; cp5.addToggle("recording") .setValue(1) .setPosition(10, 60) .setImages(recordPlay, recordStop) .updateSize() .setVisible(false) ;
cp5.addButton("saving")
.setValue(1)
.setPosition(80, 60)
.setImage(saves)
.updateSize()
.setVisible(false)
;
/* start oscP5, listening for incoming messages at port 12000 */ }
public void saving(int theValue) {
/* send the message */
println("saved");
if (buttonStatus==3) {
//println("kissersNames= " +kissersNames);
//saveTable(writeTable, kissersNames);
markers(104);
cp5.getController("recording").setValue(0.0);
buttonStatus=-1;
}
}
public void recording(int theValue) {
if (buttonStatus==0) {
delay(2000);
markers(101);
markers(102);
oscStatus = true;
buttonStatus++;
} else if (buttonStatus==1) {
buttonStatus++;
} else if (buttonStatus==2) {
buttonStatus++;
cp5.getController("saving").setVisible(true);
cp5.getController("recording").setVisible(false);
markers(103);
markers(104);
}
}
void controlEvent(ControlEvent theEvent) { println("this event was triggered by Controller " + theEvent.getController().getName());
if (theEvent.isFrom(cp5.getController("replay"))) {
}
if (theEvent.isFrom(cp5.getController("enterKissers"))) {
cp5.getController("recording").setVisible(true);
//cp5.getController("saving").setVisible(false);
// cp5.getController("saving").
// TableRow newRow = writeTable.addRow();
//println(writeTable.getRowCount());
// saveTable(writeTable, kissersNames);
}
}
void markers(int markers) {
println("Markers" +" ," + markers);
}
void draw() {
//println(kissersNames);
background(0);
}