Search in sources :

Example 1 with ICursorDevice

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

the class APCControllerSetup method updateDeviceKnobs.

private void updateDeviceKnobs() {
    final APCControlSurface surface = this.getSurface();
    final View view = surface.getViewManager().getActiveView();
    if (view == null)
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    for (int i = 0; i < 8; i++) {
        final Integer deviceKnobCommand = Integer.valueOf(Commands.CONT_COMMAND_DEVICE_KNOB1.intValue() + i);
        if (!((DeviceKnobRowCommand) view.getContinuousCommand(deviceKnobCommand)).isKnobMoving())
            surface.setLED(APCControlSurface.APC_KNOB_DEVICE_KNOB_1 + i, cd.getFXParam(i).getValue());
    }
}
Also used : APCControlSurface(de.mossgrabers.apc.controller.APCControlSurface) SessionView(de.mossgrabers.apc.view.SessionView) ShiftView(de.mossgrabers.apc.view.ShiftView) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) DrumView(de.mossgrabers.apc.view.DrumView) SequencerView(de.mossgrabers.apc.view.SequencerView) PlayView(de.mossgrabers.apc.view.PlayView) RaindropsView(de.mossgrabers.apc.view.RaindropsView) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 2 with ICursorDevice

use of de.mossgrabers.framework.daw.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;
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    switch(note) {
        // Flip views
        case 56:
            this.surface.getViewManager().setPreviousView(Views.VIEW_SESSION);
            this.surface.getDisplay().notify("Session");
            break;
        case 57:
            this.surface.getViewManager().setPreviousView(Views.VIEW_PLAY);
            this.surface.getDisplay().notify("Play");
            break;
        case 58:
            this.surface.getViewManager().setPreviousView(Views.VIEW_DRUM);
            this.surface.getDisplay().notify("Drum");
            break;
        case 59:
            this.surface.getViewManager().setPreviousView(Views.VIEW_SEQUENCER);
            this.surface.getDisplay().notify("Sequencer");
            break;
        case 60:
            this.surface.getViewManager().setPreviousView(Views.VIEW_RAINDROPS);
            this.surface.getDisplay().notify("Raindrops");
            break;
        // Last row transport
        case 63:
            this.playCommand.executeNormal(ButtonEvent.DOWN);
            this.surface.getDisplay().notify("Start/Stop");
            break;
        case 55:
            this.model.getTransport().record();
            this.surface.getDisplay().notify("Record");
            break;
        case 47:
            this.model.getTransport().toggleLoop();
            this.surface.getDisplay().notify("Toggle Loop");
            break;
        case 39:
            this.model.getTransport().toggleMetronome();
            this.surface.getDisplay().notify("Toggle Click");
            break;
        // Navigation
        case 62:
            this.onNew();
            this.surface.getDisplay().notify("New clip");
            break;
        case 54:
            this.model.getTransport().toggleLauncherOverdub();
            this.surface.getDisplay().notify("Toggle Launcher Overdub");
            break;
        case 46:
            this.model.getCursorClip().quantize(this.surface.getConfiguration().getQuantizeAmount() / 100.0);
            this.surface.getDisplay().notify("Quantize");
            break;
        case 38:
            this.model.getApplication().undo();
            this.surface.getDisplay().notify("Undo");
            break;
        // Device Parameters up/down
        case 24:
            cursorDevice.previousParameterPage();
            this.surface.getDisplay().notify("Bank: " + cursorDevice.getSelectedParameterPageName());
            break;
        case 25:
            cursorDevice.nextParameterPage();
            this.surface.getDisplay().notify("Bank: " + cursorDevice.getSelectedParameterPageName());
            break;
        // Device up/down
        case 32:
            cursorDevice.selectPrevious();
            this.surface.getDisplay().notify("Device: " + cursorDevice.getName());
            break;
        case 33:
            cursorDevice.selectNext();
            this.surface.getDisplay().notify("Device: " + cursorDevice.getName());
            break;
        // Change the scale
        case 35:
            this.scales.prevScale();
            final String name = this.scales.getScale().getName();
            this.surface.getConfiguration().setScale(name);
            this.surface.getDisplay().notify(name);
            break;
        case 36:
            this.scales.nextScale();
            final String name2 = this.scales.getScale().getName();
            this.surface.getConfiguration().setScale(name2);
            this.surface.getDisplay().notify(name2);
            break;
        case 27:
            this.scales.toggleChromatic();
            this.surface.getDisplay().notify(this.scales.isChromatic() ? "Chromatc" : "In Key");
            break;
        // Scale Base note selection
        default:
            if (note > 15)
                return;
            final int pos = TRANSLATE[note];
            if (pos == -1)
                return;
            this.scales.setScaleOffset(pos);
            this.surface.getConfiguration().setScaleBase(Scales.BASES[pos]);
            this.surface.getDisplay().notify(Scales.BASES[pos]);
            this.surface.getViewManager().getActiveView().updateNoteMapping();
            break;
    }
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 3 with ICursorDevice

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

the class APCminiControllerSetup method updateIndication.

private void updateIndication(final Integer mode) {
    final ITrackBank tb = this.model.getTrackBank();
    final IChannelBank tbe = this.model.getEffectTrackBank();
    final APCminiControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final boolean isShiftView = viewManager.isActiveView(Views.VIEW_SHIFT);
    final boolean isSession = viewManager.isActiveView(Views.VIEW_SESSION) || isShiftView;
    final boolean isEffect = this.model.isEffectTrackBankActive();
    final boolean isPan = Modes.MODE_PAN.equals(mode);
    final boolean isDevice = Modes.MODE_DEVICE.equals(mode);
    tb.setIndication(!isEffect && isSession);
    tbe.setIndication(isEffect && isSession);
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    for (int i = 0; i < 8; i++) {
        final ITrack track = tb.getTrack(i);
        track.setVolumeIndication(!isEffect);
        track.setPanIndication(!isEffect && isPan);
        for (int j = 0; j < 8; j++) track.getSend(j).setIndication(!isEffect && (Modes.MODE_SEND1.equals(mode) && j == 0 || Modes.MODE_SEND2.equals(mode) && j == 1 || Modes.MODE_SEND3.equals(mode) && j == 2 || Modes.MODE_SEND4.equals(mode) && j == 3 || Modes.MODE_SEND5.equals(mode) && j == 4 || Modes.MODE_SEND6.equals(mode) && j == 5 || Modes.MODE_SEND7.equals(mode) && j == 6 || Modes.MODE_SEND8.equals(mode) && j == 7));
        final ITrack fxTrack = tbe.getTrack(i);
        fxTrack.setVolumeIndication(isEffect);
        fxTrack.setPanIndication(isEffect && isPan);
        cursorDevice.indicateParameter(i, isDevice || isShiftView);
    }
}
Also used : APCminiControlSurface(de.mossgrabers.apcmini.controller.APCminiControlSurface) ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ViewManager(de.mossgrabers.framework.view.ViewManager) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 4 with ICursorDevice

use of de.mossgrabers.framework.daw.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)
        return;
    if (!this.model.hasSelectedDevice())
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    IChannel sel;
    int index;
    IChannel dl;
    int bank;
    int offset;
    switch(note - 36) {
        // Toggle device on/off
        case 0:
            cd.toggleEnabledState();
            break;
        // Device Left
        case 1:
            if (this.isLayer) {
                sel = cd.getSelectedLayer();
                index = sel == null || sel.getIndex() == 0 ? 0 : sel.getIndex() - 1;
                cd.selectLayer(index);
            } else
                cd.selectPrevious();
            break;
        // Device Right
        case 2:
            if (this.isLayer) {
                sel = cd.getSelectedLayer();
                index = sel == null ? 0 : sel.getIndex() + 1;
                cd.selectLayer(index > 7 ? 7 : index);
            } else
                cd.selectNext();
            break;
        // Enter layer
        case 3:
            if (!cd.hasLayers())
                return;
            dl = cd.getSelectedLayerOrDrumPad();
            if (this.isLayer) {
                if (dl != null) {
                    cd.enterLayerOrDrumPad(dl.getIndex());
                    cd.selectFirstDeviceInLayerOrDrumPad(dl.getIndex());
                }
            } else if (dl == null)
                cd.selectLayerOrDrumPad(0);
            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.setSelectedParameterPage(Math.max(cd.getSelectedParameterPage() - 8, 0));
            break;
        // Param bank page up
        case 7:
            cd.setSelectedParameterPage(Math.min(cd.getSelectedParameterPage() + 8, cd.getParameterPageNames().length - 1));
            break;
        default:
            bank = note - 36 - 8;
            offset = cd.getSelectedParameterPage() / 8 * 8;
            cd.setSelectedParameterPage(offset + bank);
            break;
    }
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 5 with ICursorDevice

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

the class DrumView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final PadGrid padGrid = this.surface.getPadGrid();
    if (!this.model.canSelectedTrackHoldNotes()) {
        padGrid.turnOff();
        return;
    }
    if (this.isPlayMode) {
        final ICursorDevice primary = this.model.getPrimaryDevice();
        final boolean hasDrumPads = primary.hasDrumPads();
        boolean isSoloed = false;
        if (hasDrumPads) {
            for (int i = 0; i < 16; i++) {
                if (primary.getDrumPad(i).isSolo()) {
                    isSoloed = true;
                    break;
                }
            }
        }
        for (int y = 0; y < 2; y++) {
            for (int x = 0; x < 8; x++) {
                final int index = 8 * y + x;
                padGrid.lightEx(x, y, this.getPadColor(index, primary, isSoloed));
            }
        }
    } else {
        final ICursorClip clip = this.getClip();
        // Paint the sequencer steps
        final int step = clip.getCurrentStep();
        final int hiStep = this.isInXRange(step) ? step % DrumView.NUM_DISPLAY_COLS : -1;
        for (int col = 0; col < DrumView.NUM_DISPLAY_COLS; col++) {
            final int isSet = clip.getStep(col, this.offsetY + this.selectedPad);
            final boolean hilite = col == hiStep;
            final int x = col % 8;
            final int y = col / 8;
            padGrid.lightEx(x, 1 - y, isSet > 0 ? hilite ? BeatstepColors.BEATSTEP_BUTTON_STATE_PINK : BeatstepColors.BEATSTEP_BUTTON_STATE_BLUE : hilite ? BeatstepColors.BEATSTEP_BUTTON_STATE_PINK : BeatstepColors.BEATSTEP_BUTTON_STATE_OFF);
        }
    }
}
Also used : PadGrid(de.mossgrabers.framework.controller.grid.PadGrid) ICursorClip(de.mossgrabers.framework.daw.ICursorClip) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Aggregations

ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)72 IChannel (de.mossgrabers.framework.daw.data.IChannel)25 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)22 ITrack (de.mossgrabers.framework.daw.data.ITrack)19 Display (de.mossgrabers.framework.controller.display.Display)10 ModeManager (de.mossgrabers.framework.mode.ModeManager)9 View (de.mossgrabers.framework.view.View)8 ViewManager (de.mossgrabers.framework.view.ViewManager)8 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)7 IParameter (de.mossgrabers.framework.daw.data.IParameter)6 ITransport (de.mossgrabers.framework.daw.ITransport)5 PushConfiguration (de.mossgrabers.push.PushConfiguration)5 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)4 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)4 SceneView (de.mossgrabers.framework.view.SceneView)4 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)3 IBrowser (de.mossgrabers.framework.daw.IBrowser)3 Scales (de.mossgrabers.framework.scale.Scales)3 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)3 DrumView (de.mossgrabers.launchpad.view.DrumView)3