use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class DeviceLayerMode method handleSendEffect.
/**
* Handle the selection of a send effect.
*
* @param sendIndex The index of the send
*/
protected void handleSendEffect(final int sendIndex) {
if (this.model.isEffectTrackBankActive())
return;
final ITrackBank fxTrackBank = this.model.getEffectTrackBank();
if (fxTrackBank == null || !fxTrackBank.getItem(sendIndex).doesExist())
return;
final Modes si = Modes.get(Modes.DEVICE_LAYER_SEND1, sendIndex);
final ModeManager modeManager = this.surface.getModeManager();
this.setMode(modeManager.isActive(si) ? Modes.DEVICE_LAYER : si);
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class AbstractTrackMode method handleSendEffect.
/**
* Handle the selection of a send effect.
*
* @param sendIndex The index of the send
*/
protected void handleSendEffect(final int sendIndex) {
final ITrackBank tb = this.model.getCurrentTrackBank();
if (tb == null || !tb.canEditSend(sendIndex))
return;
final Modes si = Modes.get(Modes.SEND1, sendIndex);
final ModeManager modeManager = this.surface.getModeManager();
modeManager.setActive(modeManager.isActive(si) ? Modes.TRACK : si);
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class AbstractTrackMode method getButtonColor.
/**
* {@inheritDoc}
*/
@Override
public int getButtonColor(final ButtonID buttonID) {
final PushConfiguration config = this.surface.getConfiguration();
final ITrackBank tb = this.model.getCurrentTrackBank();
int index = this.isButtonRow(0, buttonID);
if (index >= 0) {
final ITrack track = tb.getItem(index);
if (!track.doesExist() || !track.isActivated())
return this.colorManager.getColorIndex(PushColorManager.PUSH_BLACK);
final ITrack cursorTrack = this.model.getCursorTrack();
final int selIndex = cursorTrack.doesExist() ? cursorTrack.getIndex() : -1;
final boolean isSel = track.getIndex() == selIndex;
if (track.isRecArm())
return this.colorManager.getColorIndex(isSel ? PushColorManager.PUSH_RED_HI : PushColorManager.PUSH_RED_LO);
return this.colorManager.getColorIndex(isSel ? PushColorManager.PUSH_ORANGE_HI : PushColorManager.PUSH_YELLOW_LO);
}
index = this.isButtonRow(1, buttonID);
if (index >= 0) {
final ITrack track = tb.getItem(index);
if (this.isPush2) {
if (this.surface.isPressed(ButtonID.STOP_CLIP))
return track.doesExist() && track.isPlaying() ? PushColorManager.PUSH2_COLOR_RED_HI : PushColorManager.PUSH2_COLOR_BLACK;
if (config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
final boolean muteState = config.isMuteState();
return this.getTrackStateColor(muteState, track);
}
final ModeManager modeManager = this.surface.getModeManager();
final boolean sendsAreToggled = config.isSendsAreToggled();
switch(index) {
case 0:
return modeManager.isActive(Modes.VOLUME) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
case 1:
return modeManager.isActive(Modes.PAN) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
case 2:
return modeManager.isActive(Modes.CROSSFADER) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
case 4:
final Modes sendMode1 = sendsAreToggled ? Modes.SEND5 : Modes.SEND1;
return modeManager.isActive(sendMode1) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
case 5:
final Modes sendMode2 = sendsAreToggled ? Modes.SEND6 : Modes.SEND2;
return modeManager.isActive(sendMode2) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
case 6:
final Modes sendMode3 = sendsAreToggled ? Modes.SEND7 : Modes.SEND3;
return modeManager.isActive(sendMode3) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
case 7:
if (this.lastSendIsAccessible()) {
final Modes sendMode4 = sendsAreToggled ? Modes.SEND8 : Modes.SEND4;
return modeManager.isActive(sendMode4) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
}
return tb.hasParent() ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
default:
case 3:
return PushColorManager.PUSH2_COLOR_BLACK;
}
}
final boolean muteState = config.isMuteState();
if (!track.doesExist())
return PushColorManager.PUSH1_COLOR_BLACK;
if (muteState)
return track.isMute() ? PushColorManager.PUSH1_COLOR_BLACK : PushColorManager.PUSH1_COLOR2_YELLOW_HI;
return track.isSolo() ? PushColorManager.PUSH1_COLOR2_BLUE_HI : PushColorManager.PUSH1_COLOR2_GREY_LO;
}
return super.getButtonColor(buttonID);
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method getEncoderColor.
private int getEncoderColor(final ButtonID arrowButton) {
final MaschineControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
final Modes modeID = modeManager.getActiveID();
if (modeID == null)
return MaschineColorManager.COLOR_BLACK;
final IMode mode = modeManager.getActive();
boolean isOn;
switch(arrowButton) {
case ARROW_LEFT:
isOn = mode.hasPreviousItem();
break;
case ARROW_RIGHT:
isOn = mode.hasNextItem();
break;
case ARROW_UP:
isOn = mode.hasNextItemPage();
break;
case ARROW_DOWN:
isOn = mode.hasPreviousItemPage();
break;
// Never reached
default:
return MaschineColorManager.COLOR_BLACK;
}
if (!isOn)
return MaschineColorManager.COLOR_BLACK;
switch(modeID) {
case VOLUME:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_BLUE : MaschineColorManager.COLOR_BLUE_LO;
case PAN:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_SKY : MaschineColorManager.COLOR_SKY_LO;
case SEND1:
case SEND2:
case SEND3:
case SEND4:
case SEND5:
case SEND6:
case SEND7:
case SEND8:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_WHITE : MaschineColorManager.COLOR_YELLOW;
case DEVICE_PARAMS:
case USER:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_PINK : MaschineColorManager.COLOR_PINK_LO;
case BROWSER:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_AMBER : MaschineColorManager.COLOR_AMBER_LO;
case NOTE:
return surface.isPressed(arrowButton) ? MaschineColorManager.COLOR_GREEN : MaschineColorManager.COLOR_GREEN_LO;
default:
return MaschineColorManager.COLOR_BLACK;
}
}
use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.
the class MaschineSendSelectCommand method executeShifted.
/**
* {@inheritDoc}
*/
@Override
public void executeShifted(final ButtonEvent event) {
final ModeManager modeManager = this.surface.getModeManager();
final Modes activeMode = modeManager.getActiveID();
super.executeShifted(event);
final Modes newMode = modeManager.getActiveID();
if (activeMode == newMode)
return;
final int sendIndex = newMode.ordinal() - Modes.SEND1.ordinal();
final Optional<ITrack> t = this.model.getCurrentTrackBank().getSelectedItem();
if (t.isEmpty())
return;
final ISendBank sendBank = t.get().getSendBank();
final ISend send = sendBank.getItem(sendIndex);
if (send.doesExist())
this.surface.getDisplay().notify("Send " + (sendIndex + 1) + ": " + send.getName());
}
Aggregations