use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class MaschineControllerSetup method registerContinuousCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerContinuousCommands() {
final MaschineControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
final ViewManager viewManager = surface.getViewManager();
final IHwRelativeKnob knob = this.addRelativeKnob(ContinuousID.MASTER_KNOB, "Encoder", new MainKnobRowModeCommand(this.model, surface), MaschineControlSurface.ENCODER);
knob.bindTouch((event, velocity) -> {
final IMode mode = modeManager.getActive();
if (mode != null && event != ButtonEvent.LONG)
mode.onKnobTouch(8, event == ButtonEvent.DOWN);
}, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.ENCODER_TOUCH);
if (this.maschine.hasMCUDisplay()) {
for (int i = 0; i < 8; i++) {
final int index = i;
final IHwRelativeKnob modeKnob = this.addRelativeKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), new KnobRowModeCommand<>(i, this.model, surface), MaschineControlSurface.MODE_KNOB_1 + i);
modeKnob.bindTouch((event, velocity) -> {
final IMode mode = modeManager.getActive();
if (mode != null && event != ButtonEvent.LONG)
mode.onKnobTouch(index, event == ButtonEvent.DOWN);
}, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.MODE_KNOB_TOUCH_1 + i);
modeKnob.setIndexInGroup(i);
}
}
final TouchstripCommand touchstripCommand = new TouchstripCommand(this.model, surface);
this.addFader(ContinuousID.CROSSFADER, "Touchstrip", touchstripCommand, BindType.CC, MaschineControlSurface.TOUCHSTRIP, false);
surface.getContinuous(ContinuousID.CROSSFADER).bindTouch(touchstripCommand, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.TOUCHSTRIP_TOUCH);
// Enable aftertouch
final Views[] views = { Views.PLAY, Views.DRUM };
for (final Views viewID : views) {
final IView view = viewManager.get(viewID);
view.registerAftertouchCommand(new AftertouchViewCommand<>(view, this.model, surface));
}
if (this.maschine == Maschine.STUDIO) {
final IHwAbsoluteKnob masterKnob = this.addAbsoluteKnob(ContinuousID.MONITOR_KNOB, "Encoder", null, MaschineControlSurface.MONITOR_ENCODER);
this.encoderManager = new StudioEncoderModeManager(masterKnob, this.model, surface);
masterKnob.bind(this.encoderManager);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMaster = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.MASTER_VOLUME, this.model, surface);
this.addButton(ButtonID.ROW4_1, "MST", encoderCommandMaster, MaschineControlSurface.MONITOR_MST, encoderCommandMaster::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandSelectedTrack = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.SELECTED_TRACK_VOLUME, this.model, surface);
this.addButton(ButtonID.ROW4_2, "GRP", encoderCommandSelectedTrack, MaschineControlSurface.MONITOR_GRP, encoderCommandSelectedTrack::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMetronome = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.METRONOME_VOLUME, this.model, surface);
this.addButton(ButtonID.ROW4_3, "SND", encoderCommandMetronome, MaschineControlSurface.MONITOR_SND, encoderCommandMetronome::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandCue = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.CUE_VOLUME, this.model, surface);
this.addButton(ButtonID.ROW4_4, "CUE", encoderCommandCue, MaschineControlSurface.MONITOR_CUE, encoderCommandCue::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMasterPan = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.MASTER_PANORAMA, this.model, surface);
this.addButton(ButtonID.ROW4_5, "IN1", encoderCommandMasterPan, MaschineControlSurface.MONITOR_IN1, encoderCommandMasterPan::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandSelectedTrackPan = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.SELECTED_TRACK_PANORAMA, this.model, surface);
this.addButton(ButtonID.ROW4_6, "IN2", encoderCommandSelectedTrackPan, MaschineControlSurface.MONITOR_IN2, encoderCommandSelectedTrackPan::isLit);
final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandCueMix = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.CUE_MIX, this.model, surface);
this.addButton(ButtonID.ROW4_8, "IN4", encoderCommandCueMix, MaschineControlSurface.MONITOR_IN4, encoderCommandCueMix::isLit);
this.addButton(ButtonID.TOGGLE_VU, "IN3", (event, value) -> {
if (event == ButtonEvent.UP)
this.encoderManager.toggleMode();
}, MaschineControlSurface.MONITOR_IN3, this.encoderManager::isParameterMode);
// Activate the default mode
this.encoderManager.setActiveEncoderMode(EncoderMode.MASTER_VOLUME);
}
}
use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class ShiftView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
int viewIndex;
IView view;
final ICursorDevice cursorDevice = this.model.getCursorDevice();
switch(note - 36) {
// Play
case 0:
this.playCommand.executeNormal(ButtonEvent.UP);
break;
// Record
case 1:
this.model.getTransport().startRecording();
break;
// Repeat
case 2:
this.model.getTransport().toggleLoop();
break;
// Click
case 3:
this.model.getTransport().toggleMetronome();
break;
// Tap Tempo
case 4:
this.model.getTransport().tapTempo();
break;
// Insert device before current
case 5:
this.model.getBrowser().insertBeforeCursorDevice();
break;
// Insert device after current
case 6:
this.model.getBrowser().insertAfterCursorDevice();
break;
// Open the browser
case 7:
this.model.getBrowser().replace(cursorDevice);
break;
// Toggle window of VSTs
case 15:
cursorDevice.toggleWindowOpen();
break;
default:
viewIndex = note - 44;
if (viewIndex < 0 || viewIndex >= 6)
return;
final ViewManager viewManager = this.surface.getViewManager();
final Views viewId = VIEWS[viewIndex];
viewManager.setPreviousID(viewId);
view = viewManager.get(viewId);
this.surface.getDisplay().notify(view.getName());
break;
}
}
use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class NoteViewSelectView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ViewManager viewManager = this.surface.getViewManager();
final Views previousViewId = viewManager.getPreviousID();
final IPadGrid padGrid = this.surface.getPadGrid();
for (int i = 36; i < 60; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(60, previousViewId == Views.SEQUENCER ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_AMBER_HI);
padGrid.light(61, previousViewId == Views.POLY_SEQUENCER ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_AMBER_LO);
padGrid.light(62, previousViewId == Views.RAINDROPS ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_AMBER);
for (int i = 63; i < 76; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(76, previousViewId == Views.DRUM ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_HI);
padGrid.light(77, previousViewId == Views.DRUM4 ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE);
padGrid.light(78, previousViewId == Views.DRUM8 ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_BLUE_LO);
for (int i = 79; i < 92; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
padGrid.light(92, previousViewId == Views.PLAY ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_RED_HI);
padGrid.light(93, previousViewId == Views.PIANO ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_RED);
padGrid.light(94, previousViewId == Views.DRUM64 ? LaunchpadColorManager.LAUNCHPAD_COLOR_GREEN : LaunchpadColorManager.LAUNCHPAD_COLOR_RED_LO);
for (int i = 95; i < 100; i++) padGrid.light(i, LaunchpadColorManager.LAUNCHPAD_COLOR_BLACK);
}
use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class SelectNoteViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.UP)
return;
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActive(Views.CONTROL)) {
viewManager.restore();
this.surface.getDisplay().notify(viewManager.getActive().getName());
return;
}
Views viewID = viewManager.getActiveID();
if (Views.isNoteView(viewID) || Views.isSequencerView(viewID)) {
viewManager.setActive(Views.CONTROL);
this.surface.getDisplay().notify("Note / sequencer mode selection");
return;
}
final ITrack cursorTrack = this.model.getCursorTrack();
if (!cursorTrack.doesExist()) {
viewManager.setActive(Views.SESSION);
this.surface.getDisplay().notify("Session");
return;
}
viewID = viewManager.getPreferredView(cursorTrack.getPosition());
if (viewID == null)
viewID = Views.PLAY;
viewManager.setActive(viewID);
this.surface.getDisplay().notify(viewManager.get(viewID).getName());
}
use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class SelectPlayViewCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ITrack cursorTrack = this.model.getCursorTrack();
// Restore the previous play view if coming from one not on the list
final ViewManager viewManager = this.surface.getViewManager();
final Views activeViewId = viewManager.getActiveID();
if (cursorTrack.doesExist() && !this.allViewIds.contains(activeViewId)) {
final Views viewID = viewManager.getPreferredView(cursorTrack.getPosition());
if (viewID != null) {
viewManager.setActive(viewID);
this.surface.getDisplay().notify(viewManager.get(viewID).getName());
return;
}
}
super.executeNormal(event);
// Store the newly selected view for the current track
if (cursorTrack.doesExist())
viewManager.setPreferredView(cursorTrack.getPosition(), viewManager.getActiveID());
}
Aggregations