use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class SendMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
this.updateTrackMenu();
final int sendIndex = this.getCurrentSendIndex();
final IChannelBank tb = this.model.getCurrentTrackBank();
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
final PushConfiguration config = this.surface.getConfiguration();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getTrack(i);
// The menu item
String topMenu;
boolean topMenuSelected;
if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
topMenu = t.doesExist() ? "Stop Clip" : "";
topMenuSelected = t.isPlaying();
} else if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
topMenu = t.doesExist() ? "Mute" : "";
topMenuSelected = t.isMute();
} else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
topMenu = t.doesExist() ? "Solo" : "";
topMenuSelected = t.isSolo();
} else {
topMenu = this.menu[i];
topMenuSelected = i > 3 && i - 4 + sendOffset == sendIndex || i == 7 && tb instanceof ITrackBank && ((ITrackBank) tb).hasParent();
}
final IValueChanger valueChanger = this.model.getValueChanger();
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 = t.getSend(sendPos);
sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
valueStr[j] = send != null && sendIndex == sendPos && this.isKnobTouched[i] ? send.getDisplayedValue(8) : "";
value[j] = valueChanger.toDisplayValue(send != null ? send.getValue() : -1);
modulatedValue[j] = valueChanger.toDisplayValue(send != null ? send.getModulatedValue() : -1);
selected[j] = sendIndex == sendPos;
}
message.addSendsElement(topMenu, topMenuSelected, t.doesExist() ? t.getName() : "", t.getType(), t.getColor(), t.isSelected(), sendName, valueStr, value, modulatedValue, selected, false);
}
display.send(message);
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class TrackMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selectedTrack = tb.getSelectedTrack();
// Get the index at which to draw the Sends element
final int selectedIndex = selectedTrack == null ? -1 : selectedTrack.getIndex();
int sendsIndex = selectedTrack == null || this.model.isEffectTrackBankActive() ? -1 : selectedTrack.getIndex() + 1;
if (sendsIndex == 8)
sendsIndex = 6;
this.updateTrackMenu();
final PushConfiguration config = this.surface.getConfiguration();
final PushDisplay display = (PushDisplay) this.surface.getDisplay();
final DisplayMessage message = display.createMessage();
final boolean displayCrossfader = config.isDisplayCrossfader();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getTrack(i);
// The menu item
String topMenu;
boolean topMenuSelected;
if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP) && this.model.getHost().hasClips()) {
topMenu = t.doesExist() ? "Stop Clip" : "";
topMenuSelected = t.isPlaying();
} else if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
topMenu = t.doesExist() ? "Mute" : "";
topMenuSelected = t.isMute();
} else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
topMenu = t.doesExist() ? "Solo" : "";
topMenuSelected = t.isSolo();
} else {
topMenu = this.menu[i];
topMenuSelected = i == 7 && tb instanceof ITrackBank && ((ITrackBank) tb).hasParent();
}
// Channel info
final String bottomMenu = t.doesExist() ? t.getName() : "";
final double[] bottomMenuColor = t.getColor();
final boolean isBottomMenuOn = t.isSelected();
final IValueChanger valueChanger = this.model.getValueChanger();
if (t.isSelected()) {
final int crossfadeMode = displayCrossfader ? t.getCrossfadeModeAsNumber() : -1;
message.addChannelElement(topMenu, topMenuSelected, bottomMenu, t.getType(), bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue(t.getVolume()), valueChanger.toDisplayValue(t.getModulatedVolume()), this.isKnobTouched[0] ? t.getVolumeStr(8) : "", valueChanger.toDisplayValue(t.getPan()), valueChanger.toDisplayValue(t.getModulatedPan()), this.isKnobTouched[1] ? t.getPanStr(8) : "", valueChanger.toDisplayValue(config.isEnableVUMeters() ? t.getVu() : 0), t.isMute(), t.isSolo(), t.isRecArm(), crossfadeMode);
} else if (sendsIndex == i) {
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
final ITrack selTrack = tb.getTrack(selectedIndex);
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;
selected[j] = true;
sendName[j] = "";
valueStr[j] = "";
value[j] = 0;
if (selTrack == null)
continue;
final ISend send = selTrack.getSend(sendPos);
if (send == null)
continue;
sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
valueStr[j] = send.doesExist() && this.isKnobTouched[4 + j] ? send.getDisplayedValue(8) : "";
value[j] = valueChanger.toDisplayValue(send.doesExist() ? send.getValue() : 0);
modulatedValue[j] = valueChanger.toDisplayValue(send.doesExist() ? send.getModulatedValue() : 0);
}
message.addSendsElement(topMenu, topMenuSelected, bottomMenu, t.getType(), bottomMenuColor, isBottomMenuOn, sendName, valueStr, value, modulatedValue, selected, true);
} else
message.addChannelSelectorElement(topMenu, topMenuSelected, bottomMenu, t.getType(), bottomMenuColor, isBottomMenuOn);
}
display.send(message);
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class TrackMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1() {
final Display d = this.surface.getDisplay().clear();
final IChannelBank currentTrackBank = this.model.getCurrentTrackBank();
final ITrack t = currentTrackBank.getSelectedTrack();
if (t == null)
d.setRow(1, " Please selecta track... ").done(0).done(2);
else {
final PushConfiguration config = this.surface.getConfiguration();
d.setCell(0, 0, "Volume").setCell(1, 0, t.getVolumeStr(8)).setCell(2, 0, config.isEnableVUMeters() ? t.getVu() : t.getVolume(), Format.FORMAT_VALUE);
d.setCell(0, 1, "Pan").setCell(1, 1, t.getPanStr(8)).setCell(2, 1, t.getPan(), Format.FORMAT_PAN);
int sendStart = 2;
int sendCount = 6;
if (config.isDisplayCrossfader()) {
sendStart = 3;
sendCount = 5;
final String crossfadeMode = t.getCrossfadeMode();
final int upperBound = this.model.getValueChanger().getUpperBound();
d.setCell(0, 2, "Crossfdr").setCell(1, 2, "A".equals(crossfadeMode) ? "A" : "B".equals(crossfadeMode) ? " B" : " <> ");
d.setCell(2, 2, "A".equals(crossfadeMode) ? 0 : "B".equals(crossfadeMode) ? upperBound : upperBound / 2, Format.FORMAT_PAN);
}
final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
for (int i = 0; i < sendCount; i++) {
final int pos = sendStart + i;
if (!isEffectTrackBankActive) {
final ISend send = t.getSend(i);
if (send.doesExist())
d.setCell(0, pos, send.getName()).setCell(1, pos, send.getDisplayedValue(8)).setCell(2, pos, send.getValue(), Format.FORMAT_VALUE);
}
}
d.done(0).done(1).done(2);
}
this.drawRow4();
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class TrackMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2(final IGraphicDisplay display) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> selectedTrack = tb.getSelectedItem();
// Get the index at which to draw the Sends element
final int selectedIndex = selectedTrack.isEmpty() ? -1 : selectedTrack.get().getIndex();
int sendsIndex = selectedTrack.isEmpty() || this.model.isEffectTrackBankActive() ? -1 : selectedTrack.get().getIndex() + 1;
if (sendsIndex == 8)
sendsIndex = 6;
this.updateMenuItems(0);
final ICursorTrack cursorTrack = this.model.getCursorTrack();
final PushConfiguration config = this.surface.getConfiguration();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(i);
// The menu item
final Pair<String, Boolean> pair = this.menu.get(i);
final String topMenu = pair.getKey();
final boolean topMenuSelected = pair.getValue().booleanValue();
// Channel info
final String bottomMenu = t.doesExist() ? t.getName() : "";
final ColorEx bottomMenuColor = t.getColor();
final boolean isBottomMenuOn = t.isSelected();
final IValueChanger valueChanger = this.model.getValueChanger();
if (t.isSelected()) {
final int crossfadeMode = this.getCrossfadeModeAsNumber(t);
final boolean enableVUMeters = config.isEnableVUMeters();
final int vuR = valueChanger.toDisplayValue(enableVUMeters ? t.getVuRight() : 0);
final int vuL = valueChanger.toDisplayValue(enableVUMeters ? t.getVuLeft() : 0);
display.addChannelElement(topMenu, topMenuSelected, bottomMenu, this.updateType(t), bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue(t.getVolume()), valueChanger.toDisplayValue(t.getModulatedVolume()), this.isKnobTouched[0] ? t.getVolumeStr(8) : "", valueChanger.toDisplayValue(t.getPan()), valueChanger.toDisplayValue(t.getModulatedPan()), this.isKnobTouched[1] ? t.getPanStr(8) : "", vuL, vuR, t.isMute(), t.isSolo(), t.isRecArm(), t.isActivated(), crossfadeMode, cursorTrack.isPinned());
} else if (sendsIndex == i) {
final ITrack selTrack = tb.getItem(selectedIndex);
final SendData[] sendData = new SendData[4];
for (int j = 0; j < 4; j++) {
if (selTrack != null) {
final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
final int sendPos = sendOffset + j;
final ISend send = selTrack.getSendBank().getItem(sendPos);
if (send != null) {
final boolean exists = send.doesExist();
sendData[j] = new SendData(send.getName(), exists && this.isKnobTouched[4 + j] ? send.getDisplayedValue(8) : "", valueChanger.toDisplayValue(exists ? send.getValue() : 0), valueChanger.toDisplayValue(exists ? send.getModulatedValue() : 0), true);
continue;
}
}
sendData[j] = new SendData("", "", 0, 0, true);
}
display.addSendsElement(topMenu, topMenuSelected, bottomMenu, this.updateType(t), bottomMenuColor, isBottomMenuOn, sendData, true, selTrack == null || selTrack.isActivated(), t.isActivated());
} else
display.addChannelSelectorElement(topMenu, topMenuSelected, bottomMenu, this.updateType(t), bottomMenuColor, isBottomMenuOn, t.isActivated());
}
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class FireLayerMode method onKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
this.selectedParameter = this.surface.isPressed(ButtonID.ALT) ? ALT_MODES[index] : MODES[index];
this.isKnobTouched[index] = isTouched;
final ISpecificDevice cd = this.model.getDrumDevice();
final Optional<ILayer> channelOptional = cd.getLayerBank().getSelectedItem();
if (!channelOptional.isPresent())
return;
final IChannel channel = channelOptional.get();
switch(this.selectedParameter) {
case VOLUME:
if (isTouched && this.surface.isDeletePressed())
channel.resetVolume();
channel.touchVolume(isTouched);
break;
case PAN:
if (isTouched && this.surface.isDeletePressed())
channel.resetPan();
channel.touchPan(isTouched);
break;
case SEND1:
case SEND2:
case SEND3:
case SEND4:
case SEND5:
case SEND6:
final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
final ISend item = channel.getSendBank().getItem(sendIndex);
if (isTouched && this.surface.isDeletePressed())
item.resetValue();
item.touchValue(isTouched);
break;
default:
// No more
break;
}
}
Aggregations