Search in sources :

Example 1 with IDevice

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

the class DeviceParamsMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2(final IGraphicDisplay display) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!this.checkExists2(display, cd))
        return;
    final String color = this.model.getCurrentTrackBank().getSelectedChannelColorEntry();
    final ColorEx bottomMenuColor = DAWColor.getColorEntry(color);
    final IDeviceBank deviceBank = cd.getDeviceBank();
    final IParameterBank parameterBank = cd.getParameterBank();
    final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
    final int selectedPage = parameterPageBank.getSelectedItemIndex();
    final boolean hasPinning = this.model.getHost().supports(Capability.HAS_PINNING);
    final IValueChanger valueChanger = this.model.getValueChanger();
    for (int i = 0; i < parameterBank.getPageSize(); i++) {
        final boolean isTopMenuOn = this.getTopMenuEnablement(cd, hasPinning, i);
        String bottomMenu;
        final String bottomMenuIcon;
        boolean isBottomMenuOn;
        if (this.showDevices) {
            final IDevice item = deviceBank.getItem(i);
            bottomMenuIcon = item.getName();
            bottomMenu = item.doesExist() ? item.getName(12) : "";
            isBottomMenuOn = i == cd.getIndex();
        } else {
            bottomMenuIcon = cd.getName();
            bottomMenu = parameterPageBank.getItem(i);
            if (bottomMenu.length() > 12)
                bottomMenu = bottomMenu.substring(0, 12);
            isBottomMenuOn = i == selectedPage;
        }
        final IParameter param = parameterBank.getItem(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);
        display.addParameterElement(this.hostMenu[i], isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) IDevice(de.mossgrabers.framework.daw.data.IDevice) IDeviceBank(de.mossgrabers.framework.daw.data.bank.IDeviceBank) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 2 with IDevice

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

the class ParametersMode method drawRow4.

private void drawRow4(final SLMkIIIDisplay d, final ICursorDevice cd, final IParameterPageBank parameterPageBank) {
    if (this.surface.isShiftPressed()) {
        this.drawRow4Shifted(d, cd);
        return;
    }
    if (this.surface.isLongPressed(ButtonID.ARROW_UP)) {
        this.drawRow4ArrowUp(d);
        return;
    }
    if (!cd.doesExist()) {
        for (int i = 0; i < 8; i++) {
            d.setPropertyColor(i, 2, SLMkIIIColorManager.SLMKIII_BLACK);
            d.setPropertyValue(i, 1, 0);
        }
        return;
    }
    if (this.showDevices) {
        final IDeviceBank deviceBank = cd.getDeviceBank();
        for (int i = 0; i < 8; i++) {
            final IDevice device = deviceBank.getItem(i);
            final StringBuilder sb = new StringBuilder();
            if (device.doesExist())
                sb.append(device.getName(9));
            d.setCell(3, i, sb.toString());
            d.setPropertyColor(i, 2, device.doesExist() ? SLMkIIIColorManager.SLMKIII_MINT : SLMkIIIColorManager.SLMKIII_BLACK);
            d.setPropertyValue(i, 1, device.doesExist() && i == cd.getIndex() ? 1 : 0);
        }
    } else {
        for (int i = 0; i < parameterPageBank.getPageSize(); i++) {
            final String item = parameterPageBank.getItem(i);
            d.setCell(3, i, item.isEmpty() ? "" : item);
            d.setPropertyColor(i, 2, item.isEmpty() ? SLMkIIIColorManager.SLMKIII_BLACK : SLMkIIIColorManager.SLMKIII_PURPLE);
            d.setPropertyValue(i, 1, parameterPageBank.getSelectedItemIndex() == i ? 1 : 0);
        }
    }
}
Also used : IDevice(de.mossgrabers.framework.daw.data.IDevice) IDeviceBank(de.mossgrabers.framework.daw.data.bank.IDeviceBank)

Example 3 with IDevice

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

the class ParametersMode method getButtonColor.

/**
 * {@inheritDoc}
 */
@Override
public int getButtonColor(final ButtonID buttonID) {
    // Colors in combination with Shift
    if (this.surface.isShiftPressed())
        return this.getButtonColorShifted(buttonID);
    // Colors in combination with Arrow Up
    if (this.surface.isLongPressed(ButtonID.ARROW_UP))
        return this.getButtonColorArrowUp(buttonID);
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!cd.doesExist())
        return 0;
    // Colors normal behavior
    final int index = buttonID.ordinal() - ButtonID.ROW1_1.ordinal();
    if (this.showDevices) {
        final IDeviceBank bank = cd.getDeviceBank();
        final IDevice item = bank.getItem(index);
        if (!item.doesExist())
            return SLMkIIIColorManager.SLMKIII_BLACK;
        return index == cd.getIndex() ? SLMkIIIColorManager.SLMKIII_MINT : SLMkIIIColorManager.SLMKIII_MINT_HALF;
    }
    final IParameterPageBank bank = cd.getParameterPageBank();
    final int selectedItemIndex = bank.getSelectedItemIndex();
    if (bank.getItem(index).isEmpty())
        return SLMkIIIColorManager.SLMKIII_BLACK;
    return index == selectedItemIndex ? SLMkIIIColorManager.SLMKIII_PURPLE : SLMkIIIColorManager.SLMKIII_PURPLE_HALF;
}
Also used : IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) IDevice(de.mossgrabers.framework.daw.data.IDevice) IDeviceBank(de.mossgrabers.framework.daw.data.bank.IDeviceBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 4 with IDevice

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

the class DeviceParamsMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1(final ITextDisplay display) {
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!this.checkExists1(display, cd))
        return;
    // Row 1 & 2
    final IParameterBank parameterBank = cd.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(i);
        display.setCell(0, i, param.doesExist() ? StringUtils.fixASCII(param.getName()) : "").setCell(1, i, StringUtils.fixASCII(param.getDisplayedValue(8)));
    }
    // Row 3
    display.setBlock(2, 0, "Selected Device:").setBlock(2, 1, cd.getName());
    // Row 4
    if (this.showDevices) {
        final IDeviceBank deviceBank = cd.getDeviceBank();
        for (int i = 0; i < 8; i++) {
            final IDevice device = deviceBank.getItem(i);
            final StringBuilder sb = new StringBuilder();
            if (device.doesExist()) {
                if (i == cd.getIndex())
                    sb.append(Push1Display.SELECT_ARROW);
                sb.append(device.getName());
            }
            display.setCell(3, i, sb.toString());
        }
        return;
    }
    final IParameterPageBank bank = cd.getParameterPageBank();
    final int selectedItemIndex = bank.getSelectedItemIndex();
    for (int i = 0; i < bank.getPageSize(); i++) {
        final String item = bank.getItem(i);
        final String selectedStr = i == selectedItemIndex ? Push1Display.SELECT_ARROW : "";
        display.setCell(3, i, item.isEmpty() ? "" : selectedStr + item);
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) IDevice(de.mossgrabers.framework.daw.data.IDevice) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) IDeviceBank(de.mossgrabers.framework.daw.data.bank.IDeviceBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Aggregations

IDevice (de.mossgrabers.framework.daw.data.IDevice)4 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)4 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)3 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)3 IParameter (de.mossgrabers.framework.daw.data.IParameter)2 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)1