Search in sources :

Example 1 with IParameter

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

the class DeviceParamsMode method updateKnobLEDs.

/**
 * {@inheritDoc}
 */
@Override
protected void updateKnobLEDs() {
    final int upperBound = this.model.getValueChanger().getUpperBound();
    final ICursorDevice cd = this.model.getCursorDevice();
    final int extenderOffset = this.surface.getExtenderOffset();
    for (int i = 0; i < 8; i++) {
        final IParameter param = cd.getFXParam(extenderOffset + i);
        this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_WRAP, param.doesExist() ? param.getValue() : 0, upperBound);
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 2 with IParameter

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

the class DeviceParamsMode method onValueKnobTouch.

/**
 * {@inheritDoc}
 */
@Override
public void onValueKnobTouch(final int index, final boolean isTouched) {
    this.isKnobTouched[index] = isTouched;
    final ICursorDevice cd = this.model.getCursorDevice();
    if (isTouched) {
        if (this.surface.isDeletePressed()) {
            this.surface.setButtonConsumed(this.surface.getDeleteButtonId());
            cd.resetParameter(index);
            return;
        }
        final IParameter param = cd.getFXParam(index);
        if (!param.getName().isEmpty())
            this.surface.getDisplay().notify(param.getName() + ": " + param.getDisplayedValue());
    }
    cd.touchParameter(index, isTouched);
    this.checkStopAutomationOnKnobRelease(isTouched);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 3 with IParameter

use of de.mossgrabers.framework.daw.data.IParameter 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 4 with IParameter

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

the class GrooveMode method updateDisplay2.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay2() {
    final IParameter[] parameters = this.model.getGroove().getParameters();
    final int quantizeAmount = this.surface.getConfiguration().getQuantizeAmount();
    final PushDisplay display = (PushDisplay) this.surface.getDisplay();
    final DisplayMessage message = display.createMessage();
    message.addParameterElement("Quant Amnt", quantizeAmount * 1023 / 100, quantizeAmount + "%", this.isKnobTouched[0], -1);
    message.addOptionElement("     Groove", "", false, "", "", false, false);
    for (int i = 0; i < parameters.length; i++) message.addParameterElement(parameters[i].getName(10), parameters[i].getValue(), parameters[i].getDisplayedValue(8), this.isKnobTouched[i], -1);
    for (int i = parameters.length; i < 6; i++) message.addEmptyElement();
    display.send(message);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) PushDisplay(de.mossgrabers.push.controller.PushDisplay) DisplayMessage(de.mossgrabers.push.controller.DisplayMessage)

Example 5 with IParameter

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

the class DeviceParamsMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final Display d = this.surface.getDisplay().clearRow(0).clearRow(2);
    final ICursorDevice cd = this.model.getCursorDevice();
    if (cd.hasSelectedDevice()) {
        for (int i = 0; i < 8; i++) {
            final IParameter param = cd.getFXParam(i);
            d.setCell(0, i, param.doesExist() ? StringUtils.shortenAndFixASCII(param.getName(), 8) : "").setCell(2, i, param.getDisplayedValue(8));
        }
    } else
        d.setRow(0, "                       Please select a device...                       ");
    d.done(0).done(2);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) Display(de.mossgrabers.framework.controller.display.Display)

Aggregations

IParameter (de.mossgrabers.framework.daw.data.IParameter)76 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)17 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)14 ITrack (de.mossgrabers.framework.daw.data.ITrack)9 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)6 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)6 IGroove (de.mossgrabers.framework.daw.IGroove)5 Display (de.mossgrabers.framework.controller.display.Display)4 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)4 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)4 PushDisplay (de.mossgrabers.push.controller.PushDisplay)4 ITransport (de.mossgrabers.framework.daw.ITransport)3 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 TitleValueComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)2 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)2 FaderConfig (de.mossgrabers.controller.ni.maschine.jam.controller.FaderConfig)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)2 Configuration (de.mossgrabers.framework.configuration.Configuration)2 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)2