Search in sources :

Example 36 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;
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final int n = this.surface.getPadGrid().translateToController(note)[1];
    switch(n) {
        // Flip views
        case 56:
            this.switchToView(Views.SESSION);
            break;
        case 57:
            this.switchToView(Views.PLAY);
            break;
        case 58:
            this.switchToView(Views.DRUM);
            break;
        case 59:
            this.switchToView(Views.SEQUENCER);
            break;
        case 60:
            this.switchToView(Views.RAINDROPS);
            break;
        // Last row transport
        case 63:
            this.playCommand.executeNormal(ButtonEvent.UP);
            this.surface.getDisplay().notify("Start/Stop");
            break;
        case 55:
            this.model.getTransport().startRecording();
            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.newCommand.execute();
            this.surface.getDisplay().notify("New clip");
            break;
        case 54:
            this.model.getTransport().toggleLauncherOverdub();
            this.surface.getDisplay().notify("Toggle Launcher Overdub");
            break;
        case 46:
            final IClip clip = this.model.getCursorClip();
            if (clip.doesExist())
                clip.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:
            this.scrollParameterBank(true, cursorDevice);
            break;
        case 25:
            this.scrollParameterBank(false, cursorDevice);
            break;
        // Device up/down
        case 32:
            if (cursorDevice.canSelectPreviousFX()) {
                cursorDevice.selectPrevious();
                this.surface.getDisplay().notify("Device: " + cursorDevice.getName());
            }
            break;
        case 33:
            if (cursorDevice.canSelectNextFX()) {
                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() ? "Chromatic" : "In Key");
            break;
        // Scale Base note selection
        default:
            if (n > 15)
                return;
            final int pos = TRANSLATE[n];
            if (pos == -1)
                return;
            this.scales.setScaleOffset(pos);
            this.surface.getConfiguration().setScaleBase(Scales.BASES.get(pos));
            this.surface.getDisplay().notify(Scales.BASES.get(pos));
            this.surface.getViewManager().getActive().updateNoteMapping();
            break;
    }
}
Also used : IClip(de.mossgrabers.framework.daw.IClip) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 37 with ICursorDevice

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

the class Drum64View method handleSelectButton.

/**
 * {@inheritDoc}
 */
@Override
protected void handleSelectButton(final int playedPad) {
    // Do we have drum pads?
    final IDrumDevice primary = this.model.getDrumDevice64();
    if (!primary.hasDrumPads())
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    final boolean isNested = cd.isNested();
    if (isNested) {
        // We have to move up to compare the main drum devices
        cd.selectParent();
    }
    // Can only scroll to the channel if the cursor device is the primary device
    if (primary.getPosition() != cd.getPosition())
        return;
    // Align the primary and cursor device drum bank view
    final IDrumPadBank drumPadBank = primary.getDrumPadBank();
    final int scrollPos = drumPadBank.getScrollPosition();
    final IDrumPadBank cdDrumPadBank = cd.getDrumPadBank();
    final int pageSize = cdDrumPadBank.getPageSize();
    final int adjustedPage = playedPad / pageSize * pageSize;
    cdDrumPadBank.scrollTo(scrollPos + adjustedPage, false);
    // Do not reselect, if pad is already selected
    final IDrumPad drumPad = drumPadBank.getItem(playedPad);
    if (drumPad.isSelected()) {
        // If the instrument of the pad was selected for editing, try to select it again
        if (isNested) {
            final IDrumPad selectedItem = cdDrumPadBank.getItem(playedPad % pageSize);
            if (selectedItem != null)
                selectedItem.enter();
        }
        return;
    }
    // Only activate layer mode if not one of the layer modes is already active
    final ModeManager modeManager = this.surface.getModeManager();
    if (!Modes.isLayerMode(modeManager.getActiveID()))
        modeManager.setActive(Modes.DEVICE_LAYER);
    drumPad.select();
}
Also used : IDrumDevice(de.mossgrabers.framework.daw.data.IDrumDevice) IDrumPadBank(de.mossgrabers.framework.daw.data.bank.IDrumPadBank) IDrumPad(de.mossgrabers.framework.daw.data.IDrumPad) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 38 with ICursorDevice

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

the class ControlMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ACVSDisplay d = (ACVSDisplay) this.surface.getDisplay();
    final ACVSConfiguration configuration = this.surface.getConfiguration();
    final boolean isForce = configuration.isActiveACVSDevice(ACVSDevice.FORCE);
    final boolean isMPC = !isForce;
    final boolean isMPC_X = configuration.isActiveACVSDevice(ACVSDevice.MPC_X);
    final ITrackBank tb = this.model.getCurrentTrackBank();
    final ICursorDevice device = this.model.getCursorDevice();
    final int maxScene = calcMaxScene(this.model.getSceneBank());
    d.setScreenItem(ScreenItem.TRACK_NUMBER_OF_SCENES, maxScene);
    // Maximum number of sends
    d.setScreenItem(ScreenItem.TRACK_SENDS_NO, calcNumberOfSends(tb));
    for (int i = 0; i < 8; i++) {
        // Send track data
        final ITrack track = tb.getItem(i);
        sendTrackData(d, i, track);
        this.sendClipData(d, isMPC, i, track.getSlotBank());
    }
    this.sendSceneData(d, isMPC);
    // Set device data
    final boolean exists = device.doesExist();
    final Optional<String> selectedPage = device.getParameterPageBank().getSelectedItem();
    d.setRow(ACVSDisplay.ITEM_ID_DEVICE_BANK_NAME, exists ? selectedPage.orElse("") : "");
    d.setRow(ACVSDisplay.ITEM_ID_DEVICE_NAME, exists ? device.getName() : "");
    d.setScreenItem(ScreenItem.DEVICE_COUNT, device.doesExist() ? device.getDeviceBank().getItemCount() : 0);
    final int devicePosition = device.getPosition();
    d.setScreenItem(ScreenItem.CURRENT_DEVICE_INDEX, devicePosition >= 0 ? devicePosition : 0);
    d.setScreenItem(ScreenItem.CURRENT_DEVICE_ACTIVE, device.isEnabled() ? 127 : 0);
    final IParameterBank parameterBank = device.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(i);
        d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAMETER_NAME_FIRST + i, param.getName());
        d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAMETER_VALUE_FIRST + i, param.getDisplayedValue());
        d.setScreenItem(ScreenItem.get(ScreenItem.DEVICE_PARAM1_ENABLED, i), param.doesExist() ? 127 : 0);
        d.setScreenItem(ScreenItem.get(ScreenItem.DEVICE_PARAM1_VALUE, i), param.getValue());
        if (isForce || isMPC_X) {
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOBSTYLE1_COLOR, 8 + i), param.doesExist() ? 1 : 0);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOB_VALUE1, 8 + i), param.getValue());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_NAME1 + 8 + i, param.getName());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_VALUE1 + 8 + i, param.getDisplayedValue());
            final ITrack track = tb.getItem(i);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOBSTYLE1_COLOR, i), track.doesExist() ? 1 : 0);
            d.setScreenItem(ScreenItem.get(ScreenItem.KNOB_VALUE1, i), track.getVolume());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_NAME1 + i, track.getName());
            d.setRow(ACVSDisplay.ITEM_ID_DEVICE_PARAM_VALUE1 + i, track.getVolumeStr());
        }
    }
    // Set transport data
    final ITransport transport = this.model.getTransport();
    d.setRow(ACVSDisplay.ITEM_ID_TEMPO, transport.getTempoParameter().getDisplayedValue());
    d.setRow(ACVSDisplay.ITEM_ID_ARRANGEMENT_POSITION, transport.getBeatText().split(":")[0].replace('.', ':'));
    d.setRow(ACVSDisplay.ITEM_ID_LOOP_START, transport.getLoopStartBeatText().split(":")[0].replace('.', ':'));
    d.setRow(ACVSDisplay.ITEM_ID_LOOP_LENGTH, transport.getLoopLengthBeatText().split(":")[0].replace('.', ':'));
    this.sendAdditionalMPCParameters(d);
    if (!isMPC)
        this.sendAdditionalForceParameters(d);
    d.allDone();
    if (this.currentMaxScene != maxScene) {
        this.currentMaxScene = maxScene;
        this.surface.forceFlush();
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ITrack(de.mossgrabers.framework.daw.data.ITrack) ACVSDisplay(de.mossgrabers.controller.akai.acvs.controller.ACVSDisplay) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ITransport(de.mossgrabers.framework.daw.ITransport) ACVSConfiguration(de.mossgrabers.controller.akai.acvs.ACVSConfiguration) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 39 with ICursorDevice

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

the class APCQuantizeCommand method executeShifted.

/**
 * {@inheritDoc}
 */
@Override
public void executeShifted(final ButtonEvent event) {
    if (event != ButtonEvent.UP)
        return;
    final ICursorTrack cursorTrack = this.model.getCursorTrack();
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (!cursorTrack.doesExist() || !cursorDevice.doesExist())
        return;
    final boolean pinned = cursorDevice.isPinned();
    cursorDevice.togglePinned();
    final boolean cursorTrackPinned = cursorTrack.isPinned();
    if (pinned == cursorTrackPinned)
        cursorTrack.togglePinned();
}
Also used : ICursorTrack(de.mossgrabers.framework.daw.data.ICursorTrack) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 40 with ICursorDevice

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

the class BeatstepControllerSetup method updateIndication.

protected void updateIndication() {
    final BeatstepControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final boolean isTrack = viewManager.isActive(Views.TRACK);
    final boolean isDevice = viewManager.isActive(Views.DEVICE);
    final boolean isSession = viewManager.isActive(Views.SESSION);
    final IMasterTrack mt = this.model.getMasterTrack();
    mt.setVolumeIndication(!isDevice);
    final ITrackBank tb = this.model.getTrackBank();
    final Optional<ITrack> selectedTrack = tb.getSelectedItem();
    final ITrackBank tbe = this.model.getEffectTrackBank();
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final boolean isEffect = this.model.isEffectTrackBankActive();
    tb.setIndication(!isEffect && isSession);
    if (tbe != null)
        tbe.setIndication(isEffect && isSession);
    final IParameterBank parameterBank = cursorDevice.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final boolean hasTrackSel = selectedTrack.isPresent() && selectedTrack.get().getIndex() == i;
        final ITrack track = tb.getItem(i);
        track.setVolumeIndication(!isEffect && hasTrackSel && !isDevice);
        track.setPanIndication(!isEffect && hasTrackSel && !isDevice);
        final ISendBank sendBank = track.getSendBank();
        for (int j = 0; j < 6; j++) sendBank.getItem(j).setIndication(!isEffect && hasTrackSel && isTrack);
        if (tbe != null) {
            final Optional<ITrack> selectedFXTrack = tbe.getSelectedItem();
            final boolean hasFXTrackSel = selectedFXTrack.isPresent() && selectedFXTrack.get().getIndex() == i;
            final ITrack fxTrack = tbe.getItem(i);
            fxTrack.setVolumeIndication(isEffect && hasFXTrackSel && isTrack);
            fxTrack.setPanIndication(isEffect && hasFXTrackSel && isTrack);
        }
        parameterBank.getItem(i).setIndication(isDevice);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) BeatstepControlSurface(de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack) 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