use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class SendMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final IValueChanger valueChanger = this.model.getValueChanger();
final Optional<ITrack> selectedTrack = this.bank.getSelectedItem();
final ISendBank sendBank = selectedTrack.isEmpty() ? null : selectedTrack.get().getSendBank();
final int[] vuData = new int[16];
for (int i = 0; i < 8; i++) {
final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(i);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_AVAILABLE, send.doesExist() ? TrackType.RETURN_BUS : TrackType.EMPTY, i);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_SELECTED, send.isSelected() ? 1 : 0, i);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_RECARM, 0, i);
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME_TEXT, 0, i, send.getDisplayedValue(8));
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_PAN_TEXT, 0, i, send.getDisplayedValue(8));
final String n = selectedTrack.isPresent() ? getName(selectedTrack.get(), send) : "";
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_NAME, 0, i, n);
final int j = 2 * i;
vuData[j] = valueChanger.toMidiValue(send.getModulatedValue());
vuData[j + 1] = valueChanger.toMidiValue(send.getModulatedValue());
}
this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_VU, 2, 0, vuData);
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class LaunchkeyMk3SendMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITextDisplay d = this.surface.getTextDisplay();
final ICursorTrack cursorTrack = this.model.getCursorTrack();
final String trackText = cursorTrack.doesExist() ? String.format("%d: %s", Integer.valueOf(cursorTrack.getPosition() + 1), cursorTrack.getName()) : "No sel. track";
final ITrackBank tb = this.model.getCurrentTrackBank();
if (this.areKnobs) {
String sendName = tb.getEditSendName(this.sendIndex);
sendName = StringUtils.optimizeName(sendName.isEmpty() ? "Send " + (this.sendIndex + 1) : sendName, 6);
d.setCell(LaunchkeyMk3Display.SCREEN_ROW_BASE, 0, sendName + this.formatPageRange(" %d - %d"));
d.setCell(LaunchkeyMk3Display.SCREEN_ROW_BASE + 1, 0, trackText);
}
final int row = this.areKnobs ? LaunchkeyMk3Display.SCREEN_ROW_POTS : LaunchkeyMk3Display.SCREEN_ROW_FADERS;
// Format track names
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(i);
final ISend s = t.getSendBank().getItem(this.sendIndex);
final boolean exists = s.doesExist();
final int offset = i * 2;
d.setCell(row + offset, 0, exists ? String.format("%d: %s", Integer.valueOf(s.getPosition() + 1), s.getName()) : "No send");
d.setCell(row + offset + 1, 0, exists ? "S-Vol: " + s.getDisplayedValue() : "");
}
// Add master fader
if (!this.areKnobs) {
final IMasterTrack masterTrack = this.model.getMasterTrack();
d.setCell(row + 16, 0, "Master");
d.setCell(row + 16 + 1, 0, "Vol: " + masterTrack.getVolumeStr());
}
d.allDone();
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class MaschineSendMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITextDisplay d = this.surface.getTextDisplay();
final ITrackBank tb = this.model.getCurrentTrackBank();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(i);
final ISend send = t.getSendBank().getItem(this.sendIndex);
String name = StringUtils.shortenAndFixASCII(t.getName(), 6);
if (t.isSelected())
name = ">" + name;
d.setCell(0, i, name);
d.setCell(1, i, send.getDisplayedValue(6));
}
d.allDone();
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class OSCParser method parseSendValue.
private void parseSendValue(final ITrack track, final int sendIndex, final LinkedList<String> parts, final Object value) {
if (parts.isEmpty()) {
this.host.errorln("Missing Send subcommand.");
return;
}
final double numValue = value instanceof Number ? ((Number) value).doubleValue() : -1;
final String command = parts.removeFirst();
switch(command) {
case PART_VOLUME:
final ISend send = track.getSend(sendIndex);
if (send != null) {
if (parts.isEmpty())
send.setValue(numValue);
else if (PART_INDICATE.equals(parts.get(0)))
send.setIndication(numValue > 0);
else if (PART_TOUCH.equals(parts.get(0)))
send.touchValue(numValue > 0);
}
break;
default:
this.host.println("Unknown Send Parameter value: " + command);
break;
}
}
use of de.mossgrabers.framework.daw.data.ISend 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);
}
}
Aggregations