use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class AbstractDrumView method drawSequencerSteps.
/**
* Draw the sequencer steps.
*
* @param clip The clip
* @param isActive Is there an active clip?
* @param noteRow The note for which to draw the row
* @param rowColor The color to use the notes of the row
* @param yModifier Flips the Y order if true
*/
protected void drawSequencerSteps(final INoteClip clip, final boolean isActive, final int noteRow, final Optional<ColorEx> rowColor, final IntUnaryOperator yModifier) {
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
final int editMidiChannel = this.configuration.getMidiEditChannel();
final IPadGrid padGrid = this.surface.getPadGrid();
final List<GridStep> editNotes = this.getEditNotes();
for (int col = 0; col < this.sequencerSteps; col++) {
final IStepInfo stepInfo = clip.getStep(editMidiChannel, col, noteRow);
final boolean hilite = col == hiStep;
final int x = col % this.numColumns;
int y = col / this.numColumns;
if (yModifier != null)
y = yModifier.applyAsInt(y);
padGrid.lightEx(x, y, isActive ? this.getStepColor(stepInfo, hilite, rowColor, editMidiChannel, col, noteRow, editNotes) : AbstractSequencerView.COLOR_NO_CONTENT);
}
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class AbstractPolySequencerView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final boolean isKeyboardEnabled = this.model.canSelectedTrackHoldNotes();
if (!isKeyboardEnabled) {
padGrid.turnOff();
return;
}
final INoteClip clip = this.getClip();
final boolean isActive = this.isActive();
final int step = clip.getCurrentStep();
// Paint the sequencer steps
final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
final List<GridStep> editNotes = this.getEditNotes();
for (int col = 0; col < this.sequencerSteps; col++) {
final IStepInfo stepInfo = this.getStep(clip, col);
final boolean hilite = col == hiStep;
final int x = col % this.numColumns;
final int y = col / this.numColumns;
padGrid.lightEx(x, y, isActive ? this.getStepColor(stepInfo, hilite, col, editNotes) : AbstractSequencerView.COLOR_NO_CONTENT);
}
// Paint the play part
final boolean isRecording = this.model.hasRecordingState();
final ITrack cursorTrack = this.model.getCursorTrack();
final int startNote = this.scales.getStartNote();
for (int i = startNote; i < startNote + this.sequencerSteps; i++) padGrid.light(i, this.getGridColor(isKeyboardEnabled, isRecording, cursorTrack, i));
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class BrowserView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
padGrid.light(36, DISCARD);
padGrid.light(37, OFF);
for (int i = 38; i < 42; i++) padGrid.light(i, PLAY);
padGrid.light(42, OFF);
padGrid.light(43, CONFIRM);
for (int i = 44; i < 52; i++) padGrid.light(i, OFF);
for (int i = 52; i < 60; i++) padGrid.light(i, COLUMNS[i - 52]);
for (int i = 60; i < 68; i++) padGrid.light(i, COLUMNS[i - 60]);
for (int i = 68; i < 76; i++) padGrid.light(i, COLUMNS[i - 68]);
for (int i = 76; i < 84; i++) padGrid.light(i, COLUMNS[i - 76]);
for (int i = 84; i < 100; i++) padGrid.light(i, OFF);
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class AbstractDrum64View method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
if (!this.model.canSelectedTrackHoldNotes()) {
padGrid.turnOff();
return;
}
final IDrumDevice drumDevice64 = this.model.getDrumDevice64();
final boolean isRecording = this.model.hasRecordingState();
int blockOffset = 0;
// Draw all blocks
for (int xblock = 0; xblock < this.xblocks; xblock++) {
for (int yblock = 0; yblock < this.yblocks; yblock++) {
// Draw a 4x4 square
for (int blockX = 0; blockX < 4; blockX++) {
for (int blockY = 0; blockY < 4; blockY++) {
final int index = blockOffset + blockY * 4 + blockX;
final int x = xblock * 4 + blockX;
final int y = yblock * 4 + blockY;
padGrid.lightEx(x, this.rows - 1 - y, this.getDrumPadColor(index, drumDevice64, isRecording));
}
}
blockOffset += 16;
}
}
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class PrgChangeView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final int[] colors = this.isToggled ? this.yellows : this.greens;
final int selPad;
if (this.isToggled)
selPad = this.programNumber >= 64 ? this.programNumber - 64 : -1;
else
selPad = this.programNumber < 64 ? this.programNumber : -1;
final IPadGrid gridPad = this.surface.getPadGrid();
final boolean isPush2 = this.surface.getConfiguration().isPush2();
final int red = isPush2 ? PushColorManager.PUSH2_COLOR2_RED : PushColorManager.PUSH1_COLOR2_RED;
for (int i = 36; i < 100; i++) {
final int pad = i - 36;
final int row = pad / 8;
gridPad.light(i, selPad == pad ? red : colors[row], -1, false);
}
}
Aggregations