Search in sources :

Example 1 with DisplayMessage

use of de.mossgrabers.push.controller.DisplayMessage 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 2 with DisplayMessage

use of de.mossgrabers.push.controller.DisplayMessage in project DrivenByMoss by git-moss.

the class ClipMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final ICursorClip clip = this.model.getCursorClip();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack t0 = tb.getTrack(0);
    final ITrack t1 = tb.getTrack(1);
    final ITrack t2 = tb.getTrack(2);
    final ITrack t3 = tb.getTrack(3);
    final ITrack t4 = tb.getTrack(4);
    final ITrack t5 = tb.getTrack(5);
    final ITrack t6 = tb.getTrack(6);
    final ITrack t7 = tb.getTrack(7);
    message.addParameterElement("", false, t0.getName(), t0.getType(), t0.getColor(), t0.isSelected(), "Play Start", -1, this.formatMeasures(clip.getPlayStart(), 1), this.isKnobTouched[0], -1);
    message.addParameterElement("", false, t1.getName(), t1.getType(), t1.getColor(), t1.isSelected(), "Play End", -1, this.formatMeasures(clip.getPlayEnd(), 1), this.isKnobTouched[1], -1);
    message.addParameterElement("", false, t2.getName(), t2.getType(), t2.getColor(), t2.isSelected(), "Loop Start", -1, this.formatMeasures(clip.getLoopStart(), 1), this.isKnobTouched[2], -1);
    message.addParameterElement("", false, t3.getName(), t3.getType(), t3.getColor(), t3.isSelected(), "Loop Lngth", -1, this.formatMeasures(clip.getLoopLength(), 0), this.isKnobTouched[3], -1);
    message.addParameterElement("", false, t4.getName(), t4.getType(), t4.getColor(), t4.isSelected(), "Loop", -1, clip.isLoopEnabled() ? "On" : "Off", this.isKnobTouched[4], -1);
    message.addParameterElement("", false, t5.getName(), t5.getType(), t5.getColor(), t5.isSelected(), "", -1, "", false, -1);
    message.addParameterElement("", false, t6.getName(), t6.getType(), t6.getColor(), t6.isSelected(), "Shuffle", -1, clip.isShuffleEnabled() ? "On" : "Off", this.isKnobTouched[6], -1);
    message.addParameterElement("Select color", false, t7.getName(), t7.getType(), t7.getColor(), t7.isSelected(), "Accent", -1, clip.getFormattedAccent(), this.isKnobTouched[7], -1);
    display.send(message);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ICursorClip(de.mossgrabers.framework.daw.ICursorClip) PushDisplay(de.mossgrabers.push.controller.PushDisplay) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 3 with DisplayMessage

use of de.mossgrabers.push.controller.DisplayMessage in project DrivenByMoss by git-moss.

the class MasterMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final IMasterTrack master = this.model.getMasterTrack();
    final IValueChanger valueChanger = this.model.getValueChanger();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    message.addChannelElement("Volume", false, master.getName(), ChannelType.MASTER, master.getColor(), master.isSelected(), valueChanger.toDisplayValue(master.getVolume()), valueChanger.toDisplayValue(master.getModulatedVolume()), this.isKnobTouched[0] ? master.getVolumeStr(8) : "", valueChanger.toDisplayValue(master.getPan()), valueChanger.toDisplayValue(master.getModulatedPan()), this.isKnobTouched[1] ? master.getPanStr(8) : "", valueChanger.toDisplayValue(this.surface.getConfiguration().isEnableVUMeters() ? master.getVu() : 0), master.isMute(), master.isSolo(), master.isRecArm(), 0);
    for (int i = 1; i < 4; i++) {
        message.addChannelSelectorElement(i == 1 ? "Pan" : "", false, "", null, new double[] { 0.0, 0.0, 0.0 }, false);
    }
    message.addOptionElement("", "", false, "Audio Engine", this.model.getApplication().isEngineActive() ? "Active" : "Off", false, false);
    message.addOptionElement("", "", false, "", "", false, false);
    message.addOptionElement("Project:", "", false, this.model.getProject().getName(), "Previous", false, false);
    message.addOptionElement("", "", false, "", "Next", false, false);
    display.send(message);
}
Also used : IValueChanger(de.mossgrabers.framework.controller.IValueChanger) PushDisplay(de.mossgrabers.push.controller.PushDisplay) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 4 with DisplayMessage

use of de.mossgrabers.push.controller.DisplayMessage in project DrivenByMoss by git-moss.

the class ScaleLayoutMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final int sl = this.scales.getScaleLayout().ordinal();
    final int pos = sl / 2;
    final String[] names = ScaleLayout.getNames();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    for (int i = 0; i < names.length; i += 2) message.addOptionElement("", "", false, i == 0 ? "Scale layout" : "", names[i].replace(" ^", ""), pos == i / 2, false);
    message.addOptionElement("", "", false, "", "", false, false);
    message.addOptionElement("", "", false, "", "", false, false);
    message.addOptionElement("", "", false, "", sl % 2 == 0 ? "Horizontal" : "Vertical", false, false);
    display.send(message);
}
Also used : PushDisplay(de.mossgrabers.push.controller.PushDisplay) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 5 with DisplayMessage

use of de.mossgrabers.push.controller.DisplayMessage in project DrivenByMoss by git-moss.

the class ScalesMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final Scale scale = this.scales.getScale();
    final int offset = this.scales.getScaleOffset();
    final Scale[] scaleValues = Scale.values();
    final String rangeText = this.scales.getRangeText();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    final String[] items = new String[6];
    final boolean[] selected = new boolean[6];
    for (int i = 0; i < 6; i++) {
        final int pos = scale.ordinal() + i;
        items[i] = pos < scaleValues.length ? scaleValues[pos].getName() : "";
        selected[i] = i == 0;
    }
    message.addListElement(items, selected);
    for (int i = 0; i < 6; i++) message.addOptionElement(i == 3 ? "Note range: " + rangeText : "", Scales.BASES[6 + i], offset == 6 + i, "", Scales.BASES[i], offset == i, false);
    message.addOptionElement("", this.scales.isChromatic() ? "Chromatc" : "In Key", this.scales.isChromatic(), "", "", false, false);
    display.send(message);
}
Also used : PushDisplay(de.mossgrabers.push.controller.PushDisplay) Scale(de.mossgrabers.framework.scale.Scale) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Aggregations

DisplayMessage (de.mossgrabers.push.controller.DisplayMessage)24 PushDisplay (de.mossgrabers.push.controller.PushDisplay)24 IValueChanger (de.mossgrabers.framework.controller.IValueChanger)6 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)5 ITrack (de.mossgrabers.framework.daw.data.ITrack)5 PushConfiguration (de.mossgrabers.push.PushConfiguration)5 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)3 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)2 IParameter (de.mossgrabers.framework.daw.data.IParameter)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 ViewManager (de.mossgrabers.framework.view.ViewManager)2 IApplication (de.mossgrabers.framework.daw.IApplication)1 IBrowser (de.mossgrabers.framework.daw.IBrowser)1 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)1 ITransport (de.mossgrabers.framework.daw.ITransport)1 IBrowserColumn (de.mossgrabers.framework.daw.data.IBrowserColumn)1 IBrowserColumnItem (de.mossgrabers.framework.daw.data.IBrowserColumnItem)1 IChannel (de.mossgrabers.framework.daw.data.IChannel)1 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)1 Scale (de.mossgrabers.framework.scale.Scale)1