use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class BrowserView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
final IBrowser browser = this.model.getBrowser();
final ViewManager viewManager = this.surface.getViewManager();
if (!browser.isActive()) {
if (viewManager.isActiveView(Views.VIEW_BROWSER))
viewManager.restoreView();
return;
}
switch(note) {
// Cancel
case 0:
if (velocity == 0)
return;
this.model.getBrowser().stopBrowsing(false);
viewManager.restoreView();
break;
// OK
case 7:
if (velocity == 0)
return;
this.model.getBrowser().stopBrowsing(true);
viewManager.restoreView();
break;
case 2:
this.surface.sendMidiEvent(0x90, 48, velocity);
break;
case 3:
this.surface.sendMidiEvent(0x90, 60, velocity);
break;
case 4:
this.surface.sendMidiEvent(0x90, 72, velocity);
break;
case 5:
this.surface.sendMidiEvent(0x90, 84, velocity);
break;
}
if (velocity == 0)
return;
if (note >= 16 && note < 48) {
final int n = note - 16;
final int row = n / 8;
final int col = n % 8;
switch(col) {
case 6:
return;
case 7:
if (row == 0)
browser.selectNextResult();
else if (row == 1) {
for (int i = 0; i < 8; i++) browser.selectNextResult();
} else if (row == 2) {
for (int i = 0; i < 8; i++) browser.selectPreviousResult();
} else if (row == 3)
browser.selectPreviousResult();
break;
default:
if (row == 0)
browser.selectNextFilterItem(col);
else if (row == 1) {
for (int i = 0; i < 8; i++) browser.selectNextFilterItem(col);
} else if (row == 2) {
for (int i = 0; i < 8; i++) browser.selectPreviousFilterItem(col);
} else if (row == 3)
browser.selectPreviousFilterItem(col);
break;
}
}
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class ShiftView method onSelectTrack.
/**
* {@inheritDoc}
*/
@Override
public void onSelectTrack(final int index, final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
switch(index) {
case 0:
this.model.getCurrentTrackBank().scrollScenesPageUp();
break;
case 1:
this.model.getCurrentTrackBank().scrollScenesPageDown();
break;
case 2:
this.model.getCurrentTrackBank().scrollTracksPageUp();
break;
case 3:
this.model.getCurrentTrackBank().scrollTracksPageDown();
break;
case 4:
this.surface.getModeManager().setActiveMode(Modes.MODE_VOLUME);
this.surface.getConfiguration().setFaderCtrl("Volume");
this.surface.getDisplay().notify("Volume");
break;
case 5:
this.surface.getModeManager().setActiveMode(Modes.MODE_PAN);
this.surface.getConfiguration().setFaderCtrl("Pan");
this.surface.getDisplay().notify("Pan");
break;
case 6:
if (this.model.isEffectTrackBankActive())
return;
final ModeManager modeManager = this.surface.getModeManager();
Integer mode = Integer.valueOf(modeManager.getActiveModeId().intValue() + 1);
// Wrap
if (!Modes.isSendMode(mode))
mode = Modes.MODE_SEND1;
// Check if Send channel exists
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
if (Modes.isSendMode(mode) && fxTrackBank != null && !fxTrackBank.getTrack(mode.intValue() - Modes.MODE_SEND1.intValue()).doesExist())
mode = Modes.MODE_SEND1;
modeManager.setActiveMode(mode);
final String name = "Send " + (mode.intValue() - Modes.MODE_SEND1.intValue() + 1);
this.surface.getConfiguration().setFaderCtrl(name);
this.surface.getDisplay().notify(name);
break;
case 7:
if (this.surface.getModeManager().isActiveMode(Modes.MODE_DEVICE)) {
this.model.getBrowser().browseForPresets();
final ViewManager viewManager = this.surface.getViewManager();
final Integer previousViewId = viewManager.getPreviousViewId();
viewManager.setActiveView(Views.VIEW_BROWSER);
viewManager.setPreviousView(previousViewId);
} else {
this.surface.getModeManager().setActiveMode(Modes.MODE_DEVICE);
this.surface.getConfiguration().setFaderCtrl("Device");
this.surface.getDisplay().notify("Device");
}
break;
}
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class ShiftCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
if (event == ButtonEvent.LONG)
return;
final ViewManager viewManager = this.surface.getViewManager();
if (event == ButtonEvent.DOWN && !viewManager.isActiveView(Views.VIEW_SHIFT))
viewManager.setActiveView(Views.VIEW_SHIFT);
else if (event == ButtonEvent.UP && viewManager.isActiveView(Views.VIEW_SHIFT))
viewManager.restoreView();
this.model.getValueChanger().setSpeed(this.surface.isShiftPressed());
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class LaunchpadCursorCommand method updateArrowStates.
/**
* {@inheritDoc}
*/
@Override
protected void updateArrowStates() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActiveView(Views.VIEW_PLAY)) {
final Scales scales = this.model.getScales();
final int octave = scales.getOctave();
this.canScrollUp = octave < 3;
this.canScrollDown = octave > -3;
final int scale = scales.getScale().ordinal();
this.canScrollLeft = scale > 0;
this.canScrollRight = scale < Scale.values().length - 1;
return;
}
if (viewManager.isActiveView(Views.VIEW_DRUM)) {
final int octave = this.model.getScales().getDrumOctave();
this.canScrollUp = octave < 5;
this.canScrollDown = octave > -3;
this.canScrollLeft = this.model.getCursorClip().getEditPage() > 0;
// TODO API extension required - We do not know the number of steps
this.canScrollRight = true;
return;
}
if (viewManager.isActiveView(Views.VIEW_DRUM64)) {
final DrumView64 drumView64 = (DrumView64) viewManager.getView(Views.VIEW_DRUM64);
final int octave = drumView64.getDrumOctave();
this.canScrollUp = octave < 1;
this.canScrollDown = octave > -2;
this.canScrollLeft = false;
this.canScrollRight = false;
return;
}
if (viewManager.isActiveView(Views.VIEW_SEQUENCER) || viewManager.isActiveView(Views.VIEW_RAINDROPS)) {
final int octave = this.model.getScales().getOctave();
this.canScrollUp = octave < Scales.OCTAVE_RANGE;
this.canScrollDown = octave > -Scales.OCTAVE_RANGE;
this.canScrollLeft = this.model.getCursorClip().getEditPage() > 0;
// TODO API extension required - We do not know the number of steps
this.canScrollRight = true;
return;
}
if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
this.canScrollUp = cursorDevice.canSelectNextFX();
this.canScrollDown = cursorDevice.canSelectPreviousFX();
this.canScrollLeft = cursorDevice.hasPreviousParameterPage();
this.canScrollRight = cursorDevice.hasNextParameterPage();
return;
}
if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
final IBrowser browser = this.model.getBrowser();
final int index = browser.getSelectedContentTypeIndex();
this.canScrollUp = false;
this.canScrollDown = false;
this.canScrollLeft = index > 0;
this.canScrollRight = index < browser.getContentTypeNames().length - 1;
return;
}
if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM4) || viewManager.isActiveView(Views.VIEW_DRUM8)) {
this.canScrollUp = false;
this.canScrollDown = false;
this.canScrollLeft = false;
this.canScrollRight = false;
return;
}
// VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
final ITrack sel = tb.getSelectedTrack();
final int selIndex = sel != null ? sel.getIndex() : -1;
this.canScrollLeft = selIndex > 0 || tb.canScrollTracksUp();
this.canScrollRight = selIndex >= 0 && selIndex < 7 && tb.getTrack(selIndex + 1).doesExist() || tb.canScrollTracksDown();
this.canScrollUp = tb.canScrollScenesUp();
this.canScrollDown = tb.canScrollScenesDown();
}
use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.
the class LaunchpadCursorCommand method scrollRight.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
protected void scrollRight() {
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActiveView(Views.VIEW_PLAY)) {
final Scales scales = this.model.getScales();
scales.nextScale();
final String name = scales.getScale().getName();
this.surface.getConfiguration().setScale(name);
this.surface.getDisplay().notify(name);
return;
}
if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
cursorDevice.nextParameterPage();
this.surface.getDisplay().notify(cursorDevice.getSelectedParameterPageName());
return;
}
if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
this.model.getBrowser().nextContentType();
return;
}
if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM64))
return;
// VIEW_SEQUENCER, VIEW_RAINDROPS, VIEW_DRUM, VIEW_DRUM4, VIEW_DRUM8
final View activeView = viewManager.getActiveView();
if (activeView instanceof AbstractSequencerView) {
((AbstractSequencerView) activeView).onRight(ButtonEvent.DOWN);
return;
}
// VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
this.scrollTracksRight();
}
Aggregations