use of de.mossgrabers.framework.daw.data.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 || !this.model.hasSelectedDevice())
return;
final ICursorDevice cd = this.model.getCursorDevice();
final IChannelBank<ILayer> bank = cd.getLayerBank();
final Optional<ILayer> sel = bank.getSelectedItem();
switch(note - 36) {
// Toggle device on/off
case 0:
cd.toggleEnabledState();
break;
// Device Left
case 1:
if (this.isLayer) {
int index = 0;
if (sel.isPresent()) {
final int idx = sel.get().getIndex();
index = idx - 1;
}
if (index >= 0)
bank.getItem(index).select();
} else
cd.selectPrevious();
break;
// Device Right
case 2:
if (this.isLayer) {
final int index = sel.isEmpty() ? 0 : sel.get().getIndex() + 1;
bank.getItem(index > 7 ? 7 : index).select();
} else
cd.selectNext();
break;
// Enter layer
case 3:
if (!cd.hasLayers())
return;
if (this.isLayer) {
if (sel.isPresent())
sel.get().enter();
} else if (sel.isEmpty())
bank.getItem(0).select();
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.getParameterBank().scrollBackwards();
break;
// Param bank page up
case 7:
cd.getParameterBank().scrollForwards();
break;
default:
cd.getParameterPageBank().selectPage(note - 36 - 8);
break;
}
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceView method onKnob.
/**
* {@inheritDoc}
*/
@Override
public void onKnob(final int index, final int value, final boolean isTurnedRight) {
final ICursorDevice cd = this.model.getCursorDevice();
if (index < 8) {
this.extensions.onTrackKnob(index, value, isTurnedRight);
return;
}
cd.getParameterBank().getItem(index - 8).changeValue(value);
}
use of de.mossgrabers.framework.daw.data.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;
int viewIndex;
IView view;
final ICursorDevice cursorDevice = this.model.getCursorDevice();
switch(note - 36) {
// Play
case 0:
this.playCommand.executeNormal(ButtonEvent.UP);
break;
// Record
case 1:
this.model.getTransport().startRecording();
break;
// Repeat
case 2:
this.model.getTransport().toggleLoop();
break;
// Click
case 3:
this.model.getTransport().toggleMetronome();
break;
// Tap Tempo
case 4:
this.model.getTransport().tapTempo();
break;
// Insert device before current
case 5:
this.model.getBrowser().insertBeforeCursorDevice();
break;
// Insert device after current
case 6:
this.model.getBrowser().insertAfterCursorDevice();
break;
// Open the browser
case 7:
this.model.getBrowser().replace(cursorDevice);
break;
// Toggle window of VSTs
case 15:
cursorDevice.toggleWindowOpen();
break;
default:
viewIndex = note - 44;
if (viewIndex < 0 || viewIndex >= 6)
return;
final ViewManager viewManager = this.surface.getViewManager();
final Views viewId = VIEWS[viewIndex];
viewManager.setPreviousID(viewId);
view = viewManager.get(viewId);
this.surface.getDisplay().notify(view.getName());
break;
}
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class SelectDeviceViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final ViewManager viewManager = this.surface.getViewManager();
if (this.surface.isPro() && this.surface.isShiftPressed()) {
if (viewManager.isActive(Views.SHIFT))
viewManager.restore();
viewManager.setTemporary(Views.TEMPO);
this.surface.getDisplay().notify(viewManager.getActive().getName());
return;
}
final IBrowser browser = this.model.getBrowser();
if (viewManager.isActive(Views.BROWSER)) {
browser.stopBrowsing(false);
viewManager.setActive(Views.DEVICE);
this.surface.getDisplay().notify(viewManager.getActive().getName());
return;
}
if (viewManager.isActive(Views.DEVICE)) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (this.surface.isShiftPressed() || !cursorDevice.doesExist())
browser.insertAfterCursorDevice();
else
browser.replace(cursorDevice);
return;
}
viewManager.setActive(Views.DEVICE);
this.surface.getDisplay().notify(viewManager.getActive().getName());
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerRightCommand method canExecute.
/**
* Check if the command can be executed.
*
* @return True if it can
*/
public boolean canExecute() {
if (this.surface.isShiftPressed())
return true;
final ICursorDevice cd = this.model.getCursorDevice();
final IChannelBank<ILayer> bank = cd.getLayerBank();
final Optional<ILayer> layer = bank.getSelectedItem();
return cd.hasLayers() && layer.isPresent() ? bank.canScrollForwards() : cd.canSelectNextFX();
}
Aggregations