use of de.mossgrabers.framework.daw.data.IDrumDevice in project DrivenByMoss by git-moss.
the class ControlView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ILightGuide lightGuide = this.surface.getLightGuide();
if (this.model.getHost().supports(Capability.HAS_DRUM_DEVICE) && this.model.canSelectedTrackHoldNotes()) {
final IDrumDevice primary = this.model.getDrumDevice();
if (primary.hasDrumPads()) {
final boolean isRecording = this.model.hasRecordingState();
for (int i = this.scales.getStartNote(); i < this.scales.getEndNote(); i++) lightGuide.light(i, this.getDrumPadColor(i, primary, isRecording));
return;
}
}
this.drawLightGuide(lightGuide);
}
use of de.mossgrabers.framework.daw.data.IDrumDevice 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.daw.data.IDrumDevice in project DrivenByMoss by git-moss.
the class Drum64View method handleSelectButton.
/**
* {@inheritDoc}
*/
@Override
protected void handleSelectButton(final int playedPad) {
// Do we have drum pads?
final IDrumDevice primary = this.model.getDrumDevice64();
if (!primary.hasDrumPads())
return;
final ICursorDevice cd = this.model.getCursorDevice();
final boolean isNested = cd.isNested();
if (isNested) {
// We have to move up to compare the main drum devices
cd.selectParent();
}
// Can only scroll to the channel if the cursor device is the primary device
if (primary.getPosition() != cd.getPosition())
return;
// Align the primary and cursor device drum bank view
final IDrumPadBank drumPadBank = primary.getDrumPadBank();
final int scrollPos = drumPadBank.getScrollPosition();
final IDrumPadBank cdDrumPadBank = cd.getDrumPadBank();
final int pageSize = cdDrumPadBank.getPageSize();
final int adjustedPage = playedPad / pageSize * pageSize;
cdDrumPadBank.scrollTo(scrollPos + adjustedPage, false);
// Do not reselect, if pad is already selected
final IDrumPad drumPad = drumPadBank.getItem(playedPad);
if (drumPad.isSelected()) {
// If the instrument of the pad was selected for editing, try to select it again
if (isNested) {
final IDrumPad selectedItem = cdDrumPadBank.getItem(playedPad % pageSize);
if (selectedItem != null)
selectedItem.enter();
}
return;
}
// Only activate layer mode if not one of the layer modes is already active
final ModeManager modeManager = this.surface.getModeManager();
if (!Modes.isLayerMode(modeManager.getActiveID()))
modeManager.setActive(Modes.DEVICE_LAYER);
drumPad.select();
}
use of de.mossgrabers.framework.daw.data.IDrumDevice 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.daw.data.IDrumDevice 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;
}
}
}
Aggregations