Search in sources :

Example 56 with ICursorDevice

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

the class DeviceParamsMode method onKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
    this.isKnobTouched[index] = isTouched;
    final ICursorDevice cd = this.model.getCursorDevice();
    final IParameter param = cd.getParameterBank().getItem(index);
    if (isTouched && this.surface.isDeletePressed()) {
        this.surface.setTriggerConsumed(ButtonID.DELETE);
        param.resetValue();
    }
    param.touchValue(isTouched);
    this.checkStopAutomationOnKnobRelease(isTouched);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 57 with ICursorDevice

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

the class DeviceChainsMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1(final ITextDisplay display) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!this.checkExists1(display, cd))
        return;
    // Row 3
    display.setBlock(2, 0, "Device Chains:").setBlock(2, 1, cd.getName());
    // Row 4
    final String[] slotChains = cd.getSlotChains();
    for (int i = 0; i < 8; i++) {
        final String bottomMenu = i < slotChains.length ? slotChains[i] : "";
        display.setCell(3, i, bottomMenu);
    }
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 58 with ICursorDevice

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

the class DeviceChainsMode method onFirstRow.

/**
 * {@inheritDoc}
 */
@Override
public void onFirstRow(final int index, final ButtonEvent event) {
    if (event == ButtonEvent.DOWN)
        return;
    if (event == ButtonEvent.UP) {
        final ICursorDevice cd = this.model.getCursorDevice();
        if (!cd.doesExist())
            return;
        final String[] slotChains = cd.getSlotChains();
        if (index >= slotChains.length)
            return;
        cd.selectSlotChain(slotChains[index]);
        this.surface.getModeManager().setActive(Modes.DEVICE_PARAMS);
        return;
    }
    // LONG press - move upwards
    this.surface.setTriggerConsumed(ButtonID.get(ButtonID.ROW1_1, index));
    this.moveUp();
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 59 with ICursorDevice

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

the class DeviceLayerMode method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (cd == null || !cd.hasLayers())
        return super.getButtonColor(buttonID);
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = this.getDrumPadIndex();
    int index = this.isButtonRow(0, buttonID);
    if (index >= 0) {
        final IChannel dl = this.bank.getItem(offset + buttonID.ordinal() - ButtonID.ROW1_1.ordinal());
        if (dl.doesExist() && dl.isActivated()) {
            if (dl.isSelected())
                return this.isPush2 ? PushColorManager.PUSH2_COLOR_ORANGE_HI : PushColorManager.PUSH1_COLOR_ORANGE_HI;
            return this.isPush2 ? PushColorManager.PUSH2_COLOR_YELLOW_LO : PushColorManager.PUSH1_COLOR_YELLOW_LO;
        }
        return super.getButtonColor(buttonID);
    }
    index = this.isButtonRow(1, buttonID);
    if (index >= 0) {
        final boolean muteState = this.configuration.isMuteState();
        final IChannel layer = this.bank.getItem(offset + index);
        if (this.isPush2) {
            if (this.configuration.isMuteLongPressed() || this.configuration.isSoloLongPressed() || this.configuration.isMuteSoloLocked()) {
                if (layer.doesExist()) {
                    if (muteState) {
                        if (layer.isMute())
                            return PushColorManager.PUSH2_COLOR2_AMBER_LO;
                    } else if (layer.isSolo())
                        return PushColorManager.PUSH2_COLOR2_YELLOW_HI;
                }
                return PushColorManager.PUSH2_COLOR_BLACK;
            }
            final ModeManager modeManager = this.surface.getModeManager();
            switch(index) {
                case 0:
                    return modeManager.isActive(Modes.DEVICE_LAYER_VOLUME) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                case 1:
                    return modeManager.isActive(Modes.DEVICE_LAYER_PAN) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                case 4:
                case 5:
                case 6:
                case 7:
                    return modeManager.isActive(this.getSendMode(index)) ? PushColorManager.PUSH2_COLOR2_WHITE : PushColorManager.PUSH2_COLOR_BLACK;
                default:
                    return PushColorManager.PUSH2_COLOR_BLACK;
            }
        }
        if (!cd.hasLayers())
            return index == 7 ? PushColorManager.PUSH1_COLOR2_WHITE : super.getButtonColor(buttonID);
        if (layer.doesExist()) {
            if (muteState)
                return layer.isMute() ? PushColorManager.PUSH1_COLOR_BLACK : PushColorManager.PUSH1_COLOR2_YELLOW_HI;
            return layer.isSolo() ? PushColorManager.PUSH1_COLOR2_BLUE_HI : PushColorManager.PUSH1_COLOR2_GREY_LO;
        }
    }
    return super.getButtonColor(buttonID);
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 60 with ICursorDevice

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

the class BaseMode method drawDisplay2.

protected void drawDisplay2() {
    if (!this.surface.getConfiguration().hasDisplay2())
        return;
    final ITrackBank tb = this.getTrackBank();
    // Format track names
    final ITextDisplay d2 = this.surface.getTextDisplay(1);
    final int extenderOffset = this.getExtenderOffset();
    final boolean isMainDevice = this.surface.isMainDevice();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(extenderOffset + i);
        d2.setCell(0, i, StringUtils.shortenAndFixASCII(t.getName(), isMainDevice ? 6 : 7));
    }
    if (isMainDevice)
        d2.setCell(0, 8, "Maste");
    d2.done(0);
    d2.clearRow(1);
    if (isMainDevice) {
        final IMasterTrack masterTrack = this.model.getMasterTrack();
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        final ITrack selectedTrack;
        if (masterTrack.isSelected())
            selectedTrack = masterTrack;
        else {
            final Optional<ITrack> selectedItem = tb.getSelectedItem();
            selectedTrack = selectedItem.isPresent() ? selectedItem.get() : EmptyTrack.INSTANCE;
        }
        d2.setBlock(1, 0, "Sel. track:").setBlock(1, 1, selectedTrack == null ? "None" : StringUtils.shortenAndFixASCII(selectedTrack.getName(), 11));
        d2.setBlock(1, 2, "Sel. devce:").setBlock(1, 3, cursorDevice.doesExist() ? StringUtils.shortenAndFixASCII(cursorDevice.getName(), 11) : "None");
    }
    d2.done(1);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) 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