use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class TrackSendMode method onKnobValue.
/**
* {@inheritDoc}
*/
@Override
public void onKnobValue(final int index, final int value) {
final Optional<ITrack> track = this.getTrack(index);
if (track.isEmpty())
return;
final ISend item = track.get().getSendBank().getItem(this.sendIndex);
if (this.isAbsolute)
item.setValue(value);
else
item.changeValue(value);
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class FireLayerMixerMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
this.updateMode();
final IGraphicDisplay display = this.surface.getGraphicsDisplay();
final ISpecificDevice cd = this.model.getDrumDevice();
final ILayerBank layerBank = cd.getLayerBank();
final Optional<ILayer> channelOptional = layerBank.getSelectedItem();
String label = "None";
if (channelOptional.isPresent()) {
final IChannel channel = channelOptional.get();
label = channel.getPosition() + 1 + ": " + channel.getName(9);
}
final int size = layerBank.getPageSize();
final boolean[] selected = new boolean[size];
final int[] values = new int[size];
final boolean isMode = this.isAnyKnobTouched() || !this.model.getTransport().isPlaying();
if (isMode) {
switch(this.selectedParameter) {
case VOLUME:
for (int i = 0; i < size; i++) {
final IChannel channel = layerBank.getItem(i);
selected[i] = channel.isSelected();
values[i] = channel.getVolume();
}
break;
case PAN:
for (int i = 0; i < size; i++) {
final IChannel channel = layerBank.getItem(i);
selected[i] = channel.isSelected();
values[i] = channel.getPan();
}
break;
case SEND1:
case SEND2:
case SEND3:
case SEND4:
case SEND5:
case SEND6:
final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
for (int i = 0; i < size; i++) {
final IChannel channel = layerBank.getItem(i);
selected[i] = channel.isSelected();
final ISendBank sendBank = channel.getSendBank();
if (sendBank != null) {
final ISend send = sendBank.getItem(sendIndex);
if (send.doesExist())
values[i] = send.getValue();
}
}
break;
default:
// Not used
break;
}
} else {
for (int i = 0; i < size; i++) {
final IChannel channel = layerBank.getItem(i);
selected[i] = channel.isSelected();
values[i] = channel.getVu();
}
}
display.addElement(new TitleChannelsComponent(label, selected, values, this.selectedParameter == Modes.PAN && isMode));
display.send();
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class FireTrackMode 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 Optional<ITrack> trackOptional = this.model.getCurrentTrackBank().getSelectedItem();
if (!trackOptional.isPresent())
return;
final ITrack track = trackOptional.get();
switch(this.selectedParameter) {
case VOLUME:
if (isTouched && this.surface.isDeletePressed())
track.resetVolume();
track.touchVolume(isTouched);
break;
case PAN:
if (isTouched && this.surface.isDeletePressed())
track.resetPan();
track.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 = track.getSendBank().getItem(sendIndex);
if (isTouched && this.surface.isDeletePressed())
item.resetValue();
item.touchValue(isTouched);
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class FireTrackMode method getSendLabel.
private static String getSendLabel(final ISendBank sendBank, final int index) {
final int pos = index + 1;
if (sendBank == null)
return "No FX " + pos;
final ISend send = sendBank.getItem(index);
if (!send.doesExist())
return "No FX " + pos;
return send.getName(4) + ": " + send.getDisplayedValue();
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class TrackMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
final ITrackBank currentTrackBank = this.model.getCurrentTrackBank();
final Optional<ITrack> t = currentTrackBank.getSelectedItem();
final Kontrol1Display d = (Kontrol1Display) this.surface.getDisplay();
d.clear();
if (t.isEmpty()) {
d.setCell(0, 3, " PLEASE").setCell(0, 4, "SELECT A").setCell(0, 5, "TRACK").allDone();
return;
}
final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
final ITrack track = t.get();
d.setCell(0, 0, (isEffectTrackBankActive ? "TR-FX " : "TRACK ") + (track.getPosition() + 1)).setCell(1, 0, StringUtils.shortenAndFixASCII(track.getName(), 8).toUpperCase(Locale.US));
d.setCell(0, 1, "VOLUME").setCell(1, 1, getSecondLineText(track)).setCell(0, 2, "PAN").setCell(1, 2, track.getPanStr(8));
d.setBar(1, this.surface.getContinuous(ContinuousID.KNOB1).isTouched(), track.getVolume());
d.setPanBar(2, this.surface.getContinuous(ContinuousID.KNOB2).isTouched(), track.getPan());
if (!isEffectTrackBankActive) {
final ISendBank sendBank = track.getSendBank();
for (int i = 0; i < 6; i++) {
final int pos = 3 + i;
final ISend sendData = sendBank.getItem(i);
d.setCell(0, pos, StringUtils.shortenAndFixASCII(sendData.getName(8), 8).toUpperCase(Locale.US)).setCell(1, pos, sendData.getDisplayedValue(8));
d.setBar(pos, this.surface.getContinuous(ContinuousID.get(ContinuousID.KNOB3, i)).isTouched() && sendData.doesExist(), sendData.getValue());
}
}
d.allDone();
}
Aggregations