use of de.mossgrabers.push.PushConfiguration in project DrivenByMoss by git-moss.
the class RibbonMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1() {
final Display d = this.surface.getDisplay();
final PushConfiguration config = this.surface.getConfiguration();
final String ribbonModeCC = Integer.toString(config.getRibbonModeCCVal());
final int ribbonMode = config.getRibbonMode();
d.clear().setCell(0, 0, "Modulatn").setCell(0, 1, "Expressn").setCell(0, 2, "Volume").setCell(0, 3, "Sustain").setCell(0, 7, "Midi CC");
d.setCell(1, 7, ribbonModeCC).setCell(3, 0, (ribbonMode == PushConfiguration.RIBBON_MODE_PITCH ? PushDisplay.RIGHT_ARROW : "") + "Pitchbd").setCell(3, 1, (ribbonMode == PushConfiguration.RIBBON_MODE_CC ? PushDisplay.RIGHT_ARROW : "") + "CC").setCell(3, 2, (ribbonMode == PushConfiguration.RIBBON_MODE_CC_PB ? PushDisplay.RIGHT_ARROW : "") + "CC/Pitch").setCell(3, 3, (ribbonMode == PushConfiguration.RIBBON_MODE_PB_CC ? PushDisplay.RIGHT_ARROW : "") + "Pitch/CC").setCell(3, 4, (ribbonMode == PushConfiguration.RIBBON_MODE_FADER ? PushDisplay.RIGHT_ARROW : "") + "Fader").allDone();
}
use of de.mossgrabers.push.PushConfiguration 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.push.PushConfiguration 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.push.PushConfiguration 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.push.PushConfiguration in project DrivenByMoss by git-moss.
the class DeviceLayerMode method updateSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void updateSecondRow() {
final ICursorDevice cd = this.model.getCursorDevice();
final PushConfiguration config = this.surface.getConfiguration();
final boolean muteState = config.isMuteState();
if (this.isPush2) {
if (config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
// Drum Pad Bank has size of 16, layers only 8
final int offset = getDrumPadIndex(cd);
for (int i = 0; i < 8; i++) {
final IChannel layer = cd.getLayerOrDrumPad(offset + i);
int color = PushColors.PUSH2_COLOR_BLACK;
if (layer.doesExist()) {
if (muteState) {
if (layer.isMute())
color = PushColors.PUSH2_COLOR2_AMBER_LO;
} else if (layer.isSolo())
color = PushColors.PUSH2_COLOR2_YELLOW_HI;
}
this.surface.updateButton(102 + i, color);
}
return;
}
final ModeManager modeManager = this.surface.getModeManager();
this.surface.updateButton(102, modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(103, modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_PAN) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(104, PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(105, PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(106, modeManager.isActiveMode(config.isSendsAreToggled() ? Modes.MODE_DEVICE_LAYER_SEND5 : Modes.MODE_DEVICE_LAYER_SEND1) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(107, modeManager.isActiveMode(config.isSendsAreToggled() ? Modes.MODE_DEVICE_LAYER_SEND6 : Modes.MODE_DEVICE_LAYER_SEND2) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(108, modeManager.isActiveMode(config.isSendsAreToggled() ? Modes.MODE_DEVICE_LAYER_SEND7 : Modes.MODE_DEVICE_LAYER_SEND3) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(109, modeManager.isActiveMode(config.isSendsAreToggled() ? Modes.MODE_DEVICE_LAYER_SEND8 : Modes.MODE_DEVICE_LAYER_SEND4) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
return;
}
if (cd == null || !cd.hasLayers()) {
this.disableSecondRow();
this.surface.updateButton(109, this.isPush2 ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH1_COLOR2_WHITE);
return;
}
final int offset = getDrumPadIndex(cd);
for (int i = 0; i < 8; i++) {
final IChannel dl = cd.getLayerOrDrumPad(offset + i);
int color = PushColors.PUSH1_COLOR_BLACK;
if (dl.doesExist()) {
if (muteState) {
if (!dl.isMute())
color = PushColors.PUSH1_COLOR2_YELLOW_HI;
} else
color = dl.isSolo() ? PushColors.PUSH1_COLOR2_BLUE_HI : PushColors.PUSH1_COLOR2_GREY_LO;
}
this.surface.updateButton(102 + i, color);
}
}
Aggregations