Search in sources :

Example 16 with ICursorDevice

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

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

the class DeviceView method onKnob.

/**
 * {@inheritDoc}
 */
@Override
public void onKnob(final int index, final int value, final boolean isTurnedRight) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (index < 8) {
        this.extensions.onTrackKnob(index, value, isTurnedRight);
        return;
    }
    cd.getParameterBank().getItem(index - 8).changeValue(value);
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 18 with ICursorDevice

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

the class ShiftView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    if (velocity == 0)
        return;
    int viewIndex;
    IView view;
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    switch(note - 36) {
        // Play
        case 0:
            this.playCommand.executeNormal(ButtonEvent.UP);
            break;
        // Record
        case 1:
            this.model.getTransport().startRecording();
            break;
        // Repeat
        case 2:
            this.model.getTransport().toggleLoop();
            break;
        // Click
        case 3:
            this.model.getTransport().toggleMetronome();
            break;
        // Tap Tempo
        case 4:
            this.model.getTransport().tapTempo();
            break;
        // Insert device before current
        case 5:
            this.model.getBrowser().insertBeforeCursorDevice();
            break;
        // Insert device after current
        case 6:
            this.model.getBrowser().insertAfterCursorDevice();
            break;
        // Open the browser
        case 7:
            this.model.getBrowser().replace(cursorDevice);
            break;
        // Toggle window of VSTs
        case 15:
            cursorDevice.toggleWindowOpen();
            break;
        default:
            viewIndex = note - 44;
            if (viewIndex < 0 || viewIndex >= 6)
                return;
            final ViewManager viewManager = this.surface.getViewManager();
            final Views viewId = VIEWS[viewIndex];
            viewManager.setPreviousID(viewId);
            view = viewManager.get(viewId);
            this.surface.getDisplay().notify(view.getName());
            break;
    }
}
Also used : IView(de.mossgrabers.framework.featuregroup.IView) Views(de.mossgrabers.framework.view.Views) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 19 with ICursorDevice

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

the class SelectDeviceViewCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    final ViewManager viewManager = this.surface.getViewManager();
    if (this.surface.isPro() && this.surface.isShiftPressed()) {
        if (viewManager.isActive(Views.SHIFT))
            viewManager.restore();
        viewManager.setTemporary(Views.TEMPO);
        this.surface.getDisplay().notify(viewManager.getActive().getName());
        return;
    }
    final IBrowser browser = this.model.getBrowser();
    if (viewManager.isActive(Views.BROWSER)) {
        browser.stopBrowsing(false);
        viewManager.setActive(Views.DEVICE);
        this.surface.getDisplay().notify(viewManager.getActive().getName());
        return;
    }
    if (viewManager.isActive(Views.DEVICE)) {
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        if (this.surface.isShiftPressed() || !cursorDevice.doesExist())
            browser.insertAfterCursorDevice();
        else
            browser.replace(cursorDevice);
        return;
    }
    viewManager.setActive(Views.DEVICE);
    this.surface.getDisplay().notify(viewManager.getActive().getName());
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 20 with ICursorDevice

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

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