Search in sources :

Example 6 with ILayer

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

the class DeviceLayerLeftCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    final IChannelBank<ILayer> bank = cd.getLayerBank();
    if (!cd.hasLayers() || bank.getSelectedItem().isEmpty())
        cd.selectPrevious();
    else
        bank.selectPreviousItem();
}
Also used : ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 7 with ILayer

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

the class DeviceLayerLeftCommand method executeShifted.

/**
 * {@inheritDoc}
 */
@Override
public void executeShifted(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    // Exit layer
    final ICursorDevice cd = this.model.getCursorDevice();
    final IChannelBank<ILayer> bank = cd.getLayerBank();
    final Optional<ILayer> layer = bank.getSelectedItem();
    if (!cd.hasLayers() || layer.isEmpty()) {
        if (cd.isNested()) {
            cd.selectParent();
            cd.selectChannel();
        }
    } else
        layer.get().setSelected(false);
}
Also used : ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 8 with ILayer

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

the class FireLayerMixerMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    this.updateMode();
    final IGraphicDisplay display = this.surface.getGraphicsDisplay();
    final ISpecificDevice cd = this.model.getDrumDevice();
    final ILayerBank layerBank = cd.getLayerBank();
    final Optional<ILayer> channelOptional = layerBank.getSelectedItem();
    String label = "None";
    if (channelOptional.isPresent()) {
        final IChannel channel = channelOptional.get();
        label = channel.getPosition() + 1 + ": " + channel.getName(9);
    }
    final int size = layerBank.getPageSize();
    final boolean[] selected = new boolean[size];
    final int[] values = new int[size];
    final boolean isMode = this.isAnyKnobTouched() || !this.model.getTransport().isPlaying();
    if (isMode) {
        switch(this.selectedParameter) {
            case VOLUME:
                for (int i = 0; i < size; i++) {
                    final IChannel channel = layerBank.getItem(i);
                    selected[i] = channel.isSelected();
                    values[i] = channel.getVolume();
                }
                break;
            case PAN:
                for (int i = 0; i < size; i++) {
                    final IChannel channel = layerBank.getItem(i);
                    selected[i] = channel.isSelected();
                    values[i] = channel.getPan();
                }
                break;
            case SEND1:
            case SEND2:
            case SEND3:
            case SEND4:
            case SEND5:
            case SEND6:
                final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
                for (int i = 0; i < size; i++) {
                    final IChannel channel = layerBank.getItem(i);
                    selected[i] = channel.isSelected();
                    final ISendBank sendBank = channel.getSendBank();
                    if (sendBank != null) {
                        final ISend send = sendBank.getItem(sendIndex);
                        if (send.doesExist())
                            values[i] = send.getValue();
                    }
                }
                break;
            default:
                // Not used
                break;
        }
    } else {
        for (int i = 0; i < size; i++) {
            final IChannel channel = layerBank.getItem(i);
            selected[i] = channel.isSelected();
            values[i] = channel.getVu();
        }
    }
    display.addElement(new TitleChannelsComponent(label, selected, values, this.selectedParameter == Modes.PAN && isMode));
    display.send();
}
Also used : ILayerBank(de.mossgrabers.framework.daw.data.bank.ILayerBank) IChannel(de.mossgrabers.framework.daw.data.IChannel) ILayer(de.mossgrabers.framework.daw.data.ILayer) IGraphicDisplay(de.mossgrabers.framework.controller.display.IGraphicDisplay) TitleChannelsComponent(de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleChannelsComponent) ISpecificDevice(de.mossgrabers.framework.daw.data.ISpecificDevice) ISend(de.mossgrabers.framework.daw.data.ISend) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank)

Example 9 with ILayer

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

the class FireLayerMode method onKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
    this.selectedParameter = this.surface.isPressed(ButtonID.ALT) ? ALT_MODES[index] : MODES[index];
    this.isKnobTouched[index] = isTouched;
    final ISpecificDevice cd = this.model.getDrumDevice();
    final Optional<ILayer> channelOptional = cd.getLayerBank().getSelectedItem();
    if (!channelOptional.isPresent())
        return;
    final IChannel channel = channelOptional.get();
    switch(this.selectedParameter) {
        case VOLUME:
            if (isTouched && this.surface.isDeletePressed())
                channel.resetVolume();
            channel.touchVolume(isTouched);
            break;
        case PAN:
            if (isTouched && this.surface.isDeletePressed())
                channel.resetPan();
            channel.touchPan(isTouched);
            break;
        case SEND1:
        case SEND2:
        case SEND3:
        case SEND4:
        case SEND5:
        case SEND6:
            final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
            final ISend item = channel.getSendBank().getItem(sendIndex);
            if (isTouched && this.surface.isDeletePressed())
                item.resetValue();
            item.touchValue(isTouched);
            break;
        default:
            // No more
            break;
    }
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ILayer(de.mossgrabers.framework.daw.data.ILayer) ISpecificDevice(de.mossgrabers.framework.daw.data.ISpecificDevice) ISend(de.mossgrabers.framework.daw.data.ISend)

Example 10 with ILayer

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

the class FireLayerMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    this.updateMode();
    final IGraphicDisplay display = this.surface.getGraphicsDisplay();
    String desc = "Select";
    String label = "a drum pad";
    int value = -1;
    int vuLeft = -1;
    int vuRight = -1;
    boolean isPan = false;
    final ISpecificDevice cd = this.model.getDrumDevice();
    final Optional<ILayer> channelOptional = cd.getLayerBank().getSelectedItem();
    if (channelOptional.isPresent()) {
        final IChannel channel = channelOptional.get();
        vuLeft = channel.getVuLeft();
        vuRight = channel.getVuRight();
        desc = channel.getPosition() + 1 + ": " + channel.getName(9);
        final ISendBank sendBank = channel.getSendBank();
        switch(this.selectedParameter) {
            case VOLUME:
                label = "Vol: " + channel.getVolumeStr();
                value = channel.getVolume();
                break;
            case PAN:
                label = "Pan: " + channel.getPanStr();
                value = channel.getPan();
                isPan = true;
                break;
            case SEND1:
            case SEND2:
            case SEND3:
            case SEND4:
            case SEND5:
            case SEND6:
                final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
                label = getSendLabel(sendBank, sendIndex);
                value = getSendValue(sendBank, sendIndex);
                break;
            default:
                label = "Select a track";
                break;
        }
    }
    display.addElement(new TitleValueComponent(desc, label, value, vuLeft, vuRight, isPan));
    display.send();
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ILayer(de.mossgrabers.framework.daw.data.ILayer) IGraphicDisplay(de.mossgrabers.framework.controller.display.IGraphicDisplay) ISpecificDevice(de.mossgrabers.framework.daw.data.ISpecificDevice) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) TitleValueComponent(de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)

Aggregations

ILayer (de.mossgrabers.framework.daw.data.ILayer)14 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)8 IChannel (de.mossgrabers.framework.daw.data.IChannel)3 ISpecificDevice (de.mossgrabers.framework.daw.data.ISpecificDevice)3 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)3 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)2 TitleChannelsComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleChannelsComponent)1 TitleValueComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)1 IBrowser (de.mossgrabers.framework.daw.IBrowser)1 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)1 ITrack (de.mossgrabers.framework.daw.data.ITrack)1 ILayerBank (de.mossgrabers.framework.daw.data.bank.ILayerBank)1 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)1