Search in sources :

Example 61 with ICursorDevice

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

the class DeviceBrowserMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final IBrowser browser = this.model.getBrowser();
    final ITextDisplay d = this.surface.getTextDisplay();
    final boolean isPresetSession = browser.isPresetContentType();
    final ICursorDevice cd = this.model.getCursorDevice();
    if (isPresetSession && !(browser.isActive() && cd.doesExist())) {
        d.notify("No active Browsing Session. Select device and press Browser...");
        return;
    }
    d.clear();
    switch(this.selectionMode) {
        case SELECTION_OFF:
            for (int i = 0; i < 7; i++) {
                final Optional<IBrowserColumn> column = this.getFilterColumn(i);
                String value = "";
                String name = "";
                if (column.isPresent()) {
                    final IBrowserColumn browserColumn = column.get();
                    if (browserColumn.doesCursorExist())
                        value = browserColumn.getCursorName().equals(browserColumn.getWildcard()) ? "-" : browserColumn.getCursorName();
                    name = StringUtils.shortenAndFixASCII(browserColumn.getName(), 6);
                }
                d.setCell(0, i, name).setCell(1, i, value);
            }
            final String selectedResult = browser.getSelectedResult();
            d.setCell(0, 7, browser.getSelectedContentType()).setCell(1, 7, selectedResult == null || selectedResult.length() == 0 ? "-" : selectedResult);
            break;
        case SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < browser.getNumFilterColumnEntries(); i++) {
                if (i < results.length)
                    d.setBlock(i / 4, i % 4, (results[i].isSelected() ? ">" : " ") + StringUtils.fixASCII(results[i].getName()));
                else
                    break;
            }
            break;
        case SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < browser.getNumResults(); i++) d.setBlock(i / 4, i % 4, (items[i].isSelected() ? ">" : " ") + StringUtils.fixASCII(items[i].getName()));
            break;
        default:
            // Not used
            break;
    }
    d.allDone();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumnItem(de.mossgrabers.framework.daw.data.IBrowserColumnItem) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 62 with ICursorDevice

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

the class DeviceParamsMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    this.drawDisplay2();
    final ITextDisplay d = this.surface.getTextDisplay().clear();
    final ICursorDevice cd = this.model.getCursorDevice();
    if (!cd.doesExist()) {
        d.notify("Please select a device...");
        return;
    }
    // Row 1 & 2
    final int extenderOffset = this.surface.getExtenderOffset();
    final IParameterBank parameterBank = cd.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(extenderOffset + i);
        d.setCell(0, i, param.doesExist() ? StringUtils.shortenAndFixASCII(param.getName(6), 6) : "").setCell(1, i, StringUtils.shortenAndFixASCII(param.getDisplayedValue(6), 6));
    }
    d.allDone();
}
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 63 with ICursorDevice

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

the class SelectCommand method handleButtonCombinations.

private boolean handleButtonCombinations(final ButtonEvent event) {
    // Select Send channels if Send button is pressed
    if (this.surface.isPressed(ButtonID.SENDS)) {
        if (event != ButtonEvent.DOWN)
            return true;
        final ITextDisplay display = this.surface.getTextDisplay();
        final ITrackBank effectTrackBank = this.model.getEffectTrackBank();
        if (effectTrackBank != null && effectTrackBank.getItem(this.channel).doesExist()) {
            this.surface.getModeManager().setActive(Modes.get(Modes.SEND1, this.index));
            display.notify("Send channel " + (this.channel + 1) + " selected.");
        } else
            display.notify("Send channel " + (this.channel + 1) + " does not exist.");
        this.surface.setTriggerConsumed(ButtonID.SENDS);
        return true;
    }
    // Execute stop if Select is pressed
    if (this.surface.isSelectPressed()) {
        if (event == ButtonEvent.DOWN)
            this.getTrackBank().getItem(this.channel).stop();
        return true;
    }
    if (this.surface.getConfiguration().hasOnly1Fader()) {
        if (event != ButtonEvent.DOWN)
            return true;
        final ModeManager modeManager = this.surface.getModeManager();
        // Select marker if marker mode is active
        if (modeManager.isActive(Modes.MARKERS)) {
            this.model.getMarkerBank().getItem(this.channel).select();
            return true;
        }
        // Select parameter if device mode is active
        if (modeManager.isActive(Modes.DEVICE_PARAMS)) {
            final ICursorDevice cursorDevice = this.model.getCursorDevice();
            if (cursorDevice.doesExist())
                cursorDevice.getParameterBank().getItem(this.channel).select();
            return true;
        }
    }
    return false;
}
Also used : ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 64 with ICursorDevice

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

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

Aggregations

ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)67 IParameter (de.mossgrabers.framework.daw.data.IParameter)17 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)14 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)10 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)8 ILayer (de.mossgrabers.framework.daw.data.ILayer)8 IParameterPageBank (de.mossgrabers.framework.daw.data.bank.IParameterPageBank)8 ITrack (de.mossgrabers.framework.daw.data.ITrack)7 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)7 IBrowser (de.mossgrabers.framework.daw.IBrowser)5 IDeviceBank (de.mossgrabers.framework.daw.data.bank.IDeviceBank)5 Modes (de.mossgrabers.framework.mode.Modes)5 IPadGrid (de.mossgrabers.framework.controller.grid.IPadGrid)3 ITransport (de.mossgrabers.framework.daw.ITransport)3 IDevice (de.mossgrabers.framework.daw.data.IDevice)3 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)3 IDrumPadBank (de.mossgrabers.framework.daw.data.bank.IDrumPadBank)3 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)3 PushConfiguration (de.mossgrabers.controller.ableton.push.PushConfiguration)2 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)2