use of de.mossgrabers.framework.daw.data.ISpecificDevice 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.ISpecificDevice 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;
}
}
use of de.mossgrabers.framework.daw.data.ISpecificDevice in project DrivenByMoss by git-moss.
the class FireLayerMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
this.updateMode();
final IGraphicDisplay display = this.surface.getGraphicsDisplay();
String desc = "Select";
String label = "a drum pad";
int value = -1;
int vuLeft = -1;
int vuRight = -1;
boolean isPan = false;
final ISpecificDevice cd = this.model.getDrumDevice();
final Optional<ILayer> channelOptional = cd.getLayerBank().getSelectedItem();
if (channelOptional.isPresent()) {
final IChannel channel = channelOptional.get();
vuLeft = channel.getVuLeft();
vuRight = channel.getVuRight();
desc = channel.getPosition() + 1 + ": " + channel.getName(9);
final ISendBank sendBank = channel.getSendBank();
switch(this.selectedParameter) {
case VOLUME:
label = "Vol: " + channel.getVolumeStr();
value = channel.getVolume();
break;
case PAN:
label = "Pan: " + channel.getPanStr();
value = channel.getPan();
isPan = true;
break;
case SEND1:
case SEND2:
case SEND3:
case SEND4:
case SEND5:
case SEND6:
final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
label = getSendLabel(sendBank, sendIndex);
value = getSendValue(sendBank, sendIndex);
break;
default:
label = "Select a track";
break;
}
}
display.addElement(new TitleValueComponent(desc, label, value, vuLeft, vuRight, isPan));
display.send();
}
Aggregations