Search in sources :

Example 1 with ICursorDevice

use of de.mossgrabers.framework.daw.data.ICursorDevice 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)

Example 2 with ICursorDevice

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

the class MuteCommand 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().clearMute();
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    if (!config.isPush2()) {
        config.setTrackState(TrackState.MUTE);
        return;
    }
    // Toggle mute lock mode
    if (this.surface.isShiftPressed()) {
        if (event == ButtonEvent.UP) {
            if (config.isMuteSoloLocked() && config.isMuteState())
                config.setMuteSoloLocked(false);
            else {
                config.setMuteSoloLocked(true);
                config.setTrackState(TrackState.MUTE);
            }
        }
        return;
    }
    // Behaviour like Push 1
    if (config.isMuteSoloLocked()) {
        config.setTrackState(TrackState.MUTE);
        return;
    }
    if (event == ButtonEvent.DOWN) {
        config.setIsMuteLongPressed(false);
        return;
    }
    if (event == ButtonEvent.LONG) {
        config.setIsMuteLongPressed(true);
        config.setTrackState(TrackState.MUTE);
        return;
    }
    if (config.isMuteLongPressed()) {
        config.setIsMuteLongPressed(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()).toggleMute();
    } else if (Modes.MASTER.equals(activeModeId))
        this.model.getMasterTrack().toggleMute();
    else
        this.model.getCursorTrack().toggleMute();
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) Modes(de.mossgrabers.framework.mode.Modes) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 3 with ICursorDevice

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

the class DeviceHandler method handle.

/**
 * {@inheritDoc}
 */
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final boolean isButtonPressed = this.isButtonPressed(knobMode, value);
    switch(command) {
        // Device: Toggle Window
        case DEVICE_TOGGLE_WINDOW:
            if (isButtonPressed)
                cursorDevice.toggleWindowOpen();
            break;
        // Device: Bypass
        case DEVICE_TOGGLE_BYPASS:
            if (isButtonPressed)
                cursorDevice.toggleEnabledState();
            break;
        // Device: Toggle Pinned
        case DEVICE_TOGGLE_PIN:
            if (isButtonPressed)
                cursorDevice.togglePinned();
            break;
        // Device: Expand
        case DEVICE_TOGGLE_EXPAND:
            if (isButtonPressed)
                cursorDevice.toggleExpanded();
            break;
        // Device: Parameters
        case DEVICE_TOGGLE_PARAMETERS:
            if (isButtonPressed)
                cursorDevice.toggleParameterPageSectionVisible();
            break;
        // Device: Select Previous
        case DEVICE_SELECT_PREVIOUS:
            if (isButtonPressed)
                cursorDevice.selectPrevious();
            break;
        // Device: Select Next
        case DEVICE_SELECT_NEXT:
            if (isButtonPressed)
                cursorDevice.selectNext();
            break;
        case DEVICE_SCROLL_DEVICES:
            this.scrollDevice(knobMode, value);
            break;
        case DEVICE_SELECT_PREVIOUS_PARAMETER_PAGE:
            if (isButtonPressed)
                cursorDevice.getParameterBank().scrollBackwards();
            break;
        case DEVICE_SELECT_NEXT_PARAMETER_PAGE:
            if (isButtonPressed)
                cursorDevice.getParameterBank().scrollForwards();
            break;
        case DEVICE_SELECT_PARAMETER_PAGE_1:
        case DEVICE_SELECT_PARAMETER_PAGE_2:
        case DEVICE_SELECT_PARAMETER_PAGE_3:
        case DEVICE_SELECT_PARAMETER_PAGE_4:
        case DEVICE_SELECT_PARAMETER_PAGE_5:
        case DEVICE_SELECT_PARAMETER_PAGE_6:
        case DEVICE_SELECT_PARAMETER_PAGE_7:
        case DEVICE_SELECT_PARAMETER_PAGE_8:
            if (isButtonPressed) {
                cursorDevice.getParameterPageBank().selectPage(command.ordinal() - FlexiCommand.DEVICE_SELECT_PARAMETER_PAGE_1.ordinal());
                this.mvHelper.notifySelectedDeviceAndParameterPage();
            }
            break;
        case DEVICE_SCROLL_PARAMETER_PAGES:
            this.scrollParameterPage(knobMode, value);
            break;
        // Device: Select Previous Parameter Bank
        case DEVICE_SELECT_PREVIOUS_PARAMETER_BANK:
            if (isButtonPressed)
                cursorDevice.getParameterBank().selectPreviousPage();
            break;
        // Device: Select Next Parameter Bank
        case DEVICE_SELECT_NEXT_PARAMETER_BANK:
            if (isButtonPressed)
                cursorDevice.getParameterBank().selectNextPage();
            break;
        case DEVICE_SCROLL_PARAMETER_BANKS:
            this.scrollParameterBank(knobMode, value);
            break;
        // Device: Set Parameter 1-8
        case DEVICE_SET_PARAMETER_1:
        case DEVICE_SET_PARAMETER_2:
        case DEVICE_SET_PARAMETER_3:
        case DEVICE_SET_PARAMETER_4:
        case DEVICE_SET_PARAMETER_5:
        case DEVICE_SET_PARAMETER_6:
        case DEVICE_SET_PARAMETER_7:
        case DEVICE_SET_PARAMETER_8:
            this.handleParameter(knobMode, command.ordinal() - FlexiCommand.DEVICE_SET_PARAMETER_1.ordinal(), value);
            break;
        default:
            throw new FlexiHandlerException(command);
    }
}
Also used : FlexiHandlerException(de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 4 with ICursorDevice

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

the class DeviceHandler method scrollDevice.

private void scrollDevice(final KnobMode knobMode, final MidiValue value) {
    if (isAbsolute(knobMode) || !this.increaseKnobMovement())
        return;
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (this.isIncrease(knobMode, value))
        cursorDevice.selectNext();
    else
        cursorDevice.selectPrevious();
    this.mvHelper.notifySelectedDevice();
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 5 with ICursorDevice

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

the class DeviceView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final ICursorDevice cd = this.model.getCursorDevice();
    final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
    final int selectedItemIndex = parameterPageBank.getSelectedItemIndex();
    final IPadGrid padGrid = this.surface.getPadGrid();
    for (int i = 0; i < parameterPageBank.getPageSize(); i++) padGrid.light(44 + i, i == selectedItemIndex ? BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE : BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
    padGrid.light(36, cd.isEnabled() ? BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED : BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
    padGrid.light(37, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
    padGrid.light(38, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
    padGrid.light(39, BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED);
    padGrid.light(40, BeatstepColorManager.BEATSTEP_BUTTON_STATE_RED);
    padGrid.light(41, BeatstepColorManager.BEATSTEP_BUTTON_STATE_OFF);
    padGrid.light(42, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
    padGrid.light(43, BeatstepColorManager.BEATSTEP_BUTTON_STATE_BLUE);
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) 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