Search in sources :

Example 66 with ICursorDevice

use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.

the class TrackTogglesMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITrack cursorTrack = this.model.getCursorTrack();
    final ITextDisplay d = this.surface.getTextDisplay().clearRow(0).clearRow(1);
    if (!cursorTrack.doesExist()) {
        d.setRow(0, "                        Please select a track...                       ").done(0).done(1);
        return;
    }
    final ICursorDevice device = this.model.getCursorDevice();
    d.setCell(0, 0, "  Mute");
    d.setCell(1, 0, cursorTrack.isMute() ? ON : OFF);
    d.setCell(0, 1, "  Solo");
    d.setCell(1, 1, cursorTrack.isSolo() ? ON : OFF);
    d.setCell(0, 2, "Rec Arm");
    d.setCell(1, 2, cursorTrack.isRecArm() ? ON : OFF);
    d.setCell(0, 3, " Write");
    d.setCell(1, 3, this.model.getTransport().isWritingArrangerAutomation() ? ON : OFF);
    d.setCell(0, 4, " Browse");
    d.setCell(1, 4, "");
    d.setCell(0, 5, device.doesExist() ? device.getName(8) : "None");
    d.setCell(1, 5, device.isEnabled() ? "Enabled" : "Disabled");
    d.setCell(0, 6, "<<Device").setCell(2, 6, "");
    d.setCell(0, 7, "Device>>").setCell(2, 7, "").done(0).done(2);
    d.done(0).done(1);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 67 with ICursorDevice

use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.

the class ControlView method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ICursorDevice cd = this.model.getCursorDevice();
    final ITransport transport = this.model.getTransport();
    final int clipLength = this.surface.getConfiguration().getNewClipLength();
    final Modes mode = this.surface.getModeManager().getActiveID();
    final boolean isFunctions = Modes.FUNCTIONS.equals(mode);
    final boolean isViewSelectMode = Modes.VIEW_SELECT.equals(mode);
    switch(buttonID) {
        case ROW1_1:
            if (isViewSelectMode)
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            return !isFunctions && clipLength == 0 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW1_2:
            if (isViewSelectMode)
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            return !isFunctions && clipLength == 1 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW1_3:
            if (isViewSelectMode)
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            return !isFunctions && clipLength == 2 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW1_4:
            if (isViewSelectMode)
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            return !isFunctions && clipLength == 3 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW1_5:
            if (isViewSelectMode)
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            return !isFunctions && clipLength == 4 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW1_6:
            if (isViewSelectMode)
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            return isFunctions && this.model.getCursorDevice().isWindowOpen() || !isFunctions && clipLength == 5 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW1_7:
            if (isViewSelectMode)
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            return isFunctions && transport.isMetronomeOn() || !isFunctions && clipLength == 6 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW1_8:
            if (isViewSelectMode)
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            return !isFunctions && clipLength == 7 ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        default:
            // Fall through
            break;
    }
    // Button row 2: Track toggles / Browse
    if (Modes.BROWSER.equals(mode)) {
        final int selMode = ((DevicePresetsMode) this.surface.getModeManager().get(Modes.BROWSER)).getSelectionMode();
        switch(buttonID) {
            case ROW2_1:
            case ROW2_2:
            case ROW2_8:
                return SLControlSurface.MKII_BUTTON_STATE_ON;
            case ROW2_3:
            case ROW2_4:
            case ROW2_5:
            case ROW2_6:
            case ROW2_7:
                return selMode == DevicePresetsMode.SELECTION_OFF ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            default:
                // Fall through
                break;
        }
    } else {
        final boolean isNoOverlayMode = !Modes.FRAME.equals(mode) && !Modes.BROWSER.equals(mode);
        final Optional<ITrack> track = tb.getSelectedItem();
        switch(buttonID) {
            case ROW2_1:
                return isNoOverlayMode && track.isPresent() && track.get().isMute() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            case ROW2_2:
                return isNoOverlayMode && track.isPresent() && track.get().isSolo() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            case ROW2_3:
                return isNoOverlayMode && track.isPresent() && track.get().isRecArm() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            case ROW2_4:
                return transport.isWritingArrangerAutomation() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            case ROW2_5:
                return SLControlSurface.MKII_BUTTON_STATE_OFF;
            case ROW2_6:
                return this.model.getCursorDevice().isEnabled() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            case ROW2_7:
                return isNoOverlayMode && cd.canSelectPreviousFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            case ROW2_8:
                return isNoOverlayMode && cd.canSelectNextFX() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
            default:
                // Fall through
                break;
        }
    }
    // Button row 3: Selected track indication
    final int buttonIDOrdinal = buttonID.ordinal();
    if (buttonIDOrdinal >= ButtonID.ROW3_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW3_8.ordinal()) {
        final int index = buttonIDOrdinal - ButtonID.ROW3_1.ordinal();
        return tb.getItem(index).isSelected() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
    }
    final boolean isTrack = Modes.TRACK.equals(mode);
    final boolean isTrackToggles = Modes.TRACK_DETAILS.equals(mode);
    final boolean isVolume = Modes.VOLUME.equals(mode);
    final boolean isFixed = Modes.FIXED.equals(mode);
    final boolean isFrame = Modes.FRAME.equals(mode);
    final boolean isPreset = Modes.BROWSER.equals(mode);
    final boolean isDevice = Modes.DEVICE_PARAMS.equals(mode);
    // Transport buttons
    switch(buttonID) {
        case ROW4_3:
            return !transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW4_4:
            return transport.isPlaying() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW4_5:
            return transport.isLoop() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW4_6:
            return transport.isRecording() ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW_SELECT_1:
            return isFunctions || isFixed ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW_SELECT_2:
            return isDevice ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW_SELECT_3:
            return isTrackToggles || isFrame || isPreset ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW_SELECT_4:
            return isTrack ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW_SELECT_6:
            return isVolume ? SLControlSurface.MKII_BUTTON_STATE_ON : SLControlSurface.MKII_BUTTON_STATE_OFF;
        case ROW_SELECT_7:
            return SLControlSurface.MKII_BUTTON_STATE_OFF;
        default:
            return 0;
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ITransport(de.mossgrabers.framework.daw.ITransport) DevicePresetsMode(de.mossgrabers.controller.novation.sl.mode.device.DevicePresetsMode) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Aggregations

ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)67 IParameter (de.mossgrabers.framework.daw.data.IParameter)17 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)14 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)10 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)8 ILayer (de.mossgrabers.framework.daw.data.ILayer)8 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)8 ITrack (de.mossgrabers.framework.daw.data.ITrack)7 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)7 IBrowser (de.mossgrabers.framework.daw.IBrowser)5 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)5 Modes (de.mossgrabers.framework.mode.Modes)5 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)3 ITransport (de.mossgrabers.framework.daw.ITransport)3 IDevice (de.mossgrabers.framework.daw.data.IDevice)3 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)3 IDrumPadBank (de.mossgrabers.framework.daw.data.bank.IDrumPadBank)3 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2