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 NoteRepeatView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final IHost host = this.model.getHost();
// Note Repeat
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
if (host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
final int octaves = noteRepeat.getOctaves();
for (int i = 0; i < 8; i++) padGrid.light(36 + i, i == octaves ? MaschineColorManager.COLOR_GREEN : MaschineColorManager.COLOR_GREY);
} else {
for (int i = 36; i < 44; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
}
for (int i = 44; i < 52; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
// Note Repeat period
final int periodIndex = Resolution.getMatch(noteRepeat.getPeriod());
padGrid.light(79, periodIndex == 0 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(71, periodIndex == 2 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(63, periodIndex == 4 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(55, periodIndex == 6 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(80, periodIndex == 1 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(72, periodIndex == 3 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(64, periodIndex == 5 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(56, periodIndex == 7 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
// Note Repeat length
if (host.supports(Capability.NOTE_REPEAT_LENGTH)) {
final int lengthIndex = Resolution.getMatch(noteRepeat.getNoteLength());
padGrid.light(81, lengthIndex == 0 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(73, lengthIndex == 2 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(65, lengthIndex == 4 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(57, lengthIndex == 6 ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO);
padGrid.light(82, lengthIndex == 1 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(74, lengthIndex == 3 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(66, lengthIndex == 5 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
padGrid.light(58, lengthIndex == 7 ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO);
} else {
padGrid.light(81, MaschineColorManager.COLOR_BLACK);
padGrid.light(73, MaschineColorManager.COLOR_BLACK);
padGrid.light(65, MaschineColorManager.COLOR_BLACK);
padGrid.light(57, MaschineColorManager.COLOR_BLACK);
padGrid.light(82, MaschineColorManager.COLOR_BLACK);
padGrid.light(74, MaschineColorManager.COLOR_BLACK);
padGrid.light(66, MaschineColorManager.COLOR_BLACK);
padGrid.light(58, MaschineColorManager.COLOR_BLACK);
}
for (int i = 52; i < 55; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
for (int i = 59; i < 63; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
for (int i = 67; i < 71; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
padGrid.light(75, MaschineColorManager.COLOR_BLACK);
if (host.supports(Capability.NOTE_REPEAT_MODE)) {
// Note Repeat Octave
padGrid.light(76, MaschineColorManager.COLOR_LIME);
padGrid.light(77, MaschineColorManager.COLOR_LIME);
} else {
padGrid.light(76, MaschineColorManager.COLOR_BLACK);
padGrid.light(77, MaschineColorManager.COLOR_BLACK);
}
for (int i = 78; i < 79; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
for (int i = 83; i < 100; i++) padGrid.light(i, MaschineColorManager.COLOR_BLACK);
}
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);
}
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class DrumView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final IDrumDevice primary = this.model.getDrumDevice();
if (this.isPlayMode) {
for (int y = 0; y < 2; y++) {
for (int x = 0; x < 8; x++) {
final int index = 8 * y + x;
padGrid.lightEx(x, 1 - y, this.getDrumPadColor(index, primary, false));
}
}
return;
}
if (!this.isActive()) {
padGrid.turnOff();
return;
}
// Paint the sequencer steps
final INoteClip clip = this.getClip();
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
final int offsetY = this.scales.getDrumOffset();
final int editMidiChannel = this.configuration.getMidiEditChannel();
final int selPad = this.getSelectedPad();
final List<GridStep> editNotes = this.getEditNotes();
for (int col = 0; col < DrumView.NUM_DISPLAY_COLS; col++) {
final int noteRow = offsetY + selPad;
final IStepInfo stepInfo = clip.getStep(editMidiChannel, col, noteRow);
final boolean hilite = col == hiStep;
final int x = col % GRID_COLUMNS;
final int y = col / GRID_COLUMNS;
final Optional<ColorEx> rowColor = this.getPadColor(primary, this.selectedPad);
padGrid.lightEx(x, y, this.getStepColor(stepInfo, hilite, rowColor, editMidiChannel, col, noteRow, editNotes));
}
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class SessionView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
super.drawGrid();
if (this.isControlModeOff())
return;
final ITrackBank tb = this.model.getCurrentTrackBank();
final IPadGrid pads = this.surface.getPadGrid();
final boolean flipSession = this.configuration.isFlipSession();
for (int x = 0; x < 8; x++) {
final int padX = flipSession ? 7 : x;
final int padY = flipSession ? x : 7;
pads.lightEx(padX, padY, this.getModeColor(tb.getItem(x), x));
}
}
Aggregations