use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class APCControlSurface method handleMidi.
/**
* {@inheritDoc}
*/
@Override
protected void handleMidi(final int status, final int data1, final int data2) {
final int code = status & 0xF0;
final int channel = status & 0xF;
switch(code) {
// Note on/off
case 0x80:
case 0x90:
int note = data1;
if (!this.isMkII && data1 >= 53 && data1 <= 57)
note = (4 - (data1 - APC_BUTTON_CLIP_LAUNCH_1)) * 8 + channel;
if (this.isGridNote(note))
this.handleGridNote(note, code == 0x80 ? 0 : data2);
else
this.handleCC(channel, note, code == 0x80 ? 0 : data2);
break;
// CC
case 0xB0:
final View view = this.viewManager.getActiveView();
if (view == null)
return;
final Integer commandID = this.getContinuousCommand(data1, channel);
if (commandID != null)
view.executeContinuousCommand(commandID, data2);
if (data1 == APCControlSurface.APC_FOOTSWITCH_2)
view.executeTriggerCommand(this.getTriggerCommand(APCControlSurface.APC_FOOTSWITCH_2), data2 > 0 ? ButtonEvent.DOWN : ButtonEvent.UP);
break;
default:
this.host.println("Unhandled midi status: " + status);
break;
}
}
use of de.mossgrabers.framework.view.View 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();
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class LaunchpadCursorCommand method scrollLeft.
/**
* {@inheritDoc}
*/
@SuppressWarnings("rawtypes")
@Override
protected void scrollLeft() {
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActiveView(Views.VIEW_PLAY)) {
final Scales scales = this.model.getScales();
scales.prevScale();
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.previousParameterPage();
this.surface.getDisplay().notify(cursorDevice.getSelectedParameterPageName());
return;
}
if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
this.model.getBrowser().previousContentType();
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).onLeft(ButtonEvent.DOWN);
return;
}
// VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
this.scrollTracksLeft();
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class RightCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack sel = tb.getSelectedTrack();
final int index = sel == null ? 0 : sel.getIndex() + 1;
final View view = this.surface.getViewManager().getActiveView();
if (index == 8 || this.surface.isShiftPressed()) {
if (!tb.canScrollTracksDown())
return;
tb.scrollTracksPageDown();
final int newSel = index == 8 || sel == null ? 0 : sel.getIndex();
this.surface.scheduleTask(() -> view.selectTrack(newSel), 75);
return;
}
view.selectTrack(index);
}
use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.
the class LaunchpadControllerSetup method updateIndication.
private void updateIndication() {
final ViewManager viewManager = this.getSurface().getViewManager();
final boolean isVolume = viewManager.isActiveView(Views.VIEW_VOLUME);
final boolean isPan = viewManager.isActiveView(Views.VIEW_PAN);
final boolean isSends = viewManager.isActiveView(Views.VIEW_SENDS);
final boolean isDevice = viewManager.isActiveView(Views.VIEW_DEVICE);
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final View view = viewManager.getActiveView();
final int selSend = view instanceof SendsView ? ((SendsView) view).getSelectedSend() : -1;
final boolean isSession = view instanceof SessionView && !isVolume && !isPan && !isSends;
final boolean isEffect = this.model.isEffectTrackBankActive();
tb.setIndication(!isEffect && isSession);
tbe.setIndication(isEffect && isSession);
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect && isVolume);
track.setPanIndication(!isEffect && isPan);
for (int j = 0; j < 8; j++) track.getSend(j).setIndication(!isEffect && isSends && selSend == j);
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect && isVolume);
fxTrack.setPanIndication(isEffect && isPan);
cursorDevice.indicateParameter(i, isDevice);
}
}
Aggregations