Search in sources :

Example 51 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 IGraphicDisplay display, final int selectedMenu, final boolean isVolume, final boolean isPan) {
    this.updateMenuItems(selectedMenu);
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = this.getDrumPadIndex();
    final IValueChanger valueChanger = this.model.getValueChanger();
    for (int i = 0; i < 8; i++) {
        final IChannel layer = this.bank.getItem(offset + i);
        final Pair<String, Boolean> pair = this.menu.get(i);
        final String topMenu = pair.getKey();
        final boolean isTopMenuOn = pair.getValue().booleanValue();
        final boolean enableVUMeters = this.configuration.isEnableVUMeters();
        final int vuR = valueChanger.toDisplayValue(enableVUMeters ? layer.getVuRight() : 0);
        final int vuL = valueChanger.toDisplayValue(enableVUMeters ? layer.getVuLeft() : 0);
        display.addChannelElement(selectedMenu, topMenu, isTopMenuOn, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, layer.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() : "", vuL, vuR, layer.isMute(), layer.isSolo(), false, layer.isActivated(), 0, false);
    }
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger)

Example 52 with IChannel

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

the class DeviceLayerModeSend method updateDisplayElements.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplayElements(final IGraphicDisplay display, final Optional<ILayer> l) {
    this.updateMenuItems(5 + this.sendIndex % 4);
    final PushConfiguration config = this.surface.getConfiguration();
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = this.getDrumPadIndex();
    final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
    for (int i = 0; i < 8; i++) {
        final IChannel layer = this.bank.getItem(offset + i);
        final Pair<String, Boolean> pair = this.menu.get(i);
        final String topMenu = pair.getKey();
        final boolean isTopMenuOn = pair.getValue().booleanValue();
        // Channel info
        final SendData[] sendData = new SendData[4];
        for (int j = 0; j < 4; j++) {
            final int sendPos = sendOffset + j;
            final ISend send = layer.getSendBank().getItem(sendPos);
            final boolean exists = send.doesExist();
            sendData[j] = new SendData(send.getName(), exists && this.sendIndex == sendPos && this.isKnobTouched[i] ? send.getDisplayedValue() : "", exists ? send.getValue() : 0, exists ? send.getModulatedValue() : 0, this.sendIndex == sendPos);
        }
        display.addSendsElement(topMenu, isTopMenuOn, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, this.bank.getItem(offset + i).getColor(), layer.isSelected(), sendData, false, layer.isActivated(), layer.isActivated());
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) IChannel(de.mossgrabers.framework.daw.data.IChannel) ISend(de.mossgrabers.framework.daw.data.ISend) SendData(de.mossgrabers.framework.graphics.canvas.utils.SendData)

Example 53 with IChannel

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

the class DeviceLayerModeSend method onKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
    this.isKnobTouched[index] = isTouched;
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = this.getDrumPadIndex();
    final IChannel layer = this.bank.getItem(offset + index);
    if (!layer.doesExist())
        return;
    if (isTouched && this.surface.isDeletePressed()) {
        this.surface.setTriggerConsumed(ButtonID.DELETE);
        layer.getSendBank().getItem(this.sendIndex).resetValue();
    }
    layer.getSendBank().getItem(this.sendIndex).touchValue(isTouched);
    this.checkStopAutomationOnKnobRelease(isTouched);
}
Also used : IChannel(de.mossgrabers.framework.daw.data.IChannel)

Example 54 with IChannel

use of de.mossgrabers.framework.daw.data.IChannel 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 55 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 display The display
 * @param l The channel data
 */
protected void updateDisplayElements(final IGraphicDisplay display, final Optional<ILayer> l) {
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = this.getDrumPadIndex();
    // Get the index at which to draw the Sends element
    int sendsIndex = l.isEmpty() ? -1 : l.get().getIndex() - offset + 1;
    if (sendsIndex == 8)
        sendsIndex = 6;
    this.updateMenuItems(-1);
    final PushConfiguration config = this.surface.getConfiguration();
    for (int i = 0; i < 8; i++) {
        final IChannel layer = this.bank.getItem(offset + i);
        final Pair<String, Boolean> pair = this.menu.get(i);
        final String topMenu = pair.getKey();
        final boolean isTopMenuOn = pair.getValue().booleanValue();
        // Channel info
        final String bottomMenu = layer.doesExist() ? layer.getName(12) : "";
        final ColorEx bottomMenuColor = layer.getColor();
        final boolean isBottomMenuOn = layer.isSelected();
        if (layer.isSelected()) {
            final IValueChanger valueChanger = this.model.getValueChanger();
            final boolean enableVUMeters = config.isEnableVUMeters();
            final int vuR = valueChanger.toDisplayValue(enableVUMeters ? layer.getVuRight() : 0);
            final int vuL = valueChanger.toDisplayValue(enableVUMeters ? layer.getVuLeft() : 0);
            display.addChannelElement(topMenu, isTopMenuOn, 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) : "", vuL, vuR, layer.isMute(), layer.isSolo(), false, layer.isActivated(), 0, false);
        } else if (sendsIndex == i && l.isPresent()) {
            final ITrackBank fxTrackBank = this.model.getEffectTrackBank();
            final SendData[] sendData = new SendData[4];
            for (int j = 0; j < 4; j++) {
                final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
                final int sendPos = sendOffset + j;
                final ISend send = l.get().getSendBank().getItem(sendPos);
                final boolean doesExist = send.doesExist();
                sendData[j] = new SendData(fxTrackBank == null ? send.getName() : fxTrackBank.getItem(sendPos).getName(), doesExist && this.isKnobTouched[4 + j] ? send.getDisplayedValue() : "", doesExist ? send.getValue() : 0, doesExist ? send.getModulatedValue() : 0, true);
            }
            display.addSendsElement(topMenu, isTopMenuOn, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, this.bank.getItem(offset + i).getColor(), layer.isSelected(), sendData, true, l.get().isActivated(), layer.isActivated());
        } else
            display.addChannelSelectorElement(topMenu, isTopMenuOn, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn, layer.isActivated());
    }
}
Also used : PushConfiguration(de.mossgrabers.controller.ableton.push.PushConfiguration) IChannel(de.mossgrabers.framework.daw.data.IChannel) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) ISend(de.mossgrabers.framework.daw.data.ISend) SendData(de.mossgrabers.framework.graphics.canvas.utils.SendData)

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