use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class RightCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack sel = tb.getSelectedTrack();
final int index = sel == null ? 0 : sel.getIndex() + 1;
final View view = this.surface.getViewManager().getActiveView();
if (index == 8 || this.surface.isShiftPressed()) {
if (!tb.canScrollTracksDown())
return;
tb.scrollTracksPageDown();
final int newSel = index == 8 || sel == null ? 0 : sel.getIndex();
this.surface.scheduleTask(() -> view.selectTrack(newSel), 75);
return;
}
view.selectTrack(index);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class AbstractSessionView method drawSessionGrid.
/**
* Draw a session grid, where each pad stands for a clip.
*/
protected void drawSessionGrid() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final boolean flipSession = this.surface.getConfiguration().isFlipSession();
for (int x = 0; x < this.columns; x++) {
final ITrack t = tb.getTrack(x);
for (int y = 0; y < this.rows; y++) this.drawPad(t.getSlot(y), flipSession ? y : x, flipSession ? x : y, t.isRecArm());
}
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class LaunchpadControllerSetup method updateIndication.
private void updateIndication() {
final ViewManager viewManager = this.getSurface().getViewManager();
final boolean isVolume = viewManager.isActiveView(Views.VIEW_VOLUME);
final boolean isPan = viewManager.isActiveView(Views.VIEW_PAN);
final boolean isSends = viewManager.isActiveView(Views.VIEW_SENDS);
final boolean isDevice = viewManager.isActiveView(Views.VIEW_DEVICE);
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final View view = viewManager.getActiveView();
final int selSend = view instanceof SendsView ? ((SendsView) view).getSelectedSend() : -1;
final boolean isSession = view instanceof SessionView && !isVolume && !isPan && !isSends;
final boolean isEffect = this.model.isEffectTrackBankActive();
tb.setIndication(!isEffect && isSession);
tbe.setIndication(isEffect && isSession);
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect && isVolume);
track.setPanIndication(!isEffect && isPan);
for (int j = 0; j < 8; j++) track.getSend(j).setIndication(!isEffect && isSends && selSend == j);
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect && isVolume);
fxTrack.setPanIndication(isEffect && isPan);
cursorDevice.indicateParameter(i, isDevice);
}
}
use of de.mossgrabers.framework.daw.IChannelBank 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;
final PushConfiguration config = this.surface.getConfiguration();
if (!this.isPush2 || config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
final ICursorDevice cd = this.model.getCursorDevice();
final int offset = getDrumPadIndex(cd);
if (config.isMuteState())
cd.toggleLayerOrDrumPadMute(offset + index);
else
cd.toggleLayerOrDrumPadSolo(offset + index);
return;
}
final ModeManager modeManager = this.surface.getModeManager();
IChannelBank fxTrackBank;
switch(index) {
case 0:
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME);
break;
case 1:
if (modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_PAN))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER_PAN);
break;
case 2:
// Not used
break;
case 3:
if (!this.model.isEffectTrackBankActive()) {
// Check if there are more than 4 FX channels
if (!config.isSendsAreToggled()) {
fxTrackBank = this.model.getEffectTrackBank();
if (!fxTrackBank.getTrack(4).doesExist())
return;
}
config.setSendsAreToggled(!config.isSendsAreToggled());
if (!modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER))
modeManager.setActiveMode(Integer.valueOf(Modes.MODE_DEVICE_LAYER_SEND1.intValue() + (config.isSendsAreToggled() ? 4 : 0)));
}
break;
case 7:
this.moveUp();
break;
default:
if (!this.model.isEffectTrackBankActive()) {
final int sendOffset = config.isSendsAreToggled() ? 0 : 4;
final int sendIndex = index - sendOffset;
fxTrackBank = this.model.getEffectTrackBank();
if (fxTrackBank.getTrack(sendIndex).doesExist()) {
final Integer si = Integer.valueOf(Modes.MODE_DEVICE_LAYER_SEND1.intValue() + sendIndex);
if (modeManager.isActiveMode(si))
modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
else
modeManager.setActiveMode(si);
}
}
break;
}
}
use of de.mossgrabers.framework.daw.IChannelBank 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