Search in sources :

Example 16 with ICursorDevice

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

the class DeviceLayerModeVolume method onValueKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnobTouch(final int index, final boolean isTouched) {
    this.isKnobTouched[index] = isTouched;
    final ICursorDevice cd = this.model.getCursorDevice();
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = getDrumPadIndex(cd);
    final IChannel layer = cd.getLayerOrDrumPad(offset + index);
    if (!layer.doesExist())
        return;
    if (isTouched) {
        if (this.surface.isDeletePressed()) {
            this.surface.setButtonConsumed(this.surface.getDeleteButtonId());
            cd.resetLayerOrDrumPadVolume(offset + index);
            return;
        }
        this.surface.getDisplay().notify("Volume: " + layer.getVolumeStr());
    }
    cd.touchLayerOrDrumPadVolume(layer.getIndex(), isTouched);
    this.checkStopAutomationOnKnobRelease(isTouched);
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 17 with ICursorDevice

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

the class DeviceLayerModeVolume method onValueKnob.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnob(final int index, final int value) {
    final ICursorDevice cd = this.model.getCursorDevice();
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = getDrumPadIndex(cd);
    final IChannel layer = cd.getLayerOrDrumPad(offset + index);
    if (layer.doesExist())
        cd.changeLayerOrDrumPadVolume(offset + index, value);
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 18 with ICursorDevice

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

the class DeviceParamsMode method onValueKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnobTouch(final int index, final boolean isTouched) {
    this.isKnobTouched[index] = isTouched;
    final ICursorDevice cd = this.model.getCursorDevice();
    if (isTouched) {
        if (this.surface.isDeletePressed()) {
            this.surface.setButtonConsumed(this.surface.getDeleteButtonId());
            cd.resetParameter(index);
            return;
        }
        final IParameter param = cd.getFXParam(index);
        if (!param.getName().isEmpty())
            this.surface.getDisplay().notify(param.getName() + ": " + param.getDisplayedValue());
    }
    cd.touchParameter(index, isTouched);
    this.checkStopAutomationOnKnobRelease(isTouched);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 19 with ICursorDevice

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

the class DeviceParamsMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!cd.hasSelectedDevice()) {
        for (int i = 0; i < 8; i++) message.addOptionElement(i == 2 ? "Please select a device or press 'Add Device'..." : "", i == 7 ? "Up" : "", true, "", "", false, true);
        display.send(message);
        return;
    }
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final String color = tb.getSelectedTrackColorEntry();
    final IValueChanger valueChanger = this.model.getValueChanger();
    final String[] pages = cd.getParameterPageNames();
    final int page = Math.min(Math.max(0, cd.getSelectedParameterPage()), pages.length - 1);
    final int start = page / 8 * 8;
    final boolean hasPinning = this.model.getHost().hasPinning();
    for (int i = 0; i < 8; i++) {
        boolean isTopMenuOn;
        switch(i) {
            case 0:
                isTopMenuOn = cd.isEnabled();
                break;
            case 1:
                isTopMenuOn = cd.isParameterPageSectionVisible();
                break;
            case 2:
                isTopMenuOn = cd.isExpanded();
                break;
            case 4:
                isTopMenuOn = !this.showDevices;
                break;
            case 5:
                isTopMenuOn = hasPinning && cd.isPinned();
                break;
            case 6:
                isTopMenuOn = cd.isWindowOpen();
                break;
            case 7:
                isTopMenuOn = true;
                break;
            default:
                // Not used
                isTopMenuOn = false;
                break;
        }
        String bottomMenu;
        final String bottomMenuIcon = "";
        boolean isBottomMenuOn;
        if (this.showDevices) {
            bottomMenu = cd.doesSiblingExist(i) ? cd.getSiblingDeviceName(i, 12) : "";
            isBottomMenuOn = i == cd.getPositionInBank();
        } else {
            final int index = start + i;
            bottomMenu = index < pages.length ? pages[index] : "";
            if (bottomMenu.length() > 12)
                bottomMenu = bottomMenu.substring(0, 12);
            isBottomMenuOn = index == page;
        }
        final double[] bottomMenuColor = BitwigColors.getColorEntry(color);
        final IParameter param = cd.getFXParam(i);
        final boolean exists = param.doesExist();
        final String parameterName = exists ? param.getName(9) : "";
        final int parameterValue = valueChanger.toDisplayValue(exists ? param.getValue() : 0);
        final String parameterValueStr = exists ? param.getDisplayedValue(8) : "";
        final boolean parameterIsActive = this.isKnobTouched[i];
        final int parameterModulatedValue = valueChanger.toDisplayValue(exists ? param.getModulatedValue() : -1);
        message.addParameterElement(i != 5 || hasPinning ? MENU[i] : "", isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
    }
    display.send(message);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IValueChanger(de.mossgrabers.framework.controller.IValueChanger) PushDisplay(de.mossgrabers.push.controller.PushDisplay) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 20 with ICursorDevice

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

the class DeviceParamsMode method moveUp.

/**
 * Move up the hierarchy.
 */
protected void moveUp() {
    // There is no device on the track move upwards to the track view
    final ICursorDevice cd = this.model.getCursorDevice();
    final View activeView = this.surface.getViewManager().getActiveView();
    if (!cd.hasSelectedDevice()) {
        activeView.executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
        return;
    }
    // Parameter banks are shown -> show devices
    final ModeManager modeManager = this.surface.getModeManager();
    final DeviceParamsMode deviceParamsMode = (DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS);
    if (!deviceParamsMode.isShowDevices()) {
        deviceParamsMode.setShowDevices(true);
        return;
    }
    // Devices are shown, if nested show the layers otherwise move up to the tracks
    if (cd.isNested()) {
        cd.selectParent();
        modeManager.setActiveMode(Modes.MODE_DEVICE_LAYER);
        deviceParamsMode.setShowDevices(false);
        cd.selectChannel();
        return;
    }
    // Move up to the track
    if (this.model.isCursorDeviceOnMasterTrack()) {
        activeView.executeTriggerCommand(Commands.COMMAND_MASTERTRACK, ButtonEvent.DOWN);
        activeView.executeTriggerCommand(Commands.COMMAND_MASTERTRACK, ButtonEvent.UP);
    } else
        activeView.executeTriggerCommand(Commands.COMMAND_TRACK, ButtonEvent.DOWN);
}
Also used : View(de.mossgrabers.framework.view.View) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

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