use of de.mossgrabers.framework.daw.INoteClip in project DrivenByMoss by git-moss.
the class PlayView method drawDrumGrid.
/**
* 'Draw' the drum grid sequencer.
*
* @param buttonIDOrdinal The ordinal number of the button
* @return The color for the step
*/
public int drawDrumGrid(final int buttonIDOrdinal) {
final boolean isRow3 = buttonIDOrdinal >= ButtonID.ROW3_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW3_8.ordinal();
final int index = isRow3 ? buttonIDOrdinal - ButtonID.ROW3_1.ordinal() : buttonIDOrdinal - ButtonID.ROW4_1.ordinal();
final int x = index;
final int y;
if (this.isPlayMode)
y = isRow3 ? 1 : 0;
else
y = isRow3 ? 0 : 1;
final int col = 8 * y + x;
if (this.isPlayMode)
return this.getDrumPadColor(col);
if (!this.isActive())
return SLControlSurface.MKII_BUTTON_STATE_OFF;
final INoteClip clip = this.getClip();
final boolean exists = clip.doesExist();
// Paint the sequencer steps
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % PlayView.NUM_DISPLAY_COLS : -1;
final int offsetY = this.scales.getDrumOffset();
final int editMidiChannel = this.configuration.getMidiEditChannel();
if (col >= PlayView.NUM_DISPLAY_COLS)
return SLControlSurface.MKII_BUTTON_STATE_OFF;
final StepState isSet = clip.getStep(editMidiChannel, col, offsetY + this.selectedPad).getState();
final boolean hilite = col == hiStep;
return exists && (isSet != StepState.OFF || hilite) ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
}
Aggregations