use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class DrumView method updateSceneButtons.
/**
* {@inheritDoc}
*/
@Override
public void updateSceneButtons() {
final boolean isKeyboardEnabled = this.model.canSelectedTrackHoldNotes();
for (int i = 0; i < 8; i++) this.surface.updateButton(APCminiControlSurface.APC_BUTTON_SCENE_BUTTON1 + i, isKeyboardEnabled && i == 7 - this.selectedIndex ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
final int octave = this.scales.getDrumOctave();
this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON1, octave < Scales.DRUM_OCTAVE_UPPER ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON2, octave > Scales.DRUM_OCTAVE_LOWER ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
final ICursorClip clip = this.getClip();
this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON3, clip != null && clip.canScrollStepsBackwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON4, clip != null && clip.canScrollStepsForwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
for (int i = 0; i < 4; i++) this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON5 + i, APCminiControlSurface.APC_BUTTON_STATE_OFF);
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class SequencerView method updateSceneButtons.
/**
* {@inheritDoc}
*/
@Override
public void updateSceneButtons() {
final boolean isKeyboardEnabled = this.model.canSelectedTrackHoldNotes();
for (int i = 0; i < 8; i++) this.surface.updateButton(APCminiControlSurface.APC_BUTTON_SCENE_BUTTON1 + i, isKeyboardEnabled && i == 7 - this.selectedIndex ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
final int octave = this.scales.getOctave();
this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON1, octave < Scales.OCTAVE_RANGE ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON2, octave > -Scales.OCTAVE_RANGE ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
final ICursorClip clip = this.getClip();
this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON3, clip != null && clip.canScrollStepsBackwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON4, clip != null && clip.canScrollStepsForwards() ? APCminiControlSurface.APC_BUTTON_STATE_ON : APCminiControlSurface.APC_BUTTON_STATE_OFF);
for (int i = 0; i < 4; i++) this.surface.updateButton(APCminiControlSurface.APC_BUTTON_TRACK_BUTTON5 + i, APCminiControlSurface.APC_BUTTON_STATE_OFF);
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class DrumView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final PadGrid padGrid = this.surface.getPadGrid();
if (!this.model.canSelectedTrackHoldNotes()) {
padGrid.turnOff();
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;
padGrid.lightEx(x, y, this.getPadColor(index, primary, isSoloed));
}
}
} else {
final ICursorClip clip = this.getClip();
// Paint the sequencer steps
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % DrumView.NUM_DISPLAY_COLS : -1;
for (int col = 0; col < DrumView.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 int y = col / 8;
padGrid.lightEx(x, 1 - y, isSet > 0 ? hilite ? BeatstepColors.BEATSTEP_BUTTON_STATE_PINK : BeatstepColors.BEATSTEP_BUTTON_STATE_BLUE : hilite ? BeatstepColors.BEATSTEP_BUTTON_STATE_PINK : BeatstepColors.BEATSTEP_BUTTON_STATE_OFF);
}
}
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class AbstractNoteSequencerView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (!this.model.canSelectedTrackHoldNotes())
return;
final int index = note - 36;
final int x = index % 8;
final int y = index / 8;
final ICursorClip clip = this.getClip();
if (y < this.numSequencerRows) {
if (velocity != 0)
clip.toggleStep(x, this.noteMap[y], this.configuration.isAccentActive() ? this.configuration.getFixedAccentValue() : velocity);
return;
}
// Clip length/loop area
final int pad = x;
// Button pressed?
if (velocity > 0) {
// Not yet a button pressed, store it
if (this.loopPadPressed == -1)
this.loopPadPressed = pad;
return;
}
if (this.loopPadPressed == -1)
return;
if (pad == this.loopPadPressed && pad != clip.getEditPage()) {
// Only single pad pressed -> page selection
clip.scrollToPage(pad);
} else {
// Set a new loop between the 2 selected pads
final int start = this.loopPadPressed < pad ? this.loopPadPressed : pad;
final int end = (this.loopPadPressed < pad ? pad : this.loopPadPressed) + 1;
final int lengthOfOnePad = this.getLengthOfOnePage(this.numDisplayCols);
final double newStart = start * lengthOfOnePad;
clip.setLoopStart(newStart);
clip.setLoopLength((end - start) * lengthOfOnePad);
clip.setPlayRange(newStart, (double) end * lengthOfOnePad);
}
this.loopPadPressed = -1;
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class DrumView4 method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final PadGrid padGrid = this.surface.getPadGrid();
if (!this.model.canSelectedTrackHoldNotes()) {
padGrid.turnOff();
return;
}
// Clip length/loop area
final ICursorClip clip = this.getClip();
final int step = clip.getCurrentStep();
// Paint the sequencer steps
final int hiStep = this.isInXRange(step) ? step % DrumView4.NUM_DISPLAY_COLS : -1;
for (int sound = 0; sound < 4; sound++) {
for (int col = 0; col < DrumView4.NUM_DISPLAY_COLS; col++) {
final int isSet = clip.getStep(col, this.offsetY + this.selectedPad + sound + this.soundOffset);
final boolean hilite = col == hiStep;
final int x = col % 8;
int y = col / 8;
if (col < 8)
y += 5;
y += sound;
padGrid.lightEx(x, 8 - y, isSet > 0 ? hilite ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO : LaunchpadColors.LAUNCHPAD_COLOR_BLUE_HI : hilite ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
}
}
}
Aggregations