Search in sources :

Example 6 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class LaunchpadControllerSetup method updateButtons.

private void updateButtons() {
    final LaunchpadControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final View activeView = viewManager.getActiveView();
    if (activeView != null) {
        ((LaunchpadCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
        ((SceneView) activeView).updateSceneButtons();
    }
    if (!this.isPro) {
        surface.setButton(LaunchpadControlSurface.LAUNCHPAD_MKII_BUTTON_USER, surface.isUserPressed() ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
        return;
    }
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_PRO_BUTTON_USER, LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
    final boolean isShift = surface.isShiftPressed();
    final ITrack selTrack = this.model.getCurrentTrackBank().getSelectedTrack();
    final int index = selTrack == null ? -1 : selTrack.getIndex();
    final ModeManager modeManager = surface.getModeManager();
    final ITransport transport = this.model.getTransport();
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SHIFT, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_CLICK, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : transport.isMetronomeOn() ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_UNDO, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DELETE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_QUANTIZE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DOUBLE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    final boolean flipRecord = surface.getConfiguration().isFlipRecord();
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_RECORD, isShift && !flipRecord || !isShift && flipRecord ? transport.isLauncherOverdub() ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : LaunchpadColors.LAUNCHPAD_COLOR_RED_AMBER : transport.isRecording() ? LaunchpadColors.LAUNCHPAD_COLOR_RED_HI : LaunchpadColors.LAUNCHPAD_COLOR_RED_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_REC_ARM, modeManager.isActiveMode(Modes.MODE_REC_ARM) ? LaunchpadColors.LAUNCHPAD_COLOR_RED : index == 0 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_TRACK, modeManager.isActiveMode(Modes.MODE_TRACK_SELECT) ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN : index == 1 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_MUTE, modeManager.isActiveMode(Modes.MODE_MUTE) ? LaunchpadColors.LAUNCHPAD_COLOR_YELLOW : index == 2 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SOLO, modeManager.isActiveMode(Modes.MODE_SOLO) ? LaunchpadColors.LAUNCHPAD_COLOR_BLUE : index == 3 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_VOLUME, viewManager.isActiveView(Views.VIEW_VOLUME) ? LaunchpadColors.LAUNCHPAD_COLOR_CYAN : index == 4 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_PAN, viewManager.isActiveView(Views.VIEW_PAN) ? LaunchpadColors.LAUNCHPAD_COLOR_SKY : index == 5 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SENDS, viewManager.isActiveView(Views.VIEW_SENDS) ? LaunchpadColors.LAUNCHPAD_COLOR_ORCHID : index == 6 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_STOP_CLIP, modeManager.isActiveMode(Modes.MODE_STOP_CLIP) ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : index == 7 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    // Update the front LED with the color of the current track
    final ITrack track = index == -1 ? null : this.model.getCurrentTrackBank().getTrack(index);
    final int color = track != null && track.doesExist() ? this.colorManager.getColor(BitwigColors.getColorIndex(track.getColor())) : 0;
    surface.sendLaunchpadSysEx("0A 63 " + StringUtils.toHexStr(color));
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITransport(de.mossgrabers.framework.daw.ITransport) SceneView(de.mossgrabers.framework.view.SceneView) ViewManager(de.mossgrabers.framework.view.ViewManager) VolumeView(de.mossgrabers.launchpad.view.VolumeView) SessionView(de.mossgrabers.launchpad.view.SessionView) SequencerView(de.mossgrabers.launchpad.view.SequencerView) SceneView(de.mossgrabers.framework.view.SceneView) DeviceView(de.mossgrabers.launchpad.view.DeviceView) View(de.mossgrabers.framework.view.View) PanView(de.mossgrabers.launchpad.view.PanView) RaindropsView(de.mossgrabers.launchpad.view.RaindropsView) BrowserView(de.mossgrabers.launchpad.view.BrowserView) DrumView(de.mossgrabers.launchpad.view.DrumView) SendsView(de.mossgrabers.launchpad.view.SendsView) ShiftView(de.mossgrabers.launchpad.view.ShiftView) PlayView(de.mossgrabers.launchpad.view.PlayView) LaunchpadControlSurface(de.mossgrabers.launchpad.controller.LaunchpadControlSurface) LaunchpadCursorCommand(de.mossgrabers.launchpad.command.trigger.LaunchpadCursorCommand) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 7 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class LeftCommand 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 == -1 || this.surface.isShiftPressed()) {
        if (!tb.canScrollTracksUp())
            return;
        tb.scrollTracksPageUp();
        final int newSel = index == -1 || sel == null ? 7 : sel.getIndex();
        this.surface.scheduleTask(() -> view.selectTrack(newSel), 75);
        return;
    }
    view.selectTrack(index);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) View(de.mossgrabers.framework.view.View)

Example 8 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class DeviceParamsMode method moveUp.

/**
 * Move up the hierarchy.
 */
protected void moveUp() {
    // There is no device on the track move upwards to the track view
    final ICursorDevice cd = this.model.getCursorDevice();
    final View activeView = this.surface.getViewManager().getActiveView();
    if (!cd.hasSelectedDevice()) {
        activeView.executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
        return;
    }
    // Parameter banks are shown -> show devices
    final ModeManager modeManager = this.surface.getModeManager();
    final DeviceParamsMode deviceParamsMode = (DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS);
    if (!deviceParamsMode.isShowDevices()) {
        deviceParamsMode.setShowDevices(true);
        return;
    }
    // Devices are shown, if nested show the layers otherwise move up to the tracks
    if (cd.isNested()) {
        cd.selectParent();
        modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
        deviceParamsMode.setShowDevices(false);
        cd.selectChannel();
        return;
    }
    // Move up to the track
    if (this.model.isCursorDeviceOnMasterTrack()) {
        activeView.executeTriggerCommand(Commands.COMMAND_MASTERTRACK, ButtonEvent.DOWN);
        activeView.executeTriggerCommand(Commands.COMMAND_MASTERTRACK, ButtonEvent.UP);
    } else
        activeView.executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
}
Also used : View(de.mossgrabers.framework.view.View) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 9 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class PushControllerSetup method createObservers.

/**
 * {@inheritDoc}
 */
@Override
protected void createObservers() {
    final PushControlSurface surface = this.getSurface();
    if (this.configuration.isPush2()) {
        this.configuration.addSettingObserver(PushConfiguration.DISPLAY_BRIGHTNESS, surface::sendDisplayBrightness);
        this.configuration.addSettingObserver(PushConfiguration.LED_BRIGHTNESS, surface::sendLEDBrightness);
        this.configuration.addSettingObserver(PushConfiguration.PAD_SENSITIVITY, () -> {
            surface.sendPadVelocityCurve();
            surface.sendPadThreshold();
        });
        this.configuration.addSettingObserver(PushConfiguration.PAD_GAIN, () -> {
            surface.sendPadVelocityCurve();
            surface.sendPadThreshold();
        });
        this.configuration.addSettingObserver(PushConfiguration.PAD_DYNAMICS, () -> {
            surface.sendPadVelocityCurve();
            surface.sendPadThreshold();
        });
    } else {
        this.configuration.addSettingObserver(PushConfiguration.VELOCITY_CURVE, surface::sendPadSensitivity);
        this.configuration.addSettingObserver(PushConfiguration.PAD_THRESHOLD, surface::sendPadSensitivity);
    }
    surface.getModeManager().addModeListener((oldMode, newMode) -> {
        this.updateMode(null);
        this.updateMode(newMode);
    });
    surface.getViewManager().addViewChangeListener((previousViewId, activeViewId) -> {
        // Update button states
        final View view = surface.getViewManager().getActiveView();
        for (final int button : surface.getButtons()) {
            if (surface.shouldUpdateButton(button))
                surface.setButton(button, view.usesButton(button) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        }
        // Update ribbon mode
        if (Views.VIEW_SESSION.equals(activeViewId))
            surface.setRibbonMode(PushControlSurface.PUSH_RIBBON_PAN);
        else
            this.updateRibbonMode();
    });
    this.configuration.addSettingObserver(PushConfiguration.RIBBON_MODE, this::updateRibbonMode);
    this.configuration.addSettingObserver(PushConfiguration.SEND_PORT, () -> ((PushDisplay) surface.getDisplay()).setCommunicationPort(this.configuration.getSendPort()));
    this.configuration.addSettingObserver(PushConfiguration.DEBUG_MODE, () -> {
        final ModeManager modeManager = surface.getModeManager();
        final Integer debugMode = this.configuration.getDebugMode();
        if (modeManager.getMode(debugMode) != null)
            modeManager.setActiveMode(debugMode);
        else
            this.host.error("Mode " + debugMode + " not registered.");
    });
    this.createScaleObservers(this.configuration);
}
Also used : PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ColorView(de.mossgrabers.push.view.ColorView) PlayView(de.mossgrabers.push.view.PlayView) SequencerView(de.mossgrabers.push.view.SequencerView) ScenePlayView(de.mossgrabers.push.view.ScenePlayView) DrumView(de.mossgrabers.push.view.DrumView) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) ClipView(de.mossgrabers.push.view.ClipView) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) PrgChangeView(de.mossgrabers.push.view.PrgChangeView) PianoView(de.mossgrabers.push.view.PianoView) SessionView(de.mossgrabers.push.view.SessionView) RaindropsView(de.mossgrabers.push.view.RaindropsView) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 10 with View

use of de.mossgrabers.framework.view.View in project DrivenByMoss by git-moss.

the class NoteViewSelectMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1() {
    final Display d = this.surface.getDisplay();
    final ViewManager viewManager = this.surface.getViewManager();
    d.clear().setBlock(1, 0, "Note view:");
    for (int i = 0; i < VIEWS.length; i++) {
        if (VIEWS[i] != null) {
            final View view = viewManager.getView(VIEWS[i]);
            d.setCell(3, i, view == null ? "" : (viewManager.isActiveView(VIEWS[i]) ? PushDisplay.RIGHT_ARROW : "") + view.getName());
        }
        if (VIEWS_TOP[i] != null)
            d.setCell(0, i, (viewManager.isActiveView(VIEWS_TOP[i]) ? PushDisplay.RIGHT_ARROW : "") + viewManager.getView(VIEWS_TOP[i]).getName());
    }
    d.allDone();
}
Also used : ViewManager(de.mossgrabers.framework.view.ViewManager) View(de.mossgrabers.framework.view.View) Display(de.mossgrabers.framework.controller.display.Display) PushDisplay(de.mossgrabers.push.controller.PushDisplay)

Aggregations

View (de.mossgrabers.framework.view.View)24 ViewManager (de.mossgrabers.framework.view.ViewManager)9 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)8 SceneView (de.mossgrabers.framework.view.SceneView)8 ITrack (de.mossgrabers.framework.daw.data.ITrack)6 ModeManager (de.mossgrabers.framework.mode.ModeManager)6 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)5 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)5 ITransport (de.mossgrabers.framework.daw.ITransport)4 DrumView (de.mossgrabers.launchpad.view.DrumView)4 PlayView (de.mossgrabers.launchpad.view.PlayView)4 RaindropsView (de.mossgrabers.launchpad.view.RaindropsView)4 SequencerView (de.mossgrabers.launchpad.view.SequencerView)4 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)3 ClipView (de.mossgrabers.push.view.ClipView)3 ColorView (de.mossgrabers.push.view.ColorView)3 DrumView (de.mossgrabers.push.view.DrumView)3 PianoView (de.mossgrabers.push.view.PianoView)3 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)2 DrumView (de.mossgrabers.apc.view.DrumView)2