Search in sources :

Example 31 with IChannel

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

the class DeviceRightCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ICursorDevice cd = this.model.getCursorDevice();
    final IChannel sel = cd.getSelectedLayer();
    if (!cd.hasLayers() || sel == null)
        cd.selectNext();
    else {
        final int index = sel.getIndex() + 1;
        cd.selectLayer(index > 7 ? 7 : index);
    }
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 32 with IChannel

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

the class DeviceLayerMode 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.hasSelectedDevice())
            return;
        final int offset = getDrumPadIndex(cd);
        final IChannel layer = cd.getLayerOrDrumPad(offset + index);
        if (!layer.doesExist())
            return;
        final int layerIndex = layer.getIndex();
        if (!layer.isSelected()) {
            cd.selectLayerOrDrumPad(layerIndex);
            return;
        }
        cd.enterLayerOrDrumPad(layer.getIndex());
        cd.selectFirstDeviceInLayerOrDrumPad(layer.getIndex());
        final ModeManager modeManager = this.surface.getModeManager();
        modeManager.setActiveMode(Modes.MODE_DEVICE_PARAMS);
        ((DeviceParamsMode) modeManager.getMode(Modes.MODE_DEVICE_PARAMS)).setShowDevices(true);
        return;
    }
    // LONG press
    this.surface.setButtonConsumed(PushControlSurface.PUSH_BUTTON_ROW1_1 + index);
    this.moveUp();
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 33 with IChannel

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

the class DeviceLayerMode method updateDisplayElements.

/**
 * Update all 8 elements.
 *
 * @param message The display message
 * @param cd The cursor device
 * @param l The channel data
 */
protected void updateDisplayElements(final DisplayMessage message, final ICursorDevice cd, final IChannel l) {
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = getDrumPadIndex(cd);
    // Get the index at which to draw the Sends element
    int sendsIndex = l == null ? -1 : l.getIndex() - offset + 1;
    if (sendsIndex == 8)
        sendsIndex = 6;
    final PushConfiguration config = this.surface.getConfiguration();
    for (int i = 0; i < 8; i++) {
        final IChannel layer = cd.getLayerOrDrumPad(offset + i);
        // The menu
        String topMenu;
        boolean topMenuSelected;
        if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
            topMenu = layer.doesExist() ? "Mute" : "";
            topMenuSelected = layer.isMute();
        } else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
            topMenu = layer.doesExist() ? "Solo" : "";
            topMenuSelected = layer.isSolo();
        } else {
            topMenu = this.menu[i];
            topMenuSelected = i == 7;
        }
        // Channel info
        final String bottomMenu = layer.doesExist() ? layer.getName(12) : "";
        final double[] bottomMenuColor = layer.getColor();
        final boolean isBottomMenuOn = layer.isSelected();
        if (layer.isSelected()) {
            final IValueChanger valueChanger = this.model.getValueChanger();
            message.addChannelElement(topMenu, topMenuSelected, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue(layer.getVolume()), valueChanger.toDisplayValue(layer.getModulatedVolume()), this.isKnobTouched[0] ? layer.getVolumeStr(8) : "", valueChanger.toDisplayValue(layer.getPan()), valueChanger.toDisplayValue(layer.getModulatedPan()), this.isKnobTouched[1] ? layer.getPanStr(8) : "", valueChanger.toDisplayValue(config.isEnableVUMeters() ? layer.getVu() : 0), layer.isMute(), layer.isSolo(), false, 0);
        } else if (sendsIndex == i && l != null) {
            final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
            final String[] sendName = new String[4];
            final String[] valueStr = new String[4];
            final int[] value = new int[4];
            final int[] modulatedValue = new int[4];
            final boolean[] selected = new boolean[4];
            for (int j = 0; j < 4; j++) {
                final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
                final int sendPos = sendOffset + j;
                final ISend send = l.getSend(sendPos);
                sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
                final boolean doesExist = send.doesExist();
                valueStr[j] = doesExist && this.isKnobTouched[4 + j] ? send.getDisplayedValue() : "";
                value[j] = doesExist ? send.getValue() : 0;
                modulatedValue[j] = doesExist ? send.getModulatedValue() : 0;
                selected[j] = true;
            }
            message.addSendsElement(topMenu, topMenuSelected, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, cd.getLayerOrDrumPad(offset + i).getColor(), layer.isSelected(), sendName, valueStr, value, modulatedValue, selected, true);
        } else
            message.addChannelSelectorElement(topMenu, topMenuSelected, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn);
    }
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) IChannel(de.mossgrabers.framework.daw.data.IChannel) IValueChanger(de.mossgrabers.framework.controller.IValueChanger) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISend(de.mossgrabers.framework.daw.data.ISend)

Example 34 with IChannel

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

the class DeviceLayerMode method updateChannelDisplay.

// Called from sub-classes
protected void updateChannelDisplay(final DisplayMessage message, final ICursorDevice cd, final int selectedMenu, final boolean isVolume, final boolean isPan) {
    this.updateMenu();
    final PushConfiguration config = this.surface.getConfiguration();
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = getDrumPadIndex(cd);
    final IValueChanger valueChanger = this.model.getValueChanger();
    for (int i = 0; i < 8; i++) {
        final IChannel layer = cd.getLayerOrDrumPad(offset + i);
        // The menu item
        String topMenu;
        boolean isTopMenuOn;
        if (config.isMuteLongPressed() || config.isMuteSoloLocked() && config.isMuteState()) {
            topMenu = layer.doesExist() ? "Mute" : "";
            isTopMenuOn = layer.isMute();
        } else if (config.isSoloLongPressed() || config.isMuteSoloLocked() && config.isSoloState()) {
            topMenu = layer.doesExist() ? "Solo" : "";
            isTopMenuOn = layer.isSolo();
        } else {
            topMenu = this.menu[i];
            isTopMenuOn = i == 7 || i == selectedMenu - 1;
        }
        message.addChannelElement(selectedMenu, topMenu, isTopMenuOn, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, cd.getLayerOrDrumPad(offset + i).getColor(), layer.isSelected(), valueChanger.toDisplayValue(layer.getVolume()), valueChanger.toDisplayValue(layer.getModulatedVolume()), isVolume && this.isKnobTouched[i] ? layer.getVolumeStr(8) : "", valueChanger.toDisplayValue(layer.getPan()), valueChanger.toDisplayValue(layer.getModulatedPan()), isPan && this.isKnobTouched[i] ? layer.getPanStr() : "", valueChanger.toDisplayValue(config.isEnableVUMeters() ? layer.getVu() : 0), layer.isMute(), layer.isSolo(), false, 0);
    }
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) IChannel(de.mossgrabers.framework.daw.data.IChannel) IValueChanger(de.mossgrabers.framework.controller.IValueChanger)

Example 35 with IChannel

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

the class DeviceLayerMode method onValueKnob.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnob(final int index, final int value) {
    final ICursorDevice cd = this.model.getCursorDevice();
    final IChannel selectedDeviceLayer = cd.getSelectedLayerOrDrumPad();
    if (selectedDeviceLayer == null)
        return;
    switch(index) {
        case 0:
            cd.changeLayerOrDrumPadVolume(selectedDeviceLayer.getIndex(), value);
            break;
        case 1:
            cd.changeLayerOrDrumPadPan(selectedDeviceLayer.getIndex(), value);
            break;
        default:
            if (this.isPush2 && index < 4)
                break;
            final int sendIndex = index - (this.isPush2 ? this.surface.getConfiguration().isSendsAreToggled() ? 0 : 4 : 2);
            cd.changeLayerOrDrumPadSend(selectedDeviceLayer.getIndex(), sendIndex, value);
            break;
    }
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Aggregations

IChannel (de.mossgrabers.framework.daw.data.IChannel)57 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)25 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)9 ISend (de.mossgrabers.framework.daw.data.ISend)9 PushConfiguration (de.mossgrabers.push.PushConfiguration)7 ITrack (de.mossgrabers.framework.daw.data.ITrack)6 Display (de.mossgrabers.framework.controller.display.Display)5 IDrumPadBank (de.mossgrabers.framework.daw.data.bank.IDrumPadBank)5 ModeManager (de.mossgrabers.framework.mode.ModeManager)4 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)3 ILayer (de.mossgrabers.framework.daw.data.ILayer)3 ISpecificDevice (de.mossgrabers.framework.daw.data.ISpecificDevice)3 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)3 PushDisplay (de.mossgrabers.push.controller.PushDisplay)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 TitleChannelsComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleChannelsComponent)2 IValueChanger (de.mossgrabers.framework.controller.IValueChanger)2 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)2 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)2 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)2