Search in sources :

Example 6 with Modes

use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.

the class PlayView method onButtonRow2.

/**
 * {@inheritDoc}
 */
@Override
public void onButtonRow2(final int index, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    final Modes cm = modeManager.getActiveID();
    if (!Modes.PLAY_OPTIONS.equals(cm))
        modeManager.setActive(Modes.PLAY_OPTIONS);
    switch(index) {
        // Down
        case 0:
            this.clearPressedKeys();
            this.scales.decDrumOctave();
            this.model.getDrumDevice().getDrumPadBank().selectPreviousPage();
            this.updateNoteMapping();
            this.surface.getDisplay().notify(this.scales.getDrumRangeText());
            break;
        // Up
        case 1:
            this.clearPressedKeys();
            this.scales.incDrumOctave();
            this.model.getDrumDevice().getDrumPadBank().selectNextPage();
            this.updateNoteMapping();
            this.surface.getDisplay().notify(this.scales.getDrumRangeText());
            break;
        case 2:
            this.changeResolution(0);
            this.surface.getDisplay().notify(Resolution.getNameAt(this.selectedResolutionIndex));
            break;
        case 3:
            this.changeResolution(127);
            this.surface.getDisplay().notify(Resolution.getNameAt(this.selectedResolutionIndex));
            break;
        case 4:
            this.changeScrollPosition(0);
            break;
        case 5:
            this.changeScrollPosition(127);
            break;
        case 6:
            break;
        // Toggle play / sequencer
        case 7:
            this.isPlayMode = !this.isPlayMode;
            this.surface.getDisplay().notify(this.isPlayMode ? "Play/Select" : "Sequence");
            this.updateNoteMapping();
            break;
        default:
            // Intentionally empty
            break;
    }
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 7 with Modes

use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.

the class PlayView method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    final int buttonIDOrdinal = buttonID.ordinal();
    // Button row 2: Track toggles
    if (buttonIDOrdinal >= ButtonID.ROW1_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW1_8.ordinal() || buttonIDOrdinal >= ButtonID.ROW2_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW2_8.ordinal())
        return SLControlSurface.MKII_BUTTON_STATE_OFF;
    final Modes mode = this.surface.getModeManager().getActiveID();
    final boolean isSession = Modes.SESSION == mode;
    final boolean isDevice = Modes.DEVICE_PARAMS == mode;
    final boolean isPlayOptions = Modes.PLAY_OPTIONS == mode;
    final boolean isTrack = Modes.TRACK == mode;
    final boolean isVolume = Modes.VOLUME == mode;
    switch(buttonID) {
        case ROW_SELECT_1:
            return isSession ? 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 isPlayOptions ? 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_5:
            return 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:
        case ROW_SELECT_8:
            return SLControlSurface.MKII_BUTTON_STATE_OFF;
        default:
            // Fall through
            break;
    }
    // Transport buttons
    if (this.surface.isTransportActive()) {
        if (buttonIDOrdinal >= ButtonID.ROW3_1.ordinal() && buttonIDOrdinal <= ButtonID.ROW3_8.ordinal())
            return SLControlSurface.MKII_BUTTON_STATE_OFF;
        final ITransport transport = this.model.getTransport();
        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;
            default:
                return 0;
        }
    }
    // Draw sequencer
    return this.drawDrumGrid(buttonIDOrdinal);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ITransport(de.mossgrabers.framework.daw.ITransport)

Example 8 with Modes

use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.

the class PushConfiguration method activateDebugSettings.

/**
 * Activate the debug settings.
 *
 * @param settingsUI The settings
 */
private void activateDebugSettings(final ISettingsUI settingsUI) {
    final String[] modes = new String[DEBUG_MODES.size()];
    int i = 0;
    for (final Modes mode : DEBUG_MODES) {
        modes[i] = mode.toString();
        i++;
    }
    this.debugModeSetting = settingsUI.getEnumSetting("Display Mode", CATEGORY_DEBUG, modes, Modes.TRACK.toString());
    this.debugModeSetting.addValueObserver(value -> {
        try {
            this.debugMode = Modes.valueOf(value);
        } catch (final IllegalArgumentException ex) {
            this.debugMode = Modes.TRACK;
        }
        this.notifyObservers(DEBUG_MODE);
    });
    if (!this.isPush2)
        return;
    settingsUI.getSignalSetting(" ", CATEGORY_DEBUG, "Display window").addSignalObserver(value -> this.notifyObservers(DEBUG_WINDOW));
}
Also used : Modes(de.mossgrabers.framework.mode.Modes)

Example 9 with Modes

use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.

the class SetupCommand 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 Modes mode = this.getMode();
    if (modeManager.isActive(mode))
        modeManager.restore();
    else
        modeManager.setTemporary(mode);
}
Also used : Modes(de.mossgrabers.framework.mode.Modes) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 10 with Modes

use of de.mossgrabers.framework.mode.Modes in project DrivenByMoss by git-moss.

the class SoloCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    // Update for key combinations
    this.surface.getViewManager().getActive().updateNoteMapping();
    if (this.surface.isSelectPressed()) {
        if (event == ButtonEvent.UP)
            this.model.getProject().clearSolo();
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2()) {
        config.setTrackState(TrackState.SOLO);
        return;
    }
    // Toggle solo lock mode
    if (this.surface.isShiftPressed()) {
        if (event == ButtonEvent.UP) {
            if (config.isMuteSoloLocked() && config.isSoloState())
                config.setMuteSoloLocked(false);
            else {
                config.setMuteSoloLocked(true);
                config.setTrackState(TrackState.SOLO);
            }
        }
        return;
    }
    // Behaviour like Push 1
    if (config.isMuteSoloLocked()) {
        config.setTrackState(TrackState.SOLO);
        return;
    }
    if (event == ButtonEvent.DOWN) {
        config.setIsSoloLongPressed(false);
        return;
    }
    if (event == ButtonEvent.LONG) {
        config.setIsSoloLongPressed(true);
        config.setTrackState(TrackState.SOLO);
        return;
    }
    if (config.isSoloLongPressed()) {
        config.setIsSoloLongPressed(false);
        return;
    }
    final Modes activeModeId = this.surface.getModeManager().getActiveID();
    if (Modes.isLayerMode(activeModeId)) {
        final ICursorDevice cd = this.model.getCursorDevice();
        final Optional<?> layer = cd.getLayerBank().getSelectedItem();
        if (layer.isPresent())
            ((ILayer) layer.get()).toggleSolo();
    } else if (Modes.MASTER.equals(activeModeId))
        this.model.getMasterTrack().toggleSolo();
    else
        this.model.getCursorTrack().toggleSolo();
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) Modes(de.mossgrabers.framework.mode.Modes) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Aggregations

Modes (de.mossgrabers.framework.mode.Modes)35 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)22 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)13 ITrack (de.mossgrabers.framework.daw.data.ITrack)8 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)6 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)5 ITransport (de.mossgrabers.framework.daw.ITransport)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)2 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)2 GenericFlexiControlSurface (de.mossgrabers.controller.generic.controller.GenericFlexiControlSurface)1 MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)1 StudioEncoderModeManager (de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)1 P2ButtonCommand (de.mossgrabers.controller.novation.sl.command.trigger.P2ButtonCommand)1 DevicePresetsMode (de.mossgrabers.controller.novation.sl.mode.device.DevicePresetsMode)1 SLParameterMode (de.mossgrabers.controller.novation.sl.mode.device.SLParameterMode)1 ContinuousCommand (de.mossgrabers.framework.command.core.ContinuousCommand)1 PitchbendCommand (de.mossgrabers.framework.command.core.PitchbendCommand)1 TriggerCommand (de.mossgrabers.framework.command.core.TriggerCommand)1 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)1