use of de.mossgrabers.framework.daw.data.IChannel in project DrivenByMoss by git-moss.
the class DeviceRightCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel sel = cd.getSelectedLayer();
if (!cd.hasLayers() || sel == null)
cd.selectNext();
else {
final int index = sel.getIndex() + 1;
cd.selectLayer(index > 7 ? 7 : index);
}
}
use of de.mossgrabers.framework.daw.data.IChannel 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.data.IChannel in project DrivenByMoss by git-moss.
the class DeviceLayerMode method updateDisplayElements.
/**
* Update all 8 elements.
*
* @param message The display message
* @param cd The cursor device
* @param l The channel data
*/
protected void updateDisplayElements(final DisplayMessage message, final ICursorDevice cd, final IChannel l) {
// Drum Pad Bank has size of 16, layers only 8
final int offset = getDrumPadIndex(cd);
// Get the index at which to draw the Sends element
int sendsIndex = l == null ? -1 : l.getIndex() - offset + 1;
if (sendsIndex == 8)
sendsIndex = 6;
final PushConfiguration config = this.surface.getConfiguration();
for (int i = 0; i < 8; i++) {
final IChannel layer = cd.getLayerOrDrumPad(offset + i);
// The menu
String topMenu;
boolean topMenuSelected;
if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
topMenu = layer.doesExist() ? "Mute" : "";
topMenuSelected = layer.isMute();
} else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
topMenu = layer.doesExist() ? "Solo" : "";
topMenuSelected = layer.isSolo();
} else {
topMenu = this.menu[i];
topMenuSelected = i == 7;
}
// Channel info
final String bottomMenu = layer.doesExist() ? layer.getName(12) : "";
final double[] bottomMenuColor = layer.getColor();
final boolean isBottomMenuOn = layer.isSelected();
if (layer.isSelected()) {
final IValueChanger valueChanger = this.model.getValueChanger();
message.addChannelElement(topMenu, topMenuSelected, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue(layer.getVolume()), valueChanger.toDisplayValue(layer.getModulatedVolume()), this.isKnobTouched[0] ? layer.getVolumeStr(8) : "", valueChanger.toDisplayValue(layer.getPan()), valueChanger.toDisplayValue(layer.getModulatedPan()), this.isKnobTouched[1] ? layer.getPanStr(8) : "", valueChanger.toDisplayValue(config.isEnableVUMeters() ? layer.getVu() : 0), layer.isMute(), layer.isSolo(), false, 0);
} else if (sendsIndex == i && l != null) {
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
final String[] sendName = new String[4];
final String[] valueStr = new String[4];
final int[] value = new int[4];
final int[] modulatedValue = new int[4];
final boolean[] selected = new boolean[4];
for (int j = 0; j < 4; j++) {
final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
final int sendPos = sendOffset + j;
final ISend send = l.getSend(sendPos);
sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
final boolean doesExist = send.doesExist();
valueStr[j] = doesExist && this.isKnobTouched[4 + j] ? send.getDisplayedValue() : "";
value[j] = doesExist ? send.getValue() : 0;
modulatedValue[j] = doesExist ? send.getModulatedValue() : 0;
selected[j] = true;
}
message.addSendsElement(topMenu, topMenuSelected, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, cd.getLayerOrDrumPad(offset + i).getColor(), layer.isSelected(), sendName, valueStr, value, modulatedValue, selected, true);
} else
message.addChannelSelectorElement(topMenu, topMenuSelected, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn);
}
}
use of de.mossgrabers.framework.daw.data.IChannel in project DrivenByMoss by git-moss.
the class DeviceLayerMode method updateChannelDisplay.
// Called from sub-classes
protected void updateChannelDisplay(final DisplayMessage message, final ICursorDevice cd, final int selectedMenu, final boolean isVolume, final boolean isPan) {
this.updateMenu();
final PushConfiguration config = this.surface.getConfiguration();
// Drum Pad Bank has size of 16, layers only 8
final int offset = getDrumPadIndex(cd);
final IValueChanger valueChanger = this.model.getValueChanger();
for (int i = 0; i < 8; i++) {
final IChannel layer = cd.getLayerOrDrumPad(offset + i);
// The menu item
String topMenu;
boolean isTopMenuOn;
if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
topMenu = layer.doesExist() ? "Mute" : "";
isTopMenuOn = layer.isMute();
} else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
topMenu = layer.doesExist() ? "Solo" : "";
isTopMenuOn = layer.isSolo();
} else {
topMenu = this.menu[i];
isTopMenuOn = i == 7 || i == selectedMenu - 1;
}
message.addChannelElement(selectedMenu, topMenu, isTopMenuOn, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, cd.getLayerOrDrumPad(offset + i).getColor(), layer.isSelected(), valueChanger.toDisplayValue(layer.getVolume()), valueChanger.toDisplayValue(layer.getModulatedVolume()), isVolume && this.isKnobTouched[i] ? layer.getVolumeStr(8) : "", valueChanger.toDisplayValue(layer.getPan()), valueChanger.toDisplayValue(layer.getModulatedPan()), isPan && this.isKnobTouched[i] ? layer.getPanStr() : "", valueChanger.toDisplayValue(config.isEnableVUMeters() ? layer.getVu() : 0), layer.isMute(), layer.isSolo(), false, 0);
}
}
use of de.mossgrabers.framework.daw.data.IChannel 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