Search in sources :

Example 1 with ILayer

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

the class DeviceLayerMode method onKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
    final Optional<ILayer> channelOpt = this.bank.getSelectedItem();
    if (channelOpt.isEmpty())
        return;
    final ILayer channel = channelOpt.get();
    this.isKnobTouched[index] = isTouched;
    final ISendBank sendBank = channel.getSendBank();
    if (isTouched && this.surface.isDeletePressed()) {
        this.surface.setTriggerConsumed(ButtonID.DELETE);
        switch(index) {
            case 0:
                channel.resetVolume();
                break;
            case 1:
                channel.resetPan();
                break;
            default:
                if (!this.isPush2 || index >= 4)
                    sendBank.getItem(this.getSendIndex(index)).resetValue();
                break;
        }
        return;
    }
    switch(index) {
        case 0:
            channel.touchVolume(isTouched);
            break;
        case 1:
            channel.touchPan(isTouched);
            break;
        default:
            if (!this.isPush2 || index >= 4)
                sendBank.getItem(this.getSendIndex(index)).touchValue(isTouched);
            break;
    }
    this.checkStopAutomationOnKnobRelease(isTouched);
}
Also used : ILayer(de.mossgrabers.framework.daw.data.ILayer) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank)

Example 2 with ILayer

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

the class DeviceLayerMode method onFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
    if (event == ButtonEvent.DOWN)
        return;
    if (event == ButtonEvent.UP) {
        if (!this.cursorDevice.doesExist())
            return;
        final int offset = this.getDrumPadIndex();
        final ILayer layer = this.bank.getItem(offset + index);
        if (!layer.doesExist())
            return;
        final int layerIndex = layer.getIndex();
        if (!layer.isSelected()) {
            this.bank.getItem(layerIndex).select();
            return;
        }
        // to the user
        if (!layer.hasDevices())
            return;
        layer.enter();
        final ModeManager modeManager = this.surface.getModeManager();
        this.setMode(Modes.DEVICE_PARAMS);
        ((DeviceParamsMode) modeManager.get(Modes.DEVICE_PARAMS)).setShowDevices(true);
        return;
    }
    // LONG press
    this.surface.setTriggerConsumed(ButtonID.get(ButtonID.ROW1_1, index));
    this.moveUp();
}
Also used : ILayer(de.mossgrabers.framework.daw.data.ILayer) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 3 with ILayer

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

the class DeviceView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    if (velocity == 0 || !this.model.hasSelectedDevice())
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    final IChannelBank<ILayer> bank = cd.getLayerBank();
    final Optional<ILayer> sel = bank.getSelectedItem();
    switch(note - 36) {
        // Toggle device on/off
        case 0:
            cd.toggleEnabledState();
            break;
        // Device Left
        case 1:
            if (this.isLayer) {
                int index = 0;
                if (sel.isPresent()) {
                    final int idx = sel.get().getIndex();
                    index = idx - 1;
                }
                if (index >= 0)
                    bank.getItem(index).select();
            } else
                cd.selectPrevious();
            break;
        // Device Right
        case 2:
            if (this.isLayer) {
                final int index = sel.isEmpty() ? 0 : sel.get().getIndex() + 1;
                bank.getItem(index > 7 ? 7 : index).select();
            } else
                cd.selectNext();
            break;
        // Enter layer
        case 3:
            if (!cd.hasLayers())
                return;
            if (this.isLayer) {
                if (sel.isPresent())
                    sel.get().enter();
            } else if (sel.isEmpty())
                bank.getItem(0).select();
            this.isLayer = !this.isLayer;
            break;
        // Exit layer
        case 4:
            if (this.isLayer)
                this.isLayer = false;
            else {
                if (cd.isNested()) {
                    cd.selectParent();
                    cd.selectChannel();
                    this.isLayer = true;
                }
            }
            break;
        case 5:
            // Intentionally empty
            break;
        // Param bank down
        case 6:
            cd.getParameterBank().scrollBackwards();
            break;
        // Param bank page up
        case 7:
            cd.getParameterBank().scrollForwards();
            break;
        default:
            cd.getParameterPageBank().selectPage(note - 36 - 8);
            break;
    }
}
Also used : ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 4 with ILayer

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

the class DeviceLayerRightCommand method canExecute.

/**
 * Check if the command can be executed.
 *
 * @return True if it can
 */
public boolean canExecute() {
    if (this.surface.isShiftPressed())
        return true;
    final ICursorDevice cd = this.model.getCursorDevice();
    final IChannelBank<ILayer> bank = cd.getLayerBank();
    final Optional<ILayer> layer = bank.getSelectedItem();
    return cd.hasLayers() && layer.isPresent() ? bank.canScrollForwards() : cd.canSelectNextFX();
}
Also used : ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 5 with ILayer

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

the class BrowserCommand method activateBrowser.

/**
 * Activate the browser depending on the parameters and the currently active mode.
 *
 * @param insertDevice Insert a device if true otherwise select preset
 * @param beforeCurrent Insert the device before the current device if any
 * @return True if activated
 */
private boolean activateBrowser(final boolean insertDevice, final boolean beforeCurrent) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final boolean hasCursorDevice = cursorDevice.doesExist();
    final IBrowser browser = this.model.getBrowser();
    if (hasCursorDevice) {
        // Replace the cursor device
        if (!insertDevice) {
            browser.replace(cursorDevice);
            return true;
        }
        if (Modes.isLayerMode(this.surface.getModeManager().getActiveID())) {
            final Optional<ILayer> layer = cursorDevice.getLayerBank().getSelectedItem();
            if (layer.isEmpty())
                return false;
            browser.addDevice(layer.get());
            return true;
        }
        if (beforeCurrent)
            browser.insertBeforeCursorDevice();
        else
            browser.insertAfterCursorDevice();
        return true;
    }
    // No cursor device, add to the selected channel, if any
    final Optional<ITrack> channel = this.model.getCurrentTrackBank().getSelectedItem();
    if (channel.isPresent()) {
        browser.addDevice(channel.get());
        return true;
    }
    final IMasterTrack master = this.model.getMasterTrack();
    if (!master.isSelected())
        return false;
    browser.addDevice(master);
    return true;
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ITrack(de.mossgrabers.framework.daw.data.ITrack) ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Aggregations

ILayer (de.mossgrabers.framework.daw.data.ILayer)14 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)8 IChannel (de.mossgrabers.framework.daw.data.IChannel)3 ISpecificDevice (de.mossgrabers.framework.daw.data.ISpecificDevice)3 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)3 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)2 TitleChannelsComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleChannelsComponent)1 TitleValueComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)1 IBrowser (de.mossgrabers.framework.daw.IBrowser)1 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)1 ITrack (de.mossgrabers.framework.daw.data.ITrack)1 ILayerBank (de.mossgrabers.framework.daw.data.bank.ILayerBank)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1