use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class PitchbendVolumeCommand method onPitchbend.
/**
* {@inheritDoc}
*/
@Override
public void onPitchbend(final int channel, final int data1, final int data2) {
final double value = Math.min(data2 * 127 + (double) data1, this.model.getValueChanger().getUpperBound() - 1);
if (channel == 8) {
if (this.surface.isShiftPressed())
this.model.getTransport().setMetronomeVolume(value);
else
this.model.getMasterTrack().setVolume(value);
return;
}
final int extenderOffset = this.surface.getExtenderOffset();
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getTrack(extenderOffset + channel);
if (this.surface.getConfiguration().useFadersAsKnobs()) {
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_VOLUME))
track.setVolume(value);
else if (modeManager.isActiveMode(Modes.MODE_PAN))
track.setPan(value);
else if (modeManager.isActiveMode(Modes.MODE_TRACK))
this.handleTrack(channel, value);
else if (modeManager.isActiveMode(Modes.MODE_SEND1))
track.getSend(0).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND2))
track.getSend(1).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND3))
track.getSend(2).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND4))
track.getSend(3).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND5))
track.getSend(4).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND6))
track.getSend(5).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND7))
track.getSend(6).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND8))
track.getSend(7).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS))
this.model.getCursorDevice().setParameter(extenderOffset + channel, (int) value);
return;
}
track.setVolume(value);
}
use of de.mossgrabers.framework.daw.IChannelBank 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.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.hasSelectedDevice()) {
for (int i = 0; i < 8; i++) message.addOptionElement(i == 2 ? "Please select a device or press 'Add Device'..." : "", i == 7 ? "Up" : "", true, "", "", false, true);
display.send(message);
return;
}
final IChannelBank tb = this.model.getCurrentTrackBank();
final String color = tb.getSelectedTrackColorEntry();
final IValueChanger valueChanger = this.model.getValueChanger();
final String[] pages = cd.getParameterPageNames();
final int page = Math.min(Math.max(0, cd.getSelectedParameterPage()), pages.length - 1);
final int start = page / 8 * 8;
final boolean hasPinning = this.model.getHost().hasPinning();
for (int i = 0; i < 8; i++) {
boolean isTopMenuOn;
switch(i) {
case 0:
isTopMenuOn = cd.isEnabled();
break;
case 1:
isTopMenuOn = cd.isParameterPageSectionVisible();
break;
case 2:
isTopMenuOn = cd.isExpanded();
break;
case 4:
isTopMenuOn = !this.showDevices;
break;
case 5:
isTopMenuOn = hasPinning && cd.isPinned();
break;
case 6:
isTopMenuOn = cd.isWindowOpen();
break;
case 7:
isTopMenuOn = true;
break;
default:
// Not used
isTopMenuOn = false;
break;
}
String bottomMenu;
final String bottomMenuIcon = "";
boolean isBottomMenuOn;
if (this.showDevices) {
bottomMenu = cd.doesSiblingExist(i) ? cd.getSiblingDeviceName(i, 12) : "";
isBottomMenuOn = i == cd.getPositionInBank();
} else {
final int index = start + i;
bottomMenu = index < pages.length ? pages[index] : "";
if (bottomMenu.length() > 12)
bottomMenu = bottomMenu.substring(0, 12);
isBottomMenuOn = index == page;
}
final double[] bottomMenuColor = BitwigColors.getColorEntry(color);
final IParameter param = cd.getFXParam(i);
final boolean exists = param.doesExist();
final String parameterName = exists ? param.getName(9) : "";
final int parameterValue = valueChanger.toDisplayValue(exists ? param.getValue() : 0);
final String parameterValueStr = exists ? param.getDisplayedValue(8) : "";
final boolean parameterIsActive = this.isKnobTouched[i];
final int parameterModulatedValue = valueChanger.toDisplayValue(exists ? param.getModulatedValue() : -1);
message.addParameterElement(i != 5 || hasPinning ? MENU[i] : "", isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
}
display.send(message);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class AbstractTrackMode method drawRow4.
protected void drawRow4() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
// Format track names
final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
final Display d = this.surface.getDisplay();
for (int i = 0; i < 8; i++) {
final boolean isSel = i == selIndex;
final ITrack t = tb.getTrack(i);
final String n = StringUtils.shortenAndFixASCII(t.getName(), isSel ? 7 : 8);
d.setCell(3, i, isSel ? PushDisplay.RIGHT_ARROW + n : n);
}
d.done(3);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class AbstractTrackMode method getTrackButtonColor.
protected int getTrackButtonColor(final ITrack track) {
if (!track.doesExist() || !track.isActivated())
return this.isPush2 ? PushColors.PUSH2_COLOR_BLACK : PushColors.PUSH1_COLOR_BLACK;
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
final boolean isSel = track.getIndex() == selIndex;
if (track.isRecArm())
return isSel ? this.isPush2 ? PushColors.PUSH2_COLOR_RED_HI : PushColors.PUSH1_COLOR_RED_HI : this.isPush2 ? PushColors.PUSH2_COLOR_RED_LO : PushColors.PUSH1_COLOR_RED_LO;
return isSel ? this.isPush2 ? PushColors.PUSH2_COLOR_ORANGE_HI : PushColors.PUSH1_COLOR_ORANGE_HI : this.isPush2 ? PushColors.PUSH2_COLOR_YELLOW_LO : PushColors.PUSH1_COLOR_YELLOW_LO;
}
Aggregations