use of de.mossgrabers.push.PushConfiguration in project DrivenByMoss by git-moss.
the class DeviceLayerModeSend method updateDisplayElements.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplayElements(final DisplayMessage message, final ICursorDevice cd, final IChannel l) {
final int sendIndex = this.getCurrentSendIndex();
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
this.updateMenu();
final PushConfiguration config = this.surface.getConfiguration();
// Drum Pad Bank has size of 16, layers only 8
final int offset = getDrumPadIndex(cd);
final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
for (int i = 0; i < 8; i++) {
final IChannel layer = cd.getLayerOrDrumPad(offset + i);
// The menu item
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 > 3 && i - 4 + sendOffset == sendIndex;
}
// Channel info
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 sendPos = sendOffset + j;
final ISend send = layer.getSend(sendPos);
sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
valueStr[j] = send.doesExist() && sendIndex == sendPos && this.isKnobTouched[i] ? send.getDisplayedValue() : "";
value[j] = send.doesExist() ? send.getValue() : 0;
modulatedValue[j] = send.doesExist() ? send.getModulatedValue() : 0;
selected[j] = sendIndex == sendPos;
}
message.addSendsElement(topMenu, topMenuSelected, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, cd.getLayerOrDrumPad(offset + i).getColor(), layer.isSelected(), sendName, valueStr, value, modulatedValue, selected, false);
}
}
use of de.mossgrabers.push.PushConfiguration in project DrivenByMoss by git-moss.
the class AbstractTrackMode method updateSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void updateSecondRow() {
final PushConfiguration config = this.surface.getConfiguration();
final IChannelBank tb = this.model.getCurrentTrackBank();
if (this.isPush2) {
if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
this.surface.updateButton(102 + i, track.doesExist() && track.isPlaying() ? PushColors.PUSH2_COLOR_RED_HI : PushColors.PUSH2_COLOR_BLACK);
}
return;
}
if (config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
final boolean muteState = config.isMuteState();
for (int i = 0; i < 8; i++) this.surface.updateButton(102 + i, this.getTrackStateColor(muteState, tb.getTrack(i)));
return;
}
final ModeManager modeManager = this.surface.getModeManager();
this.surface.updateButton(102, modeManager.isActiveMode(Modes.MODE_VOLUME) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(103, modeManager.isActiveMode(Modes.MODE_PAN) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(104, modeManager.isActiveMode(Modes.MODE_CROSSFADER) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(105, PushColors.PUSH2_COLOR_BLACK);
final boolean sendsAreToggled = config.isSendsAreToggled();
this.surface.updateButton(106, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND5 : Modes.MODE_SEND1) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(107, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND6 : Modes.MODE_SEND2) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(108, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND7 : Modes.MODE_SEND3) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(109, tb instanceof ITrackBank && ((ITrackBank) tb).hasParent() ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
return;
}
final boolean muteState = config.isMuteState();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getTrack(i);
int color = PushColors.PUSH1_COLOR_BLACK;
if (t.doesExist()) {
if (muteState) {
if (!t.isMute())
color = PushColors.PUSH1_COLOR2_YELLOW_HI;
} else
color = t.isSolo() ? PushColors.PUSH1_COLOR2_BLUE_HI : PushColors.PUSH1_COLOR2_GREY_LO;
}
this.surface.updateButton(102 + i, color);
}
}
use of de.mossgrabers.push.PushConfiguration in project DrivenByMoss by git-moss.
the class PitchbendCommand method onPitchbend.
/**
* {@inheritDoc}
*/
@Override
public void onPitchbend(final int channel, final int data1, final int data2) {
// Don't get in the way of configuration
if (this.surface.isShiftPressed())
return;
final PushConfiguration config = this.surface.getConfiguration();
switch(config.getRibbonMode()) {
case PushConfiguration.RIBBON_MODE_PITCH:
this.surface.sendMidiEvent(0xE0, data1, data2);
break;
case PushConfiguration.RIBBON_MODE_CC:
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), data2);
this.pitchValue = data2;
break;
case PushConfiguration.RIBBON_MODE_CC_PB:
if (data2 > 64)
this.surface.sendMidiEvent(0xE0, data1, data2);
else if (data2 < 64)
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 127 - data2 * 2);
else {
this.surface.sendMidiEvent(0xE0, data1, data2);
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
}
break;
case PushConfiguration.RIBBON_MODE_PB_CC:
if (data2 > 64)
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), (data2 - 64) * 2);
else if (data2 < 64)
this.surface.sendMidiEvent(0xE0, data1, data2);
else {
this.surface.sendMidiEvent(0xE0, data1, data2);
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
}
break;
case PushConfiguration.RIBBON_MODE_FADER:
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
if (selTrack != null)
selTrack.setVolume(this.model.getValueChanger().toDAWValue(data2));
return;
}
this.surface.getOutput().sendPitchbend(data1, data2);
}
use of de.mossgrabers.push.PushConfiguration in project DrivenByMoss by git-moss.
the class ScalesMode method update.
private void update() {
this.surface.getViewManager().getActiveView().updateNoteMapping();
final PushConfiguration config = this.surface.getConfiguration();
config.setScale(this.scales.getScale().getName());
config.setScaleBase(Scales.BASES[this.scales.getScaleOffset()]);
config.setScaleInKey(!this.scales.isChromatic());
}
use of de.mossgrabers.push.PushConfiguration in project DrivenByMoss by git-moss.
the class SetupMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final PushConfiguration config = this.surface.getConfiguration();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
message.addOptionElement("", "Setup", true, "", "", false, true);
message.addOptionElement("Brightness", "Info", false, "", "", false, true);
message.addParameterElement("Display", config.getDisplayBrightness() * 1023 / 100, config.getDisplayBrightness() + "%", this.isKnobTouched[2], -1);
message.addParameterElement("LEDs", config.getLedBrightness() * 1023 / 100, config.getLedBrightness() + "%", this.isKnobTouched[3], -1);
message.addOptionElement(" Pads", "", false, "", "", false, false);
message.addParameterElement("Sensitivity", config.getPadSensitivity() * 1023 / 10, Integer.toString(config.getPadSensitivity()), this.isKnobTouched[5], -1);
message.addParameterElement("Gain", config.getPadGain() * 1023 / 10, Integer.toString(config.getPadGain()), this.isKnobTouched[6], -1);
message.addParameterElement("Dynamics", config.getPadDynamics() * 1023 / 10, Integer.toString(config.getPadDynamics()), this.isKnobTouched[7], -1);
display.send(message);
}
Aggregations