use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class ShiftView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
// Draw the keyboard
final int scaleOffset = this.scales.getScaleOffset();
// 0'C', 1'G', 2'D', 3'A', 4'E', 5'B', 6'F', 7'Bb', 8'Eb', 9'Ab', 10'Db', 11'Gb'
final IPadGrid padGrid = this.surface.getPadGrid();
for (int i = 7; i < 64; i++) padGrid.light(36 + i, APCminiColorManager.APC_COLOR_BLACK);
padGrid.light(36 + 0, scaleOffset == 0 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 1, scaleOffset == 2 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 2, scaleOffset == 4 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 3, scaleOffset == 6 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 4, scaleOffset == 1 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 5, scaleOffset == 3 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 6, scaleOffset == 5 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 9, scaleOffset == 10 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_RED);
padGrid.light(36 + 10, scaleOffset == 8 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_RED);
padGrid.light(36 + 12, scaleOffset == 11 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_RED);
padGrid.light(36 + 13, scaleOffset == 9 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_RED);
padGrid.light(36 + 14, scaleOffset == 7 ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_RED);
// Device Parameters up/down
padGrid.light(36 + 24, APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 25, APCminiColorManager.APC_COLOR_YELLOW);
// Device up/down
padGrid.light(36 + 32, APCminiColorManager.APC_COLOR_GREEN);
padGrid.light(36 + 33, APCminiColorManager.APC_COLOR_GREEN);
// Change the scale
padGrid.light(36 + 35, APCminiColorManager.APC_COLOR_RED);
padGrid.light(36 + 36, APCminiColorManager.APC_COLOR_RED);
padGrid.light(36 + 27, APCminiColorManager.APC_COLOR_GREEN);
// Draw the view selection: Session, Note, Drum, Sequencer
final Views previousViewId = this.surface.getViewManager().getActiveIDIgnoreTemporary();
padGrid.light(36 + 56, Views.SESSION == previousViewId ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 57, Views.PLAY == previousViewId ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 58, Views.DRUM == previousViewId ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 59, Views.SEQUENCER == previousViewId ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 60, Views.RAINDROPS == previousViewId ? APCminiColorManager.APC_COLOR_GREEN : APCminiColorManager.APC_COLOR_YELLOW);
// Draw transport
final ITransport transport = this.model.getTransport();
padGrid.light(36 + 63, transport.isPlaying() ? APCminiColorManager.APC_COLOR_GREEN_BLINK : APCminiColorManager.APC_COLOR_GREEN);
padGrid.light(36 + 55, transport.isRecording() ? APCminiColorManager.APC_COLOR_RED_BLINK : APCminiColorManager.APC_COLOR_RED);
padGrid.light(36 + 47, APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 39, APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 62, APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 54, transport.isLauncherOverdub() ? APCminiColorManager.APC_COLOR_RED_BLINK : APCminiColorManager.APC_COLOR_RED);
padGrid.light(36 + 46, APCminiColorManager.APC_COLOR_YELLOW);
padGrid.light(36 + 38, APCminiColorManager.APC_COLOR_YELLOW);
}
use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class AbstractControllerSetup method test.
/**
* {@inheritDoc}
*/
@Override
public void test(final TestCallback callback) {
final TestFramework framework = new TestFramework(this.host);
this.getSurfaces().forEach(surface -> {
framework.scheduleFunction(() -> this.host.println("Testing controller: " + this.getClass().getName()));
final ViewManager viewManager = surface.getViewManager();
final ModeManager modeManager = surface.getModeManager();
final int max = this.model.getValueChanger().getUpperBound() - 1;
for (final Views viewID : Views.values()) {
if (viewManager.get(viewID) == null)
continue;
for (final Modes modeID : Modes.values()) {
if (modeManager.get(modeID) == null)
continue;
framework.scheduleFunction(() -> {
this.host.println("- View " + viewID + " Mode " + modeID);
viewManager.setActive(viewID);
modeManager.setActive(modeID);
for (final ButtonID buttonID : ButtonID.values()) {
final IHwButton button = surface.getButton(buttonID);
if (button == null)
continue;
button.trigger(ButtonEvent.DOWN);
button.trigger(ButtonEvent.LONG);
button.trigger(ButtonEvent.UP);
}
for (final ContinuousID continuousID : ContinuousID.values()) {
final IHwContinuousControl continuous = surface.getContinuous(continuousID);
if (continuous == null)
continue;
final TriggerCommand touchCommand = continuous.getTouchCommand();
if (touchCommand != null) {
touchCommand.execute(ButtonEvent.DOWN, 127);
touchCommand.execute(ButtonEvent.LONG, 127);
touchCommand.execute(ButtonEvent.UP, 0);
}
final ContinuousCommand command = continuous.getCommand();
if (command != null) {
command.execute(0);
command.execute(max);
command.execute(max / 2);
}
final PitchbendCommand pitchbendCommand = continuous.getPitchbendCommand();
if (pitchbendCommand != null) {
pitchbendCommand.onPitchbend(0, 0);
pitchbendCommand.onPitchbend(0, 127);
pitchbendCommand.onPitchbend(0, 64);
}
}
});
}
}
});
callback.startTesting();
framework.executeScheduler(callback);
}
use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class SelectPlayViewCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final ModeManager modeManager = this.surface.getModeManager();
final ViewManager viewManager = this.surface.getViewManager();
if (Views.isSessionView(viewManager.getActiveID())) {
final ITrack cursorTrack = this.model.getCursorTrack();
if (!cursorTrack.doesExist()) {
this.surface.getDisplay().notify("Please select a track first.");
return;
}
final Views preferredView = viewManager.getPreferredView(cursorTrack.getPosition());
viewManager.setActive(preferredView == null ? Views.PLAY : preferredView);
if (modeManager.isActive(Modes.SESSION) || modeManager.isTemporary())
modeManager.restore();
return;
}
if (modeManager.isActive(Modes.VIEW_SELECT))
modeManager.restore();
else
modeManager.setTemporary(Modes.VIEW_SELECT);
}
use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class SessionView method onSession.
/**
* The session button was pressed.
*
* @param event The button event
*/
public void onSession(final ButtonEvent event) {
switch(event) {
case LONG:
this.isShowTemporarily = true;
break;
case UP:
if (!this.isShowTemporarily)
return;
this.isShowTemporarily = false;
final ViewManager viewManager = this.surface.getViewManager();
final ITrack cursorTrack = this.model.getCursorTrack();
if (!cursorTrack.doesExist())
return;
final Views viewId = viewManager.getPreferredView(cursorTrack.getPosition());
viewManager.setActive(viewId == null ? Views.PLAY : viewId);
break;
default:
// Intentionally empty
return;
}
}
use of de.mossgrabers.framework.view.Views in project DrivenByMoss by git-moss.
the class BrowserView method onDeactivate.
/**
* {@inheritDoc}
*/
@Override
public void onDeactivate() {
// Close the browser if still open
final IBrowser browser = this.model.getBrowser();
if (browser.isActive())
browser.stopBrowsing(false);
final ViewManager viewManager = this.surface.getViewManager();
final Views activeID = viewManager.getActiveID();
if (activeID == Views.BROWSER) {
// Browse (...) button does not send an 'up' event
this.surface.getButton(ButtonID.BROWSE).clearState();
final Views previousID = viewManager.getPreviousID();
final Integer id = VIEW_COMMANDS.get(previousID);
final int viewCommand = id == null || previousID == Views.BROWSER ? LaunchkeyMk3ControlSurface.PAD_MODE_SESSION : id.intValue();
this.surface.getMidiOutput().sendCCEx(15, LaunchkeyMk3ControlSurface.LAUNCHKEY_VIEW_SELECT, viewCommand);
}
}
Aggregations