use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class APCControllerSetup method updateDeviceKnobs.
private void updateDeviceKnobs() {
final APCControlSurface surface = this.getSurface();
final View view = surface.getViewManager().getActiveView();
if (view == null)
return;
final ICursorDevice cd = this.model.getCursorDevice();
for (int i = 0; i < 8; i++) {
final Integer deviceKnobCommand = Integer.valueOf(Commands.CONT_COMMAND_DEVICE_KNOB1.intValue() + i);
if (!((DeviceKnobRowCommand) view.getContinuousCommand(deviceKnobCommand)).isKnobMoving())
surface.setLED(APCControlSurface.APC_KNOB_DEVICE_KNOB_1 + i, cd.getFXParam(i).getValue());
}
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class ShiftView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
final ICursorDevice cursorDevice = this.model.getCursorDevice();
switch(note) {
// Flip views
case 56:
this.surface.getViewManager().setPreviousView(Views.VIEW_SESSION);
this.surface.getDisplay().notify("Session");
break;
case 57:
this.surface.getViewManager().setPreviousView(Views.VIEW_PLAY);
this.surface.getDisplay().notify("Play");
break;
case 58:
this.surface.getViewManager().setPreviousView(Views.VIEW_DRUM);
this.surface.getDisplay().notify("Drum");
break;
case 59:
this.surface.getViewManager().setPreviousView(Views.VIEW_SEQUENCER);
this.surface.getDisplay().notify("Sequencer");
break;
case 60:
this.surface.getViewManager().setPreviousView(Views.VIEW_RAINDROPS);
this.surface.getDisplay().notify("Raindrops");
break;
// Last row transport
case 63:
this.playCommand.executeNormal(ButtonEvent.DOWN);
this.surface.getDisplay().notify("Start/Stop");
break;
case 55:
this.model.getTransport().record();
this.surface.getDisplay().notify("Record");
break;
case 47:
this.model.getTransport().toggleLoop();
this.surface.getDisplay().notify("Toggle Loop");
break;
case 39:
this.model.getTransport().toggleMetronome();
this.surface.getDisplay().notify("Toggle Click");
break;
// Navigation
case 62:
this.onNew();
this.surface.getDisplay().notify("New clip");
break;
case 54:
this.model.getTransport().toggleLauncherOverdub();
this.surface.getDisplay().notify("Toggle Launcher Overdub");
break;
case 46:
this.model.getCursorClip().quantize(this.surface.getConfiguration().getQuantizeAmount() / 100.0);
this.surface.getDisplay().notify("Quantize");
break;
case 38:
this.model.getApplication().undo();
this.surface.getDisplay().notify("Undo");
break;
// Device Parameters up/down
case 24:
cursorDevice.previousParameterPage();
this.surface.getDisplay().notify("Bank: " + cursorDevice.getSelectedParameterPageName());
break;
case 25:
cursorDevice.nextParameterPage();
this.surface.getDisplay().notify("Bank: " + cursorDevice.getSelectedParameterPageName());
break;
// Device up/down
case 32:
cursorDevice.selectPrevious();
this.surface.getDisplay().notify("Device: " + cursorDevice.getName());
break;
case 33:
cursorDevice.selectNext();
this.surface.getDisplay().notify("Device: " + cursorDevice.getName());
break;
// Change the scale
case 35:
this.scales.prevScale();
final String name = this.scales.getScale().getName();
this.surface.getConfiguration().setScale(name);
this.surface.getDisplay().notify(name);
break;
case 36:
this.scales.nextScale();
final String name2 = this.scales.getScale().getName();
this.surface.getConfiguration().setScale(name2);
this.surface.getDisplay().notify(name2);
break;
case 27:
this.scales.toggleChromatic();
this.surface.getDisplay().notify(this.scales.isChromatic() ? "Chromatc" : "In Key");
break;
// Scale Base note selection
default:
if (note > 15)
return;
final int pos = TRANSLATE[note];
if (pos == -1)
return;
this.scales.setScaleOffset(pos);
this.surface.getConfiguration().setScaleBase(Scales.BASES[pos]);
this.surface.getDisplay().notify(Scales.BASES[pos]);
this.surface.getViewManager().getActiveView().updateNoteMapping();
break;
}
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class APCminiControllerSetup method updateIndication.
private void updateIndication(final Integer mode) {
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final APCminiControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final boolean isShiftView = viewManager.isActiveView(Views.VIEW_SHIFT);
final boolean isSession = viewManager.isActiveView(Views.VIEW_SESSION) || isShiftView;
final boolean isEffect = this.model.isEffectTrackBankActive();
final boolean isPan = Modes.MODE_PAN.equals(mode);
final boolean isDevice = Modes.MODE_DEVICE.equals(mode);
tb.setIndication(!isEffect && isSession);
tbe.setIndication(isEffect && isSession);
final ICursorDevice cursorDevice = this.model.getCursorDevice();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect);
track.setPanIndication(!isEffect && isPan);
for (int j = 0; j < 8; j++) track.getSend(j).setIndication(!isEffect && (Modes.MODE_SEND1.equals(mode) && j == 0 || Modes.MODE_SEND2.equals(mode) && j == 1 || Modes.MODE_SEND3.equals(mode) && j == 2 || Modes.MODE_SEND4.equals(mode) && j == 3 || Modes.MODE_SEND5.equals(mode) && j == 4 || Modes.MODE_SEND6.equals(mode) && j == 5 || Modes.MODE_SEND7.equals(mode) && j == 6 || Modes.MODE_SEND8.equals(mode) && j == 7));
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect);
fxTrack.setPanIndication(isEffect && isPan);
cursorDevice.indicateParameter(i, isDevice || isShiftView);
}
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
if (!this.model.hasSelectedDevice())
return;
final ICursorDevice cd = this.model.getCursorDevice();
IChannel sel;
int index;
IChannel dl;
int bank;
int offset;
switch(note - 36) {
// Toggle device on/off
case 0:
cd.toggleEnabledState();
break;
// Device Left
case 1:
if (this.isLayer) {
sel = cd.getSelectedLayer();
index = sel == null || sel.getIndex() == 0 ? 0 : sel.getIndex() - 1;
cd.selectLayer(index);
} else
cd.selectPrevious();
break;
// Device Right
case 2:
if (this.isLayer) {
sel = cd.getSelectedLayer();
index = sel == null ? 0 : sel.getIndex() + 1;
cd.selectLayer(index > 7 ? 7 : index);
} else
cd.selectNext();
break;
// Enter layer
case 3:
if (!cd.hasLayers())
return;
dl = cd.getSelectedLayerOrDrumPad();
if (this.isLayer) {
if (dl != null) {
cd.enterLayerOrDrumPad(dl.getIndex());
cd.selectFirstDeviceInLayerOrDrumPad(dl.getIndex());
}
} else if (dl == null)
cd.selectLayerOrDrumPad(0);
this.isLayer = !this.isLayer;
break;
// Exit layer
case 4:
if (this.isLayer)
this.isLayer = false;
else {
if (cd.isNested()) {
cd.selectParent();
cd.selectChannel();
this.isLayer = true;
}
}
break;
case 5:
// Intentionally empty
break;
// Param bank down
case 6:
cd.setSelectedParameterPage(Math.max(cd.getSelectedParameterPage() - 8, 0));
break;
// Param bank page up
case 7:
cd.setSelectedParameterPage(Math.min(cd.getSelectedParameterPage() + 8, cd.getParameterPageNames().length - 1));
break;
default:
bank = note - 36 - 8;
offset = cd.getSelectedParameterPage() / 8 * 8;
cd.setSelectedParameterPage(offset + bank);
break;
}
}
use of de.mossgrabers.framework.daw.ICursorDevice 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);
}
}
}
Aggregations