use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class LaunchpadControllerSetup method updateIndication.
private void updateIndication() {
final ViewManager viewManager = this.getSurface().getViewManager();
final boolean isVolume = viewManager.isActiveView(Views.VIEW_VOLUME);
final boolean isPan = viewManager.isActiveView(Views.VIEW_PAN);
final boolean isSends = viewManager.isActiveView(Views.VIEW_SENDS);
final boolean isDevice = viewManager.isActiveView(Views.VIEW_DEVICE);
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final View view = viewManager.getActiveView();
final int selSend = view instanceof SendsView ? ((SendsView) view).getSelectedSend() : -1;
final boolean isSession = view instanceof SessionView && !isVolume && !isPan && !isSends;
final boolean isEffect = this.model.isEffectTrackBankActive();
tb.setIndication(!isEffect && isSession);
tbe.setIndication(isEffect && isSession);
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect && isVolume);
track.setPanIndication(!isEffect && isPan);
for (int j = 0; j < 8; j++) track.getSend(j).setIndication(!isEffect && isSends && selSend == j);
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect && isVolume);
fxTrack.setPanIndication(isEffect && isPan);
cursorDevice.indicateParameter(i, isDevice);
}
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerMode method onSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void onSecondRow(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final PushConfiguration config = this.surface.getConfiguration();
if (!this.isPush2 || config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
final ICursorDevice cd = this.model.getCursorDevice();
final int offset = getDrumPadIndex(cd);
if (config.isMuteState())
cd.toggleLayerOrDrumPadMute(offset + index);
else
cd.toggleLayerOrDrumPadSolo(offset + index);
return;
}
final ModeManager modeManager = this.surface.getModeManager();
IChannelBank fxTrackBank;
switch(index) {
case 0:
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME);
break;
case 1:
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_PAN))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_PAN);
break;
case 2:
// Not used
break;
case 3:
if (!this.model.isEffectTrackBankActive()) {
// Check if there are more than 4 FX channels
if (!config.isSendsAreToggled()) {
fxTrackBank = this.model.getEffectTrackBank();
if (!fxTrackBank.getTrack(4).doesExist())
return;
}
config.setSendsAreToggled(!config.isSendsAreToggled());
if (!modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER))
modeManager.setActiveMode(Integer.valueOf(Modes.MODE_DEVICE_LAYER_SEND1.intValue() + (config.isSendsAreToggled() ? 4 : 0)));
}
break;
case 7:
this.moveUp();
break;
default:
if (!this.model.isEffectTrackBankActive()) {
final int sendOffset = config.isSendsAreToggled() ? 0 : 4;
final int sendIndex = index - sendOffset;
fxTrackBank = this.model.getEffectTrackBank();
if (fxTrackBank.getTrack(sendIndex).doesExist()) {
final Integer si = Integer.valueOf(Modes.MODE_DEVICE_LAYER_SEND1.intValue() + sendIndex);
if (modeManager.isActiveMode(si))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(si);
}
}
break;
}
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event == ButtonEvent.DOWN)
return;
if (event == ButtonEvent.UP) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.hasSelectedDevice())
return;
final int offset = getDrumPadIndex(cd);
final IChannel layer = cd.getLayerOrDrumPad(offset + index);
if (!layer.doesExist())
return;
final int layerIndex = layer.getIndex();
if (!layer.isSelected()) {
cd.selectLayerOrDrumPad(layerIndex);
return;
}
cd.enterLayerOrDrumPad(layer.getIndex());
cd.selectFirstDeviceInLayerOrDrumPad(layer.getIndex());
final ModeManager modeManager = this.surface.getModeManager();
modeManager.setActiveMode(Modes.MODE_DEVICE_PARAMS);
((DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS)).setShowDevices(true);
return;
}
// LONG press
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_ROW1_1 + index);
this.moveUp();
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerMode method moveUp.
/**
* Move up the hierarchy.
*/
protected void moveUp() {
// There is no device on the track move upwards to the track view
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.hasSelectedDevice()) {
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
return;
}
final ModeManager modeManager = this.surface.getModeManager();
modeManager.setActiveMode(Modes.MODE_DEVICE_PARAMS);
cd.selectChannel();
((DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS)).setShowDevices(true);
}
use of de.mossgrabers.framework.daw.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerMode method onValueKnob.
/**
* {@inheritDoc}
*/
@Override
public void onValueKnob(final int index, final int value) {
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel selectedDeviceLayer = cd.getSelectedLayerOrDrumPad();
if (selectedDeviceLayer == null)
return;
switch(index) {
case 0:
cd.changeLayerOrDrumPadVolume(selectedDeviceLayer.getIndex(), value);
break;
case 1:
cd.changeLayerOrDrumPadPan(selectedDeviceLayer.getIndex(), value);
break;
default:
if (this.isPush2 && index < 4)
break;
final int sendIndex = index - (this.isPush2 ? this.surface.getConfiguration().isSendsAreToggled() ? 0 : 4 : 2);
cd.changeLayerOrDrumPadSend(selectedDeviceLayer.getIndex(), sendIndex, value);
break;
}
}
Aggregations