Search in sources :

Example 6 with IParameterPageBank

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

the class DeviceConfigView method drawGrid.

/**
 * {@inheritDoc}
 */
@Override
public void drawGrid() {
    final IPadGrid padGrid = this.surface.getPadGrid();
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (!cursorDevice.doesExist()) {
        for (int i = 0; i < 16; i++) padGrid.light(36 + i, LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_BLACK);
    }
    final IParameterPageBank parameterPageBank = cursorDevice.getParameterPageBank();
    final int sel = parameterPageBank.getSelectedItemIndex();
    final int lastPage = Math.min(16, parameterPageBank.getItemCount());
    for (int i = 0; i < lastPage; i++) padGrid.lightEx(i % 8, i / 8, i == sel ? LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_MAGENTA_HI : LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_MAGENTA_LO);
    for (int i = lastPage; i < 16; i++) padGrid.lightEx(i % 8, i / 8, LaunchkeyMk3ColorManager.LAUNCHKEY_COLOR_GREY_LO);
}
Also used : IPadGrid(de.mossgrabers.framework.controller.grid.IPadGrid) IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 7 with IParameterPageBank

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

Example 8 with IParameterPageBank

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

the class ParametersMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final SLMkIIIDisplay d = this.surface.getDisplay();
    d.clear();
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!cd.doesExist()) {
        d.setBlock(1, 1, " Please  select or").setBlock(1, 2, "add a    device.");
        d.setCell(0, 8, "No device");
        d.hideAllElements();
        // Row 4
        this.drawRow4(d, cd, null);
    } else {
        final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
        final Optional<String> selectedPage = parameterPageBank.getSelectedItem();
        d.setCell(0, 8, cd.getName(9)).setCell(1, 8, selectedPage.isPresent() ? selectedPage.get() : "");
        // Row 1 & 2
        for (int i = 0; i < 8; i++) {
            final IParameterBank parameterBank = cd.getParameterBank();
            final IParameter param = parameterBank.getItem(i);
            d.setCell(0, i, param.doesExist() ? StringUtils.fixASCII(param.getName(9)) : "").setCell(1, i, param.getDisplayedValue(9));
            final int color = param.doesExist() ? SLMkIIIColorManager.SLMKIII_PURPLE : SLMkIIIColorManager.SLMKIII_BLACK;
            d.setPropertyColor(i, 0, color);
            d.setPropertyColor(i, 1, color);
        }
        // Row 4
        this.drawRow4(d, cd, parameterPageBank);
    }
    this.setButtonInfo(d);
    d.allDone();
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) SLMkIIIDisplay(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 9 with IParameterPageBank

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

the class ParametersMode method onButton.

/**
 * {@inheritDoc}
 */
@Override
public void onButton(final int row, final int index, final ButtonEvent event) {
    if (event != ButtonEvent.UP)
        return;
    // Combination with Shift
    if (this.surface.isShiftPressed()) {
        this.onButtonShifted(index);
        return;
    }
    // Combination with Arrow Up
    if (this.surface.isLongPressed(ButtonID.ARROW_UP)) {
        this.onButtonArrowUp(index);
        return;
    }
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!cd.doesExist())
        return;
    // Normal behavior - parameters
    if (!this.showDevices) {
        final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
        if (parameterPageBank.getSelectedItemIndex() == index)
            this.setShowDevices(!this.isShowDevices());
        else
            parameterPageBank.selectPage(index);
        return;
    }
    // Combination with Duplicate
    if (this.surface.isPressed(ButtonID.DUPLICATE)) {
        this.surface.setTriggerConsumed(ButtonID.DUPLICATE);
        cd.duplicate();
        return;
    }
    // Combination with Delete
    if (this.surface.isPressed(ButtonID.DELETE)) {
        this.surface.setTriggerConsumed(ButtonID.DELETE);
        cd.getDeviceBank().getItem(index).remove();
        return;
    }
    // Normal behavior - devices
    if (cd.getIndex() == index)
        this.setShowDevices(!this.isShowDevices());
    else
        cd.getDeviceBank().getItem(index).select();
}
Also used : IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 10 with IParameterPageBank

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

the class ParamsMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final IValueChanger valueChanger = this.model.getValueChanger();
    final IParameterPageBank parameterPageBank = this.cursorDevice.getParameterPageBank();
    final Optional<String> selectedItem = parameterPageBank.getSelectedItem();
    final String selectedPage = selectedItem.isPresent() ? StringUtils.optimizeName(selectedItem.get(), 8) : "";
    final int[] vuData = new int[16];
    for (int i = 0; i < 8; i++) {
        final IParameter parameter = this.bank.getItem(i);
        // Track Available
        this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_AVAILABLE, TrackType.GENERIC, i);
        this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_SELECTED, parameter.isSelected() ? 1 : 0, i);
        this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_RECARM, 0, i);
        final boolean exists = parameter.doesExist();
        final String info = exists ? parameter.getDisplayedValue(8) : " ";
        this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME_TEXT, 0, i, info);
        this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_PAN_TEXT, 0, i, info);
        final String name = exists ? this.cursorDevice.getName(8) + "\n" + selectedPage + "\n" + parameter.getName(16) : "None";
        this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_NAME, 0, i, name);
        final int j = 2 * i;
        vuData[j] = valueChanger.toMidiValue(parameter.getModulatedValue());
        vuData[j + 1] = valueChanger.toMidiValue(parameter.getModulatedValue());
    }
    this.surface.sendKontrolTrackSysEx(KontrolProtocolControlSurface.KONTROL_TRACK_VU, 2, 0, vuData);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IValueChanger(de.mossgrabers.framework.controller.valuechanger.IValueChanger) IParameterPageBank(de.mossgrabers.framework.daw.data.bank.IParameterPageBank)

Aggregations

IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)10 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)8 IParameter (de.mossgrabers.framework.daw.data.IParameter)4 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)4 IDevice (de.mossgrabers.framework.daw.data.IDevice)3 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)3 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)2 IValueChanger (de.mossgrabers.framework.controller.valuechanger.IValueChanger)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)1 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1