Search in sources :

Example 1 with IParameterBank

use of de.mossgrabers.framework.daw.data.bank.IParameterBank 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 IParameterBank

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

the class SLParameterMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay().clearRow(0).clearRow(1);
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!cd.doesExist()) {
        d.setRow(0, "                       Please select a device...                       ");
        d.done(0).done(1);
        return;
    }
    final IParameterBank parameterBank = cd.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(i);
        d.setCell(0, i, param.doesExist() ? StringUtils.shortenAndFixASCII(param.getName(), 8) : "");
        d.setCell(1, i, StringUtils.shortenAndFixASCII(param.getDisplayedValue(8), 8));
    }
    d.done(0).done(1);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 3 with IParameterBank

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

the class UserModule method parseUserValue.

private void parseUserValue(final LinkedList<String> path, final Object value) throws UnknownCommandException, MissingCommandException, IllegalParameterException {
    final IParameterBank parameterBank = this.model.getUserParameterBank();
    final String subCommand = getSubCommand(path);
    try {
        final int paramNo = Integer.parseInt(subCommand) - 1;
        parseFXParamValue(parameterBank.getItem(paramNo), path, value);
    } catch (final NumberFormatException ex) {
        switch(subCommand) {
            case "+":
                if (isTrigger(value))
                    parameterBank.selectNextPage();
                break;
            case "-":
                if (isTrigger(value))
                    parameterBank.selectPreviousPage();
                break;
            case "page":
                final String pageCommand = getSubCommand(path);
                if ("select".equals(pageCommand) || "selected".equals(pageCommand)) {
                    this.selectPage(parameterBank, toInteger(value) - 1);
                } else {
                    try {
                        final int index = Integer.parseInt(pageCommand) - 1;
                        this.selectPage(parameterBank, index);
                    } catch (final NumberFormatException ex2) {
                        throw new UnknownCommandException(pageCommand);
                    }
                }
                break;
            default:
                throw new UnknownCommandException(subCommand);
        }
    }
}
Also used : UnknownCommandException(de.mossgrabers.controller.osc.exception.UnknownCommandException) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank)

Example 4 with IParameterBank

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

the class GenericFlexiControllerSetup method updateIndication.

protected void updateIndication() {
    final Set<FlexiCommand> commands = this.configuration.getMappedCommands();
    final FlexiCommand[] allCommands = FlexiCommand.values();
    final ITrackBank trackBank = this.model.getTrackBank();
    final Optional<ITrack> selectedTrack = trackBank.getSelectedItem();
    for (int i = 0; i < trackBank.getPageSize(); i++) {
        final boolean hasTrackSel = selectedTrack.isPresent() && selectedTrack.get().getIndex() == i;
        final ITrack track = trackBank.getItem(i);
        track.setVolumeIndication(this.testVolumeIndication(commands, allCommands, i, hasTrackSel));
        track.setPanIndication(this.testPanIndication(commands, allCommands, i, hasTrackSel));
        final ISendBank sendBank = track.getSendBank();
        final int sendPageSize = sendBank.getPageSize();
        for (int j = 0; j < sendPageSize; j++) sendBank.getItem(j).setIndication(this.testSendIndication(commands, allCommands, i, hasTrackSel, sendPageSize, j));
    }
    final IMasterTrack masterTrack = this.model.getMasterTrack();
    masterTrack.setVolumeIndication(commands.contains(FlexiCommand.MASTER_SET_VOLUME));
    masterTrack.setPanIndication(commands.contains(FlexiCommand.MASTER_SET_PANORAMA));
    final IParameterBank parameterBank = this.model.getCursorDevice().getParameterBank();
    for (int i = 0; i < parameterBank.getPageSize(); i++) parameterBank.getItem(i).setIndication(this.testParameterIndication(commands, allCommands, i));
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) FlexiCommand(de.mossgrabers.controller.generic.controller.FlexiCommand) ISendBank(de.mossgrabers.framework.daw.data.bank.ISendBank) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 5 with IParameterBank

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

the class UserHandler method handle.

/**
 * {@inheritDoc}
 */
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
    final IParameterBank userParameterBank = this.model.getUserParameterBank();
    if (userParameterBank == null)
        return;
    switch(command) {
        case USER_SET_PARAMETER_1:
        case USER_SET_PARAMETER_2:
        case USER_SET_PARAMETER_3:
        case USER_SET_PARAMETER_4:
        case USER_SET_PARAMETER_5:
        case USER_SET_PARAMETER_6:
        case USER_SET_PARAMETER_7:
        case USER_SET_PARAMETER_8:
            final int index = command.ordinal() - FlexiCommand.USER_SET_PARAMETER_1.ordinal();
            final IParameter userParam = userParameterBank.getItem(index);
            final int val = value.getValue();
            if (isAbsolute(knobMode))
                userParam.setValue(this.getAbsoluteValueChanger(value), val);
            else
                userParam.changeValue(this.getRelativeValueChanger(knobMode), val);
            break;
        case USER_TOGGLE_PARAMETER_1:
        case USER_TOGGLE_PARAMETER_2:
        case USER_TOGGLE_PARAMETER_3:
        case USER_TOGGLE_PARAMETER_4:
        case USER_TOGGLE_PARAMETER_5:
        case USER_TOGGLE_PARAMETER_6:
        case USER_TOGGLE_PARAMETER_7:
        case USER_TOGGLE_PARAMETER_8:
            final IParameter userToggleParam = userParameterBank.getItem(command.ordinal() - FlexiCommand.USER_TOGGLE_PARAMETER_1.ordinal());
            if (this.isButtonPressed(knobMode, value)) {
                final int v = userToggleParam.getValue();
                userToggleParam.setValue(v > 0 ? 0 : this.model.getValueChanger().getUpperBound() - 1);
            }
            break;
        case USER_SELECT_PREVIOUS_PAGE:
            userParameterBank.scrollBackwards();
            this.displaySelectedPage(userParameterBank);
            break;
        case USER_SELECT_NEXT_PAGE:
            userParameterBank.scrollForwards();
            this.displaySelectedPage(userParameterBank);
            break;
        default:
            throw new FlexiHandlerException(command);
    }
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) FlexiHandlerException(de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank)

Aggregations

IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)25 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)14 IParameter (de.mossgrabers.framework.daw.data.IParameter)14 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)5 ITrack (de.mossgrabers.framework.daw.data.ITrack)4 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)4 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)3 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)3 IDevice (de.mossgrabers.framework.daw.data.IDevice)2 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)2 ISendBank (de.mossgrabers.framework.daw.data.bank.ISendBank)2 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)2 Modes (de.mossgrabers.framework.mode.Modes)2 ACVSConfiguration (de.mossgrabers.controller.akai.acvs.ACVSConfiguration)1 ACVSDisplay (de.mossgrabers.controller.akai.acvs.controller.ACVSDisplay)1 TitleValueComponent (de.mossgrabers.controller.akai.fire.graphics.canvas.component.TitleValueComponent)1 BeatstepControlSurface (de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface)1 FlexiCommand (de.mossgrabers.controller.generic.controller.FlexiCommand)1 FlexiHandlerException (de.mossgrabers.controller.generic.flexihandler.utils.FlexiHandlerException)1 TapTempoInitMkICommand (de.mossgrabers.controller.novation.sl.command.continuous.TapTempoInitMkICommand)1