use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class SequencerView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final PadGrid 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.pressedKeys[i] > 0 || this.selectedPad == i - 36 ? BeatstepColors.BEATSTEP_BUTTON_STATE_PINK : this.model.getColorManager().getColor(this.scales.getColor(this.noteMap, i)));
}
} else {
final ICursorClip clip = this.getClip();
// Paint the sequencer steps
final int step = clip.getCurrentStep();
final int hiStep = this.isInXRange(step) ? step % SequencerView.NUM_DISPLAY_COLS : -1;
for (int col = 0; col < SequencerView.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 PushControllerSetup method updateButtons.
private void updateButtons() {
final ITransport t = this.model.getTransport();
final PushControlSurface surface = this.getSurface();
surface.updateButton(PushControlSurface.PUSH_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_PLAY, t.isPlaying() ? PushColors.PUSH_BUTTON_STATE_PLAY_HI : PushColors.PUSH_BUTTON_STATE_PLAY_ON);
final boolean isShift = surface.isShiftPressed();
final boolean isFlipRecord = this.configuration.isFlipRecord();
final boolean isRecordShifted = isShift && !isFlipRecord || !isShift && isFlipRecord;
if (isRecordShifted)
surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingClipLauncherAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
else
surface.updateButton(PushControlSurface.PUSH_BUTTON_AUTOMATION, t.isWritingArrangerAutomation() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_RECORD, isRecordShifted ? t.isLauncherOverdub() ? PushColors.PUSH_BUTTON_STATE_OVR_HI : PushColors.PUSH_BUTTON_STATE_OVR_ON : t.isRecording() ? PushColors.PUSH_BUTTON_STATE_REC_HI : PushColors.PUSH_BUTTON_STATE_REC_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, this.configuration.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
final PushConfiguration config = surface.getConfiguration();
if (this.isPush2) {
final ModeManager modeManager = surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER)) {
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel layer = cd.getSelectedLayerOrDrumPad();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, layer != null && layer.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, layer != null && layer.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
} else {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = modeManager.isActiveMode(Modes.MODE_MASTER) ? this.model.getMasterTrack() : tb.getSelectedTrack();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, selTrack != null && selTrack.isMute() ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, selTrack != null && selTrack.isSolo() ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
}
surface.updateButton(PushControlSurface.PUSH_BUTTON_CONVERT, this.model.canConvertClip() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
} else {
final boolean isMuteState = config.isMuteState();
surface.updateButton(PushControlSurface.PUSH_BUTTON_MUTE, isMuteState ? PushColors.PUSH_BUTTON_STATE_MUTE_HI : PushColors.PUSH_BUTTON_STATE_MUTE_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SOLO, !isMuteState ? PushColors.PUSH_BUTTON_STATE_SOLO_HI : PushColors.PUSH_BUTTON_STATE_SOLO_ON);
}
final ViewManager viewManager = surface.getViewManager();
final boolean isSessionView = Views.isSessionView(viewManager.getActiveViewId());
surface.updateButton(PushControlSurface.PUSH_BUTTON_NOTE, isSessionView ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_HI);
if (this.host.hasClips()) {
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) ? PushColors.PUSH_BUTTON_STATE_STOP_HI : PushColors.PUSH_BUTTON_STATE_STOP_ON);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, isSessionView ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
} else {
surface.updateButton(PushControlSurface.PUSH_BUTTON_CLIP_STOP, ColorManager.BUTTON_STATE_OFF);
surface.updateButton(PushControlSurface.PUSH_BUTTON_SESSION, ColorManager.BUTTON_STATE_OFF);
}
surface.updateButton(PushControlSurface.PUSH_BUTTON_ACCENT, config.isAccentActive() ? ColorManager.BUTTON_STATE_HI : ColorManager.BUTTON_STATE_ON);
final View activeView = viewManager.getActiveView();
if (activeView != null) {
((PushCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
((SceneView) activeView).updateSceneButtons();
}
final ICursorClip clip = activeView instanceof AbstractSequencerView && !(activeView instanceof ClipView) ? ((AbstractSequencerView<?, ?>) activeView).getClip() : null;
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_LEFT, clip != null && clip.canScrollStepsBackwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
surface.updateButton(PushControlSurface.PUSH_BUTTON_DEVICE_RIGHT, clip != null && clip.canScrollStepsForwards() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class DrumView8 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 % DrumView8.NUM_DISPLAY_COLS : -1;
for (int sound = 0; sound < 8; sound++) {
for (int col = 0; col < DrumView8.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;
y += sound;
padGrid.lightEx(x, 7 - y, isSet > 0 ? hilite ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO : LaunchpadColors.LAUNCHPAD_COLOR_BLUE_HI : hilite ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
}
}
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class AbstractDrumView method drawSequencer.
/**
* Draw the clip loop and sequencer steps area.
*/
private void drawSequencer() {
final ICursorClip clip = this.getClip();
// Clip length/loop area
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.halfColumns * this.playLines;
final PadGrid padGrid = this.surface.getPadGrid();
for (int pad = 0; pad < numOfPages; pad++) {
final int x = this.halfColumns + pad % this.halfColumns;
final int y = this.sequencerLines + pad / this.halfColumns;
padGrid.lightEx(x, y, this.getPageColor(loopStartPad, loopEndPad, currentPage, clip.getEditPage(), pad));
}
// Paint the sequencer steps
final int hiStep = this.isInXRange(step) ? step % this.sequencerSteps : -1;
for (int col = 0; col < this.sequencerSteps; col++) {
final int isSet = clip.getStep(col, this.offsetY + this.selectedPad);
final boolean hilite = col == hiStep;
final int x = col % GRID_COLUMNS;
final int y = col / GRID_COLUMNS;
padGrid.lightEx(x, y, this.getStepColor(isSet, hilite));
}
}
use of de.mossgrabers.framework.daw.ICursorClip in project DrivenByMoss by git-moss.
the class AbstractDrumView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (!this.model.canSelectedTrackHoldNotes())
return;
final int index = note - DRUM_START_KEY;
final int x = index % GRID_COLUMNS;
final int y = index / GRID_COLUMNS;
// Sequencer steps
final ICursorClip clip = this.getClip();
if (y >= this.playLines) {
if (velocity != 0) {
final int col = GRID_COLUMNS * (this.allLines - 1 - y) + x;
clip.toggleStep(col, this.offsetY + this.selectedPad, this.configuration.isAccentActive() ? this.configuration.getFixedAccentValue() : velocity);
}
return;
}
// halfColumns x playLines Drum Pad Grid
if (x < this.halfColumns) {
this.selectedPad = this.halfColumns * y + x;
final int playedPad = velocity == 0 ? -1 : this.selectedPad;
// Mark selected note
this.pressedKeys[this.offsetY + this.selectedPad] = velocity;
this.playNote(this.offsetY + this.selectedPad, velocity);
if (playedPad < 0)
return;
this.handleButtonCombinations(playedPad);
return;
}
// Clip length/loop area
final int pad = (this.playLines - 1 - y) * this.halfColumns + x - this.halfColumns;
// 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 {
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.sequencerSteps);
// Set a new loop between the 2 selected pads
final int newStart = start * lengthOfOnePad;
clip.setLoopStart(newStart);
clip.setLoopLength((end - start) * lengthOfOnePad);
clip.setPlayRange(newStart, (double) end * lengthOfOnePad);
}
this.loopPadPressed = -1;
}
Aggregations