use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class DeviceLayerMode method updateDisplayElements.
/**
* Update all 8 elements.
*
* @param display The display
* @param l The channel data
*/
protected void updateDisplayElements(final IGraphicDisplay display, final Optional<ILayer> l) {
// Drum Pad Bank has size of 16, layers only 8
final int offset = this.getDrumPadIndex();
// Get the index at which to draw the Sends element
int sendsIndex = l.isEmpty() ? -1 : l.get().getIndex() - offset + 1;
if (sendsIndex == 8)
sendsIndex = 6;
this.updateMenuItems(-1);
final PushConfiguration config = this.surface.getConfiguration();
for (int i = 0; i < 8; i++) {
final IChannel layer = this.bank.getItem(offset + i);
final Pair<String, Boolean> pair = this.menu.get(i);
final String topMenu = pair.getKey();
final boolean isTopMenuOn = pair.getValue().booleanValue();
// Channel info
final String bottomMenu = layer.doesExist() ? layer.getName(12) : "";
final ColorEx bottomMenuColor = layer.getColor();
final boolean isBottomMenuOn = layer.isSelected();
if (layer.isSelected()) {
final IValueChanger valueChanger = this.model.getValueChanger();
final boolean enableVUMeters = config.isEnableVUMeters();
final int vuR = valueChanger.toDisplayValue(enableVUMeters ? layer.getVuRight() : 0);
final int vuL = valueChanger.toDisplayValue(enableVUMeters ? layer.getVuLeft() : 0);
display.addChannelElement(topMenu, isTopMenuOn, 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) : "", vuL, vuR, layer.isMute(), layer.isSolo(), false, layer.isActivated(), 0, false);
} else if (sendsIndex == i && l.isPresent()) {
final ITrackBank fxTrackBank = this.model.getEffectTrackBank();
final SendData[] sendData = new SendData[4];
for (int j = 0; j < 4; j++) {
final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
final int sendPos = sendOffset + j;
final ISend send = l.get().getSendBank().getItem(sendPos);
final boolean doesExist = send.doesExist();
sendData[j] = new SendData(fxTrackBank == null ? send.getName() : fxTrackBank.getItem(sendPos).getName(), doesExist && this.isKnobTouched[4 + j] ? send.getDisplayedValue() : "", doesExist ? send.getValue() : 0, doesExist ? send.getModulatedValue() : 0, true);
}
display.addSendsElement(topMenu, isTopMenuOn, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, this.bank.getItem(offset + i).getColor(), layer.isSelected(), sendData, true, l.get().isActivated(), layer.isActivated());
} else
display.addChannelSelectorElement(topMenu, isTopMenuOn, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn, layer.isActivated());
}
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class DeviceLayerMode method onSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void onSecondRow(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
if (!this.isPush2 || this.configuration.isMuteLongPressed() || this.configuration.isSoloLongPressed() || this.configuration.isMuteSoloLocked()) {
final int offset = this.getDrumPadIndex();
final ILayer layer = this.bank.getItem(offset + index);
if (this.configuration.isMuteState())
layer.toggleMute();
else
layer.toggleSolo();
return;
}
final ModeManager modeManager = this.surface.getModeManager();
ITrackBank fxTrackBank;
switch(index) {
case 0:
if (modeManager.isActive(Modes.DEVICE_LAYER_VOLUME))
this.setMode(Modes.DEVICE_LAYER);
else
this.setMode(Modes.DEVICE_LAYER_VOLUME);
break;
case 1:
if (modeManager.isActive(Modes.DEVICE_LAYER_PAN))
this.setMode(Modes.DEVICE_LAYER);
else
this.setMode(Modes.DEVICE_LAYER_PAN);
break;
case 2:
// Not used
break;
case 3:
if (this.model.isEffectTrackBankActive())
return;
// Check if there are more than 4 FX channels
if (!this.configuration.isSendsAreToggled()) {
fxTrackBank = this.model.getEffectTrackBank();
if (fxTrackBank == null || !fxTrackBank.getItem(4).doesExist())
return;
}
this.configuration.setSendsAreToggled(!this.configuration.isSendsAreToggled());
this.bindControls();
if (!modeManager.isActive(Modes.DEVICE_LAYER))
this.setMode(Modes.get(Modes.DEVICE_LAYER_SEND1, this.configuration.isSendsAreToggled() ? 4 : 0));
break;
case 7:
if (this.surface.isShiftPressed())
this.handleSendEffect(this.configuration.isSendsAreToggled() ? 7 : 3);
else
this.moveUp();
break;
default:
this.handleSendEffect(index - (this.configuration.isSendsAreToggled() ? 0 : 4));
break;
}
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class CrossfadeMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1(final ITextDisplay display) {
final ITrackBank tb = this.model.getCurrentTrackBank();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(i);
if (!t.doesExist())
continue;
display.setCell(0, i, "Crossfdr");
final IParameter crossfadeParameter = t.getCrossfadeParameter();
display.setCell(1, i, CROSSFADE_TEXT.get(crossfadeParameter.getDisplayedValue()));
display.setCell(2, i, crossfadeParameter.getValue(), Format.FORMAT_PAN);
}
this.drawRow4(display);
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class TrackCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final PushConfiguration config = this.surface.getConfiguration();
if (this.surface.isShiftPressed()) {
config.setVUMetersEnabled(!config.isEnableVUMeters());
return;
}
final ModeManager modeManager = this.surface.getModeManager();
final Modes currentMode = modeManager.getActiveID();
if (currentMode != null) {
if (config.isPush2()) {
if (Modes.TRACK.equals(currentMode) || Modes.VOLUME.equals(currentMode) || Modes.CROSSFADER.equals(currentMode) || Modes.PAN.equals(currentMode)) {
this.model.toggleCurrentTrackBank();
} else if (currentMode.ordinal() >= Modes.SEND1.ordinal() && currentMode.ordinal() <= Modes.SEND8.ordinal()) {
modeManager.setActive(Modes.TRACK);
this.model.toggleCurrentTrackBank();
} else
modeManager.setActive(config.getCurrentMixMode());
} else {
// Layer mode selection for Push 1
if (this.surface.isSelectPressed() && Modes.isLayerMode(currentMode)) {
modeManager.setActive(Modes.DEVICE_LAYER);
return;
}
if (Modes.TRACK.equals(currentMode))
this.model.toggleCurrentTrackBank();
else
modeManager.setActive(Modes.TRACK);
}
} else
modeManager.setActive(Modes.TRACK);
config.setDebugMode(modeManager.getActiveID());
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> track = tb.getSelectedItem();
if (track.isEmpty())
tb.getItem(0).select();
}
use of de.mossgrabers.framework.daw.data.bank.ITrackBank in project DrivenByMoss by git-moss.
the class PanMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1(final ITextDisplay display) {
final ITrackBank tb = this.model.getCurrentTrackBank();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getItem(i);
display.setCell(0, i, t.doesExist() ? "Pan" : "").setCell(1, i, t.getPanStr(8));
if (t.doesExist())
display.setCell(2, i, t.getPan(), Format.FORMAT_PAN);
}
this.drawRow4(display);
}
Aggregations