use of de.mossgrabers.framework.featuregroup.ModeManager 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());
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class KontrolProtocolControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final KontrolProtocolControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
final List<ContinuousID> controls = ContinuousID.createSequentialList(ContinuousID.KNOB1, 8);
controls.addAll(ContinuousID.createSequentialList(ContinuousID.FADER1, 8));
modeManager.register(Modes.VOLUME, new MixerMode(surface, this.model, controls));
modeManager.register(Modes.SEND, new SendMode(surface, this.model, controls));
modeManager.register(Modes.DEVICE_PARAMS, new ParamsMode(surface, this.model, controls));
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class SLMkIIIControllerSetup method createModes.
/**
* {@inheritDoc}
*/
@Override
protected void createModes() {
final SLMkIIIControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
// Required for button combinations in modes
this.addButton(ButtonID.DELETE, "Clear", NopCommand.INSTANCE, 15, SLMkIIIControlSurface.MKIII_CLEAR, () -> surface.isPressed(ButtonID.DELETE) ? SLMkIIIColorManager.SLMKIII_AMBER : SLMkIIIColorManager.SLMKIII_AMBER_HALF);
modeManager.register(Modes.TRACK, new SLMkIIITrackMode(surface, this.model));
modeManager.register(Modes.VOLUME, new SLMkIIIVolumeMode(surface, this.model));
modeManager.register(Modes.PAN, new SLMkIIIPanMode(surface, this.model));
for (int i = 0; i < 8; i++) modeManager.register(Modes.get(Modes.SEND1, i), new SLMkIIISendMode(i, surface, this.model));
modeManager.register(Modes.DEVICE_PARAMS, new ParametersMode(surface, this.model));
modeManager.register(Modes.BROWSER, new BrowserMode(surface, this.model));
modeManager.register(Modes.USER, new UserMode(surface, this.model));
modeManager.register(Modes.FUNCTIONS, new OptionsMode(surface, this.model));
modeManager.register(Modes.GROOVE, new SequencerResolutionMode(surface, this.model));
modeManager.register(Modes.NOTE, new NoteMode(surface, this.model));
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class PlayView method onButtonRow2.
/**
* {@inheritDoc}
*/
@Override
public void onButtonRow2(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final Modes cm = modeManager.getActiveID();
if (!Modes.PLAY_OPTIONS.equals(cm))
modeManager.setActive(Modes.PLAY_OPTIONS);
switch(index) {
// Down
case 0:
this.clearPressedKeys();
this.scales.decDrumOctave();
this.model.getDrumDevice().getDrumPadBank().selectPreviousPage();
this.updateNoteMapping();
this.surface.getDisplay().notify(this.scales.getDrumRangeText());
break;
// Up
case 1:
this.clearPressedKeys();
this.scales.incDrumOctave();
this.model.getDrumDevice().getDrumPadBank().selectNextPage();
this.updateNoteMapping();
this.surface.getDisplay().notify(this.scales.getDrumRangeText());
break;
case 2:
this.changeResolution(0);
this.surface.getDisplay().notify(Resolution.getNameAt(this.selectedResolutionIndex));
break;
case 3:
this.changeResolution(127);
this.surface.getDisplay().notify(Resolution.getNameAt(this.selectedResolutionIndex));
break;
case 4:
this.changeScrollPosition(0);
break;
case 5:
this.changeScrollPosition(127);
break;
case 6:
break;
// Toggle play / sequencer
case 7:
this.isPlayMode = !this.isPlayMode;
this.surface.getDisplay().notify(this.isPlayMode ? "Play/Select" : "Sequence");
this.updateNoteMapping();
break;
default:
// Intentionally empty
break;
}
}
use of de.mossgrabers.framework.featuregroup.ModeManager in project DrivenByMoss by git-moss.
the class MastertrackTouchCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
final boolean isTouched = event != ButtonEvent.UP;
// Avoid accidentally leaving the browser
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActive(Modes.BROWSER))
return;
final IMasterTrack masterTrack = this.model.getMasterTrack();
masterTrack.touchVolume(isTouched);
if (this.surface.isDeletePressed()) {
this.surface.setTriggerConsumed(ButtonID.DELETE);
masterTrack.resetVolume();
return;
}
final boolean isMasterMode = modeManager.isActive(Modes.MASTER);
if (isTouched && isMasterMode)
return;
if (isTouched)
modeManager.setTemporary(Modes.MASTER_TEMP);
else if (!isMasterMode)
modeManager.restore();
}
Aggregations