Search in sources :

Example 51 with ModeManager

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

the class DeviceLayerMode method updateSecondRow.

/**
 * {@inheritDoc}
 */
@Override
public void updateSecondRow() {
    final ICursorDevice cd = this.model.getCursorDevice();
    final PushConfiguration config = this.surface.getConfiguration();
    final boolean muteState = config.isMuteState();
    if (this.isPush2) {
        if (config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
            // Drum Pad Bank has size of 16, layers only 8
            final int offset = getDrumPadIndex(cd);
            for (int i = 0; i < 8; i++) {
                final IChannel layer = cd.getLayerOrDrumPad(offset + i);
                int color = PushColors.PUSH2_COLOR_BLACK;
                if (layer.doesExist()) {
                    if (muteState) {
                        if (layer.isMute())
                            color = PushColors.PUSH2_COLOR2_AMBER_LO;
                    } else if (layer.isSolo())
                        color = PushColors.PUSH2_COLOR2_YELLOW_HI;
                }
                this.surface.updateButton(102 + i, color);
            }
            return;
        }
        final ModeManager modeManager = this.surface.getModeManager();
        this.surface.updateButton(102, modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_VOLUME) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(103, modeManager.isActiveMode(Modes.MODE_DEVICE_LAYER_PAN) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(104, PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(105, PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(106, modeManager.isActiveMode(config.isSendsAreToggled() ? Modes.MODE_DEVICE_LAYER_SEND5 : Modes.MODE_DEVICE_LAYER_SEND1) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(107, modeManager.isActiveMode(config.isSendsAreToggled() ? Modes.MODE_DEVICE_LAYER_SEND6 : Modes.MODE_DEVICE_LAYER_SEND2) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(108, modeManager.isActiveMode(config.isSendsAreToggled() ? Modes.MODE_DEVICE_LAYER_SEND7 : Modes.MODE_DEVICE_LAYER_SEND3) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        this.surface.updateButton(109, modeManager.isActiveMode(config.isSendsAreToggled() ? Modes.MODE_DEVICE_LAYER_SEND8 : Modes.MODE_DEVICE_LAYER_SEND4) ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH2_COLOR_BLACK);
        return;
    }
    if (cd == null || !cd.hasLayers()) {
        this.disableSecondRow();
        this.surface.updateButton(109, this.isPush2 ? PushColors.PUSH2_COLOR2_WHITE : PushColors.PUSH1_COLOR2_WHITE);
        return;
    }
    final int offset = getDrumPadIndex(cd);
    for (int i = 0; i < 8; i++) {
        final IChannel dl = cd.getLayerOrDrumPad(offset + i);
        int color = PushColors.PUSH1_COLOR_BLACK;
        if (dl.doesExist()) {
            if (muteState) {
                if (!dl.isMute())
                    color = PushColors.PUSH1_COLOR2_YELLOW_HI;
            } else
                color = dl.isSolo() ? PushColors.PUSH1_COLOR2_BLUE_HI : PushColors.PUSH1_COLOR2_GREY_LO;
        }
        this.surface.updateButton(102 + i, color);
    }
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 52 with ModeManager

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

the class DeviceParamsMode method onFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
    if (event == ButtonEvent.DOWN)
        return;
    if (event == ButtonEvent.UP) {
        final ICursorDevice cd = this.model.getCursorDevice();
        if (!cd.hasSelectedDevice())
            return;
        if (!this.showDevices) {
            cd.setSelectedParameterPageInBank(index);
            return;
        }
        if (cd.getPositionInBank() != index) {
            cd.selectSibling(index);
            return;
        }
        final ModeManager modeManager = this.surface.getModeManager();
        if (!cd.hasLayers()) {
            ((DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS)).setShowDevices(false);
            return;
        }
        final IChannel layer = cd.getSelectedLayerOrDrumPad();
        if (layer == null)
            cd.selectLayerOrDrumPad(0);
        modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
        return;
    }
    // LONG press - move upwards
    this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_ROW1_1 + index);
    this.moveUp();
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 53 with ModeManager

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

the class AbstractTrackMode method onSecondRow.

/**
 * {@inheritDoc}
 */
@Override
public void onSecondRow(final int index, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack track = tb.getTrack(index);
    if (this.surface.isPressed(PushControlSurface.PUSH_BUTTON_CLIP_STOP)) {
        track.stop();
        return;
    }
    final PushConfiguration config = this.surface.getConfiguration();
    if (!this.isPush2 || config.isMuteLongPressed() || config.isSoloLongPressed() || config.isMuteSoloLocked()) {
        if (config.isMuteState())
            track.toggleMute();
        else
            track.toggleSolo();
        return;
    }
    final ModeManager modeManager = this.surface.getModeManager();
    switch(index) {
        case 0:
            if (modeManager.isActiveMode(Modes.MODE_VOLUME))
                modeManager.setActiveMode(Modes.MODE_TRACK);
            else
                modeManager.setActiveMode(Modes.MODE_VOLUME);
            break;
        case 1:
            if (modeManager.isActiveMode(Modes.MODE_PAN))
                modeManager.setActiveMode(Modes.MODE_TRACK);
            else
                modeManager.setActiveMode(Modes.MODE_PAN);
            break;
        case 2:
            if (config.isDisplayCrossfader()) {
                if (modeManager.isActiveMode(Modes.MODE_CROSSFADER))
                    modeManager.setActiveMode(Modes.MODE_TRACK);
                else
                    modeManager.setActiveMode(Modes.MODE_CROSSFADER);
            }
            break;
        case 3:
            if (!this.model.isEffectTrackBankActive()) {
                config.setSendsAreToggled(!config.isSendsAreToggled());
                if (!modeManager.isActiveMode(Modes.MODE_TRACK))
                    modeManager.setActiveMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + (config.isSendsAreToggled() ? 4 : 0)));
            }
            break;
        case 7:
            if (!this.model.isEffectTrackBankActive())
                this.model.getTrackBank().selectParent();
            break;
        default:
            final int sendIndex = index - (config.isSendsAreToggled() ? 0 : 4);
            if (tb.canEditSend(sendIndex)) {
                final Integer si = Integer.valueOf(Modes.MODE_SEND1.intValue() + sendIndex);
                modeManager.setActiveMode(modeManager.isActiveMode(si) ? Modes.MODE_TRACK : si);
            }
            break;
    }
    config.setDebugMode(modeManager.getActiveModeId());
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 54 with ModeManager

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

the class ControlView method onButtonRow1.

/**
 * {@inheritDoc}
 */
@Override
public void onButtonRow1(final int index, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    Integer activeModeId = modeManager.getActiveModeId();
    if (activeModeId == Modes.MODE_VIEW_SELECT) {
        if (index == 1) {
            this.surface.getViewManager().setActiveView(Views.VIEW_PLAY);
            if (modeManager.getPreviousModeId() == Modes.MODE_VOLUME)
                modeManager.restoreMode();
            else
                modeManager.setActiveMode(Modes.MODE_SESSION);
        } else
            modeManager.restoreMode();
        this.surface.turnOffTransport();
        return;
    }
    if (activeModeId != Modes.MODE_FUNCTIONS && activeModeId != Modes.MODE_FIXED) {
        modeManager.setActiveMode(Modes.MODE_FUNCTIONS);
        activeModeId = Modes.MODE_FUNCTIONS;
    }
    if (activeModeId == Modes.MODE_FIXED) {
        this.surface.getConfiguration().setNewClipLength(index);
        return;
    }
    switch(index) {
        // Undo
        case 0:
            this.model.getApplication().undo();
            break;
        // Redo
        case 1:
            this.model.getApplication().redo();
            break;
        // Delete
        case 2:
            this.model.getApplication().deleteSelection();
            break;
        // Double
        case 3:
            this.model.getApplication().duplicate();
            break;
        // New
        case 4:
            final IChannelBank tb = this.model.getCurrentTrackBank();
            final ITrack t = tb.getSelectedTrack();
            if (t != null) {
                final ISlot[] slotIndexes = t.getSelectedSlots();
                final int slotIndex = slotIndexes.length == 0 ? 0 : slotIndexes[0].getIndex();
                for (int i = 0; i < 8; i++) {
                    final int sIndex = (slotIndex + i) % 8;
                    final ISlot s = t.getSlot(sIndex);
                    if (!s.hasContent()) {
                        this.model.createClip(s, this.surface.getConfiguration().getNewClipLength());
                        if (slotIndex != sIndex)
                            s.select();
                        s.launch();
                        this.model.getTransport().setLauncherOverdub(true);
                        return;
                    }
                }
            }
            this.surface.getDisplay().notify("In the current selected grid view there is no empty slot. Please scroll down.");
            break;
        // Open the VST window
        case 5:
            this.model.getCursorDevice().toggleWindowOpen();
            break;
        // Metronome
        case 6:
            this.model.getTransport().toggleMetronome();
            break;
        // Tap Tempo on MKII
        case 7:
            this.model.getTransport().tapTempo();
            break;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISlot(de.mossgrabers.framework.daw.data.ISlot) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 55 with ModeManager

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

the class ControlView method onButtonRow2.

/**
 * {@inheritDoc}
 */
@Override
public void onButtonRow2(final int index, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ModeManager modeManager = this.surface.getModeManager();
    Integer cm = modeManager.getActiveModeId();
    if (cm != Modes.MODE_TRACK_TOGGLES && cm != Modes.MODE_FRAME && cm != Modes.MODE_BROWSER) {
        modeManager.setActiveMode(Modes.MODE_TRACK_TOGGLES);
        cm = Modes.MODE_TRACK_TOGGLES;
    }
    if (cm == Modes.MODE_FRAME) {
        modeManager.getMode(Modes.MODE_FRAME).onRowButton(0, index, event);
        return;
    } else if (cm == Modes.MODE_BROWSER) {
        modeManager.getMode(Modes.MODE_BROWSER).onRowButton(0, index, event);
        return;
    }
    IChannelBank tb;
    ITrack track;
    switch(index) {
        // Mute
        case 0:
            tb = this.model.getCurrentTrackBank();
            track = tb.getSelectedTrack();
            if (track != null)
                track.toggleMute();
            break;
        // Solo
        case 1:
            tb = this.model.getCurrentTrackBank();
            track = tb.getSelectedTrack();
            if (track != null)
                track.toggleSolo();
            break;
        // Arm
        case 2:
            tb = this.model.getCurrentTrackBank();
            track = tb.getSelectedTrack();
            if (track != null)
                track.toggleRecArm();
            break;
        // Write
        case 3:
            this.model.getTransport().toggleWriteArrangerAutomation();
            break;
        // Browse
        case 4:
            this.model.getBrowser().browseForPresets();
            modeManager.setActiveMode(Modes.MODE_BROWSER);
            break;
        // Dis-/Enable device
        case 5:
            this.model.getCursorDevice().toggleEnabledState();
            break;
        // Previous device
        case 6:
            this.model.getCursorDevice().selectPrevious();
            break;
        // Next device
        case 7:
            this.model.getCursorDevice().selectNext();
            break;
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

ModeManager (de.mossgrabers.framework.mode.ModeManager)67 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)20 ITrack (de.mossgrabers.framework.daw.data.ITrack)18 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)9 ViewManager (de.mossgrabers.framework.view.ViewManager)7 PushConfiguration (de.mossgrabers.push.PushConfiguration)7 View (de.mossgrabers.framework.view.View)6 SceneView (de.mossgrabers.framework.view.SceneView)5 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)5 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)4 IChannel (de.mossgrabers.framework.daw.data.IChannel)4 ITransport (de.mossgrabers.framework.daw.ITransport)3 DeviceBrowserMode (de.mossgrabers.push.mode.device.DeviceBrowserMode)3 DeviceParamsMode (de.mossgrabers.push.mode.device.DeviceParamsMode)3 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)2 APCminiControlSurface (de.mossgrabers.apcmini.controller.APCminiControlSurface)2 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)2 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)2 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)2 LaunchpadControlSurface (de.mossgrabers.launchpad.controller.LaunchpadControlSurface)2