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();
if (!this.model.canSelectedTrackHoldNotes()) {
padGrid.turnOff();
return;
}
if (this.isPlayMode) {
final IDrumDevice primary = this.model.getDrumDevice();
for (int y = 0; y < 2; y++) {
for (int x = 0; x < 8; x++) {
final int index = 8 * y + x;
padGrid.lightEx(x, y, this.getDrumPadColor(index, primary));
}
}
return;
}
final INoteClip clip = this.getClip();
// Paint the sequencer steps
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % DrumView.NUM_DISPLAY_COLS : -1;
final int offsetY = this.scales.getDrumOffset();
final int editMidiChannel = this.configuration.getMidiEditChannel();
for (int col = 0; col < DrumView.NUM_DISPLAY_COLS; col++) {
final StepState stepState = clip.getStep(editMidiChannel, col, offsetY + this.selectedPad).getState();
final boolean hilite = col == hiStep;
final int x = col % 8;
final int y = col / 8;
padGrid.lightEx(x, 1 - y, getSequencerPadColor(stepState, hilite));
}
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class MixView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
final ITrackBank tb = this.model.getCurrentTrackBank();
for (int i = 0; i < tb.getPageSize(); i++) {
final ITrack track = tb.getItem(i);
if (track.doesExist()) {
// Select
final int colorIndex = this.colorManager.getColorIndex(DAWColor.getColorIndex(track.getColor()));
if (track.isSelected())
padGrid.lightEx(i, 0, colorIndex, FireColorManager.FIRE_COLOR_WHITE, false);
else
padGrid.lightEx(i, 0, colorIndex);
// Mute
padGrid.lightEx(i, 1, track.isMute() ? FireColorManager.FIRE_COLOR_ORANGE : FireColorManager.FIRE_COLOR_DARKER_ORANGE);
// Solo
padGrid.lightEx(i, 2, track.isSolo() ? FireColorManager.FIRE_COLOR_YELLOW : FireColorManager.FIRE_COLOR_DARKER_YELLOW);
// Record Arm
padGrid.lightEx(i, 3, track.isRecArm() ? FireColorManager.FIRE_COLOR_RED : FireColorManager.FIRE_COLOR_DARKER_RED);
} else {
padGrid.lightEx(i, 3, FireColorManager.FIRE_COLOR_BLACK);
padGrid.lightEx(i, 2, FireColorManager.FIRE_COLOR_BLACK);
padGrid.lightEx(i, 1, FireColorManager.FIRE_COLOR_BLACK);
padGrid.lightEx(i, 0, FireColorManager.FIRE_COLOR_BLACK);
}
}
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class SequencerView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final IPadGrid padGrid = this.surface.getPadGrid();
if (!this.model.canSelectedTrackHoldNotes()) {
padGrid.turnOff();
return;
}
if (this.isPlayMode) {
for (int i = 36; i < 52; i++) {
padGrid.light(i, this.keyManager.isKeyPressed(i) || this.selectedPad == i - 36 ? BeatstepColorManager.BEATSTEP_BUTTON_STATE_PINK : this.colorManager.getColorIndex(this.keyManager.getColor(i)));
}
} else {
final INoteClip clip = this.getClip();
// Paint the sequencer steps
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % SequencerView.NUM_DISPLAY_COLS : -1;
final int editMidiChannel = this.configuration.getMidiEditChannel();
for (int col = 0; col < SequencerView.NUM_DISPLAY_COLS; col++) {
final int y = this.offsetY + this.selectedPad;
final int map = this.scales.getNoteMatrix()[y];
final StepState stepState = clip.getStep(editMidiChannel, col, map).getState();
padGrid.lightEx(col % 8, 1 - col / 8, getSequencerColor(stepState, col == hiStep));
}
}
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class TrackView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ITrackBank tb = this.model.getCurrentTrackBank();
final IPadGrid padGrid = this.surface.getPadGrid();
for (int i = 0; i < 8; i++) padGrid.light(44 + i, tb.getItem(i).isSelected() ? BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE : BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
final Optional<ITrack> sel = tb.getSelectedItem();
padGrid.light(36, sel.isPresent() && sel.get().isActivated() ? BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED : BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
padGrid.light(37, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
padGrid.light(38, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
padGrid.light(39, BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED);
padGrid.light(40, BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED);
padGrid.light(41, BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
padGrid.light(42, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
padGrid.light(43, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
}
use of de.mossgrabers.framework.controller.grid.IPadGrid in project DrivenByMoss by git-moss.
the class AbstractDrumView method drawPages.
/**
* Draw the edit pages / loop area of the sequencer.
*
* @param clip The clip
* @param isActive Is there an active clip?
*/
protected void drawPages(final INoteClip clip, final boolean isActive) {
final boolean isAccentActive = this.configuration.isAccentActive();
if (isAccentActive) {
int selectedVelocityPad = 15 - this.configuration.getFixedAccentValue() / 8;
final int selY = selectedVelocityPad / 4;
final int selX = selectedVelocityPad % 4;
selectedVelocityPad = selY * 4 + 3 - selX;
final IPadGrid padGrid = this.surface.getPadGrid();
for (int pad = 0; pad < 16; pad++) {
final int x = this.playColumns + pad % this.playColumns;
final int y = this.sequencerLines + pad / this.playColumns;
padGrid.lightEx(x, y, pad == selectedVelocityPad ? MaschineColorManager.COLOR_GREEN : MaschineColorManager.COLOR_LIME_LO);
}
return;
}
final int step = clip.getCurrentStep();
final int lengthOfOnePad = this.getLengthOfOnePage(this.sequencerSteps);
final double loopStart = clip.getLoopStart();
final int loopStartPad = (int) Math.ceil(loopStart / lengthOfOnePad);
final int loopEndPad = (int) Math.ceil((loopStart + clip.getLoopLength()) / lengthOfOnePad);
final int currentPage = step / this.sequencerSteps;
final int numOfPages = this.getNumberOfAvailablePages();
final IPadGrid padGrid = this.surface.getPadGrid();
for (int pad = 0; pad < numOfPages; pad++) {
final int x = this.playColumns + pad % this.playColumns;
final int y = this.sequencerLines + pad / this.playColumns;
padGrid.lightEx(x, y, isActive ? this.getPageColor(loopStartPad, loopEndPad, currentPage, clip.getEditPage(), pad) : AbstractSequencerView.COLOR_NO_CONTENT);
}
}
Aggregations