use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class AbstractControlSurface method handleMidi.
/**
* Handle received midi data.
*
* @param status The midi status byte
* @param data1 The midi data byte 1
* @param data2 The midi data byte 2
*/
protected void handleMidi(final int status, final int data1, final int data2) {
final int code = status & 0xF0;
final int channel = status & 0xF;
View view;
switch(code) {
// Note on/off
case 0x80:
case 0x90:
if (this.isGridNote(data1))
this.handleGridNote(data1, code == 0x80 ? 0 : data2);
else
this.handleNoteEvent(data1, code == 0x80 ? 0 : data2);
break;
// Polyphonic Aftertouch
case 0xA0:
view = this.viewManager.getActiveView();
if (view != null)
view.executeAftertouchCommand(data1, data2);
break;
// CC
case 0xB0:
this.handleCC(channel, data1, data2);
break;
// Channel Aftertouch
case 0xD0:
view = this.viewManager.getActiveView();
if (view != null)
view.executeAftertouchCommand(-1, data1);
break;
// Pitch Bend
case 0xE0:
view = this.viewManager.getActiveView();
if (view != null)
view.executePitchbendCommand(channel, data1, data2);
break;
default:
this.host.println("Unhandled midi status: " + status);
break;
}
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class AbstractControlSurface method redrawGrid.
/**
* Redraws the grid for the active view.
*/
protected void redrawGrid() {
final View view = this.viewManager.getActiveView();
if (view == null)
return;
view.drawGrid();
if (this.pads != null)
this.pads.flush();
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class AbstractControlSurface method handleNoteEvent.
/**
* Handle note events.
*
* @param note The midi note
* @param velocity The velocity
*/
protected void handleNoteEvent(final int note, final int velocity) {
this.noteVelocities[note] = velocity;
final View view = this.viewManager.getActiveView();
if (view == null)
return;
final Integer commandID = this.getNoteCommand(note);
if (commandID != null) {
view.executeNoteCommand(commandID, velocity);
return;
}
this.println("Unsupported Midi Note: " + note);
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class NoteViewSelectMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final ViewManager viewManager = this.surface.getViewManager();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
for (int i = 0; i < VIEWS.length; i++) {
String menuBottomName = "";
if (VIEWS[i] != null) {
final View view = viewManager.getView(VIEWS[i]);
if (view != null)
menuBottomName = view.getName();
}
final String menuTopName = VIEWS_TOP[i] == null ? "" : viewManager.getView(VIEWS_TOP[i]).getName();
final boolean isMenuBottomSelected = VIEWS[i] != null && viewManager.isActiveView(VIEWS[i]);
final boolean isMenuTopSelected = VIEWS_TOP[i] != null && viewManager.isActiveView(VIEWS_TOP[i]);
message.addOptionElement("", menuTopName, isMenuTopSelected, i == 0 ? "Note view" : "", menuBottomName, isMenuBottomSelected, false);
}
display.send(message);
}
Aggregations