use of de.mossgrabers.framework.daw.ITrackBank in project DrivenByMoss by git-moss.
the class MCUControllerSetup method updateIndication.
private void updateIndication(final Integer mode) {
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final boolean isEffect = this.model.isEffectTrackBankActive();
final boolean isPan = Modes.MODE_PAN.equals(mode);
final boolean isTrack = Modes.MODE_TRACK.equals(mode);
final boolean isDevice = Modes.MODE_DEVICE_PARAMS.equals(mode);
tb.setIndication(!isEffect);
tbe.setIndication(isEffect);
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final ITrack selectedTrack = tb.getSelectedTrack();
for (int i = 0; i < tb.getNumTracks(); i++) {
final boolean hasTrackSel = selectedTrack != null && selectedTrack.getIndex() == i && isTrack;
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect && (isTrack || hasTrackSel));
track.setPanIndication(!isEffect && (isPan || hasTrackSel));
for (int j = 0; j < tb.getNumSends(); j++) track.getSend(j).setIndication(!isEffect && (mode.intValue() - Modes.MODE_SEND1.intValue() == j || hasTrackSel));
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect);
fxTrack.setPanIndication(isEffect && isPan);
}
for (int i = 0; i < cursorDevice.getNumParameters(); i++) cursorDevice.indicateParameter(i, isDevice);
}
use of de.mossgrabers.framework.daw.ITrackBank in project DrivenByMoss by git-moss.
the class AbstractTrackMode method onFirstRow.
/**
* {@inheritDoc}
*/
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
if (event == ButtonEvent.DOWN)
return;
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getTrack(index);
if (event == ButtonEvent.UP) {
if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_DUPLICATE)) {
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_DUPLICATE);
track.duplicate();
return;
}
if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_CLIP_STOP);
track.stop();
return;
}
if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_RECORD)) {
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_RECORD);
track.toggleRecArm();
return;
}
final ITrack selTrack = tb.getSelectedTrack();
if (selTrack != null && selTrack.getIndex() == index) {
// mode
if (selTrack.isGroup() && tb instanceof ITrackBank)
((ITrackBank) tb).selectChildren();
else
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_DEVICE, ButtonEvent.DOWN);
} else
track.selectAndMakeVisible();
return;
}
// LONG press, go out of group
if (!this.model.isEffectTrackBankActive()) {
this.model.getTrackBank().selectParent();
this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_ROW1_1 + index);
}
}
use of de.mossgrabers.framework.daw.ITrackBank in project DrivenByMoss by git-moss.
the class AbstractTrackMode method updateSecondRow.
/**
* {@inheritDoc}
*/
@Override
public void updateSecondRow() {
final PushConfiguration config = this.surface.getConfiguration();
final IChannelBank tb = this.model.getCurrentTrackBank();
if (this.isPush2) {
if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
this.surface.updateButton(102 + i, track.doesExist() && track.isPlaying() ? PushColors.PUSH2_COLOR_RED_HI : PushColors.PUSH2_COLOR_BLACK);
}
return;
}
if (config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
final boolean muteState = config.isMuteState();
for (int i = 0; i < 8; i++) this.surface.updateButton(102 + i, this.getTrackStateColor(muteState, tb.getTrack(i)));
return;
}
final ModeManager modeManager = this.surface.getModeManager();
this.surface.updateButton(102, modeManager.isActiveMode(Modes.MODE_VOLUME) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(103, modeManager.isActiveMode(Modes.MODE_PAN) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(104, modeManager.isActiveMode(Modes.MODE_CROSSFADER) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(105, PushColors.PUSH2_COLOR_BLACK);
final boolean sendsAreToggled = config.isSendsAreToggled();
this.surface.updateButton(106, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND5 : Modes.MODE_SEND1) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(107, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND6 : Modes.MODE_SEND2) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(108, modeManager.isActiveMode(sendsAreToggled ? Modes.MODE_SEND7 : Modes.MODE_SEND3) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
this.surface.updateButton(109, tb instanceof ITrackBank && ((ITrackBank) tb).hasParent() ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
return;
}
final boolean muteState = config.isMuteState();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getTrack(i);
int color = PushColors.PUSH1_COLOR_BLACK;
if (t.doesExist()) {
if (muteState) {
if (!t.isMute())
color = PushColors.PUSH1_COLOR2_YELLOW_HI;
} else
color = t.isSolo() ? PushColors.PUSH1_COLOR2_BLUE_HI : PushColors.PUSH1_COLOR2_GREY_LO;
}
this.surface.updateButton(102 + i, color);
}
}
use of de.mossgrabers.framework.daw.ITrackBank in project DrivenByMoss by git-moss.
the class PushControllerSetup method updateIndication.
private void updateIndication(final Integer mode) {
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final PushControlSurface surface = this.getSurface();
final boolean isSession = surface.getViewManager().isActiveView(Views.VIEW_SESSION);
final boolean isEffect = this.model.isEffectTrackBankActive();
final boolean isPan = Modes.MODE_PAN.equals(mode);
final boolean isVolume = Modes.MODE_VOLUME.equals(mode);
tb.setIndication(!isEffect && isSession);
if (tbe != null)
tbe.setIndication(isEffect && isSession);
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final ITrack selectedTrack = tb.getSelectedTrack();
for (int i = 0; i < tb.getNumTracks(); i++) {
final boolean hasTrackSel = selectedTrack != null && selectedTrack.getIndex() == i && Modes.MODE_TRACK.equals(mode);
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect && (isVolume || hasTrackSel));
track.setPanIndication(!isEffect && (isPan || hasTrackSel));
for (int j = 0; j < tb.getNumSends(); j++) track.getSend(j).setIndication(!isEffect && (mode.intValue() - Modes.MODE_SEND1.intValue() == j || hasTrackSel));
if (tbe != null) {
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect);
fxTrack.setPanIndication(isEffect && isPan);
}
cursorDevice.indicateParameter(i, true);
}
}
use of de.mossgrabers.framework.daw.ITrackBank in project DrivenByMoss by git-moss.
the class PushControllerSetup method createModel.
/**
* {@inheritDoc}
*/
@Override
protected void createModel() {
this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8, 8, this.isPush2 ? 8 : 6, this.isPush2 ? 48 : 16, this.isPush2 ? 48 : 16, false, -1, -1, -1, -1);
final ITrackBank trackBank = this.model.getTrackBank();
trackBank.setIndication(true);
trackBank.addTrackSelectionObserver(this::handleTrackChange);
final IChannelBank effectTrackBank = this.model.getEffectTrackBank();
if (effectTrackBank != null)
effectTrackBank.addTrackSelectionObserver(this::handleTrackChange);
this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
final PushControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
if (isSelected)
modeManager.setActiveMode(Modes.MODE_MASTER);
else if (modeManager.isActiveMode(Modes.MODE_MASTER))
modeManager.restoreMode();
});
}
Aggregations