use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class AbstractSequencerView method isInXRange.
/**
* Checks if the given number is in the current display.
*
* @param x The index to check
* @return True if it should be displayed
*/
protected boolean isInXRange(final int x) {
final ICursorClip clip = this.getClip();
final int stepSize = clip.getNumSteps();
final int start = clip.getEditPage() * stepSize;
return x >= start && x < start + stepSize;
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class AbstractSequencerView method onActivate.
/**
* {@inheritDoc}
*/
@Override
public void onActivate() {
super.onActivate();
final ICursorClip clip = this.getClip();
clip.enableObservers(true);
clip.setStepLength(RESOLUTIONS[this.selectedIndex]);
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class PlayView method drawDrumGrid.
/**
* 'Draw' the drum grid sequencer.
*/
public void drawDrumGrid() {
if (!this.model.canSelectedTrackHoldNotes()) {
for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
for (int i = 0; i < 8; i++) this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + i, SLControlSurface.MKII_BUTTON_STATE_OFF);
return;
}
if (this.isPlayMode) {
final ICursorDevice primary = this.model.getPrimaryDevice();
final boolean hasDrumPads = primary.hasDrumPads();
boolean isSoloed = false;
if (hasDrumPads) {
for (int i = 0; i < 16; i++) {
if (primary.getDrumPad(i).isSolo()) {
isSoloed = true;
break;
}
}
}
for (int y = 0; y < 2; y++) {
for (int x = 0; x < 8; x++) {
final int index = 8 * y + x;
final int color = this.getPadColor(index, primary, isSoloed);
if (y == 0)
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + x, color);
else
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + x, color);
}
}
} else {
final ICursorClip clip = this.getClip();
// Paint the sequencer steps
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % PlayView.NUM_DISPLAY_COLS : -1;
for (int col = 0; col < PlayView.NUM_DISPLAY_COLS; col++) {
final int isSet = clip.getStep(col, this.offsetY + this.selectedPad);
final boolean hilite = col == hiStep;
final int x = col % 8;
final double y = col / 8.0;
final int color = isSet > 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : hilite ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
if (y == 0)
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW3_1 + x, color);
else
this.surface.updateButton(SLControlSurface.MKII_BUTTON_ROW4_1 + x, color);
}
}
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class SequencerView method onGridNoteLongPress.
/**
* {@inheritDoc}
*/
@Override
public void onGridNoteLongPress(final int note) {
if (!this.model.canSelectedTrackHoldNotes())
return;
this.surface.setGridNoteConsumed(note);
final int index = note - 36;
final int y = index / 8;
if (y >= this.numSequencerRows)
return;
// TODO Bugfix required - setStep makes Bitwig hang
// https://github.com/teotigraphix/Framework4Bitwig/issues/124
final int x = index % 8;
final ICursorClip cursorClip = this.model.getCursorClip(8, 128);
final int state = cursorClip.getStep(x, this.noteMap[y]);
final ModeManager modeManager = this.surface.getModeManager();
final NoteMode noteMode = (NoteMode) modeManager.getMode(Modes.MODE_NOTE);
noteMode.setValues(cursorClip, x, note, state == 2 ? 1.0 : 0, 127);
modeManager.setActiveMode(Modes.MODE_NOTE);
}
Aggregations