Search in sources :

Example 36 with IChannelBank

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

the class PitchbendVolumeCommand method onPitchbend.

/**
 * {@inheritDoc}
 */
@Override
public void onPitchbend(final int channel, final int data1, final int data2) {
    final double value = Math.min(data2 * 127 + (double) data1, this.model.getValueChanger().getUpperBound() - 1);
    if (channel == 8) {
        if (this.surface.isShiftPressed())
            this.model.getTransport().setMetronomeVolume(value);
        else
            this.model.getMasterTrack().setVolume(value);
        return;
    }
    final int extenderOffset = this.surface.getExtenderOffset();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack track = tb.getTrack(extenderOffset + channel);
    if (this.surface.getConfiguration().useFadersAsKnobs()) {
        final ModeManager modeManager = this.surface.getModeManager();
        if (modeManager.isActiveMode(Modes.MODE_VOLUME))
            track.setVolume(value);
        else if (modeManager.isActiveMode(Modes.MODE_PAN))
            track.setPan(value);
        else if (modeManager.isActiveMode(Modes.MODE_TRACK))
            this.handleTrack(channel, value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND1))
            track.getSend(0).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND2))
            track.getSend(1).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND3))
            track.getSend(2).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND4))
            track.getSend(3).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND5))
            track.getSend(4).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND6))
            track.getSend(5).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND7))
            track.getSend(6).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND8))
            track.getSend(7).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS))
            this.model.getCursorDevice().setParameter(extenderOffset + channel, (int) value);
        return;
    }
    track.setVolume(value);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 37 with IChannelBank

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

the class DeviceLayerModeSend method updateDisplayElements.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplayElements(final DisplayMessage message, final ICursorDevice cd, final IChannel l) {
    final int sendIndex = this.getCurrentSendIndex();
    final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
    this.updateMenu();
    final PushConfiguration config = this.surface.getConfiguration();
    // Drum Pad Bank has size of 16, layers only 8
    final int offset = getDrumPadIndex(cd);
    final int sendOffset = config.isSendsAreToggled() ? 4 : 0;
    for (int i = 0; i < 8; i++) {
        final IChannel layer = cd.getLayerOrDrumPad(offset + i);
        // The menu item
        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 > 3 && i - 4 + sendOffset == sendIndex;
        }
        // Channel info
        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 sendPos = sendOffset + j;
            final ISend send = layer.getSend(sendPos);
            sendName[j] = fxTrackBank == null ? send.getName() : fxTrackBank.getTrack(sendPos).getName();
            valueStr[j] = send.doesExist() && sendIndex == sendPos && this.isKnobTouched[i] ? send.getDisplayedValue() : "";
            value[j] = send.doesExist() ? send.getValue() : 0;
            modulatedValue[j] = send.doesExist() ? send.getModulatedValue() : 0;
            selected[j] = sendIndex == sendPos;
        }
        message.addSendsElement(topMenu, topMenuSelected, layer.doesExist() ? layer.getName() : "", ChannelType.LAYER, cd.getLayerOrDrumPad(offset + i).getColor(), layer.isSelected(), sendName, valueStr, value, modulatedValue, selected, false);
    }
}
Also used : PushConfiguration(de.mossgrabers.push.PushConfiguration) IChannel(de.mossgrabers.framework.daw.data.IChannel) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ISend(de.mossgrabers.framework.daw.data.ISend)

Example 38 with IChannelBank

use of de.mossgrabers.framework.daw.IChannelBank 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 39 with IChannelBank

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

the class AbstractTrackMode method drawRow4.

protected void drawRow4() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selTrack = tb.getSelectedTrack();
    // Format track names
    final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
    final Display d = this.surface.getDisplay();
    for (int i = 0; i < 8; i++) {
        final boolean isSel = i == selIndex;
        final ITrack t = tb.getTrack(i);
        final String n = StringUtils.shortenAndFixASCII(t.getName(), isSel ? 7 : 8);
        d.setCell(3, i, isSel ? PushDisplay.RIGHT_ARROW + n : n);
    }
    d.done(3);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) Display(de.mossgrabers.framework.controller.display.Display) PushDisplay(de.mossgrabers.push.controller.PushDisplay)

Example 40 with IChannelBank

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

the class AbstractTrackMode method getTrackButtonColor.

protected int getTrackButtonColor(final ITrack track) {
    if (!track.doesExist() || !track.isActivated())
        return this.isPush2 ? PushColors.PUSH2_COLOR_BLACK : PushColors.PUSH1_COLOR_BLACK;
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selTrack = tb.getSelectedTrack();
    final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
    final boolean isSel = track.getIndex() == selIndex;
    if (track.isRecArm())
        return isSel ? this.isPush2 ? PushColors.PUSH2_COLOR_RED_HI : PushColors.PUSH1_COLOR_RED_HI : this.isPush2 ? PushColors.PUSH2_COLOR_RED_LO : PushColors.PUSH1_COLOR_RED_LO;
    return isSel ? this.isPush2 ? PushColors.PUSH2_COLOR_ORANGE_HI : PushColors.PUSH1_COLOR_ORANGE_HI : this.isPush2 ? PushColors.PUSH2_COLOR_YELLOW_LO : PushColors.PUSH1_COLOR_YELLOW_LO;
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank)

Aggregations

IChannelBank (de.mossgrabers.framework.daw.IChannelBank)114 ITrack (de.mossgrabers.framework.daw.data.ITrack)92 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)22 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)20 ModeManager (de.mossgrabers.framework.mode.ModeManager)20 PushConfiguration (de.mossgrabers.push.PushConfiguration)19 Display (de.mossgrabers.framework.controller.display.Display)18 ISend (de.mossgrabers.framework.daw.data.ISend)11 ViewManager (de.mossgrabers.framework.view.ViewManager)10 PushDisplay (de.mossgrabers.push.controller.PushDisplay)10 IChannel (de.mossgrabers.framework.daw.data.IChannel)9 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)7 ISlot (de.mossgrabers.framework.daw.data.ISlot)7 IValueChanger (de.mossgrabers.framework.controller.IValueChanger)5 View (de.mossgrabers.framework.view.View)5 DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)5 ITransport (de.mossgrabers.framework.daw.ITransport)4 IMidiOutput (de.mossgrabers.framework.daw.midi.IMidiOutput)4 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)3 PadGrid (de.mossgrabers.framework.controller.grid.PadGrid)3