new UISpeed(4, 624, 140, 50),
new UIPatternDeck(lx.engine.getDeck(1), "PATTERN B", width-144, 4, 140, 324),
- uiMidi = new UIMidi(midiListeners, width-144, 332, 140, 136),
- new UIOutput(width-144, 472, 140, 106),
+ uiMidi = new UIMidi(midiListeners, width-144, 332, 140, 160),
+ new UIOutput(width-144, 498, 140, 106),
uiCrossfader = new UICrossfader(width/2-90, height-90, 180, 86),
if (!enabled) {
return;
}
- println("PC: " + pc.toString());
+ if (uiMidi.logMidi()) {
+ println(getLabel() + " :: Program Change :: " + pc.getNumber());
+ }
}
void controllerChangeReceived(rwmidi.Controller cc) {
if (!enabled) {
return;
}
- println("CC: " + cc.toString());
+ if (uiMidi.logMidi()) {
+ println(getLabel() + " :: Controller :: " + cc.getCC() + ":" + cc.getValue());
+ }
getFocusedPattern().controllerChangeReceived(cc);
}
if (!enabled) {
return;
}
- println("Note On: " + note.toString());
+ if (uiMidi.logMidi()) {
+ println(getLabel() + " :: Note On :: " + note.getChannel() + ":" + note.getPitch() + ":" + note.getVelocity());
+ }
getFocusedPattern().noteOnReceived(note);
-
}
void noteOffReceived(Note note) {
if (!enabled) {
return;
}
- println("Note Off: " + note.toString());
+ if (uiMidi.logMidi()) {
+ println(getLabel() + " :: Note Off :: " + note.getChannel() + ":" + note.getPitch() + ":" + note.getVelocity());
+ }
getFocusedPattern().noteOffReceived(note);
}
}
}
+public class UICheckbox extends UIButton {
+
+ private boolean firstDraw = true;
+
+ public UICheckbox(float x, float y, float w, float h) {
+ super(x, y, w, h);
+ setMomentary(false);
+ }
+
+ public void onDraw(PGraphics pg) {
+ pg.stroke(borderColor);
+ pg.fill(active ? activeColor : inactiveColor);
+ pg.rect(0, 0, h, h);
+ if (firstDraw) {
+ pg.fill(labelColor);
+ pg.textFont(defaultItemFont);
+ pg.textAlign(LEFT, CENTER);
+ pg.text(label, h + 4, h/2);
+ firstDraw = false;
+ }
+ }
+
+}
+
public class UIButton extends UIObject {
- private boolean active = false;
- private boolean isMomentary = false;
- private color borderColor = #666666;
- private color inactiveColor = #222222;
- private color activeColor = #669966;
- private color labelColor = #999999;
- private String label = "";
+ protected boolean active = false;
+ protected boolean isMomentary = false;
+ protected color borderColor = #666666;
+ protected color inactiveColor = #222222;
+ protected color activeColor = #669966;
+ protected color labelColor = #999999;
+ protected String label = "";
public UIButton(float x, float y, float w, float h) {
super(x, y, w, h);
}
}
+ public boolean isActive() {
+ return active;
+ }
+
public UIButton setActive(boolean active) {
this.active = active;
onToggle(active);
class UIMidi extends UIWindow {
- final private UIToggleSet deckMode;
+ private final UIToggleSet deckMode;
+ private final UIButton logMode;
UIMidi(List<MidiListener> midiListeners, float x, float y, float w, float h) {
super("MIDI", x, y, w, h);
scrollItems.add(ml);
}
new UIScrollList(1, titleHeight, w-2, 80).setItems(scrollItems).addToContainer(this);
- (deckMode = new UIToggleSet(4, 110, w-9, 20)).setOptions(new String[] { "A", "B" }).addToContainer(this);
+ (deckMode = new UIToggleSet(4, 110, 90, 20)).setOptions(new String[] { "A", "B" }).addToContainer(this);
+ (logMode = new UIButton(98, 110, w-103, 20)).setLabel("LOG").addToContainer(this);
+ }
+
+ public boolean logMidi() {
+ return logMode.isActive();
}
public Engine.Deck getFocusedDeck() {