Search in sources :

Example 31 with ICursorDevice

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

the class ParameterView method executeFunction.

/**
 * {@inheritDoc}
 */
@Override
protected void executeFunction(final int padIndex) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final IHost host = this.model.getHost();
    if (!cursorDevice.doesExist()) {
        host.showNotification("No device selected.");
        return;
    }
    switch(padIndex) {
        case 12:
            cursorDevice.selectPrevious();
            break;
        case 13:
            cursorDevice.selectNext();
            break;
        case 14:
            cursorDevice.getParameterBank().scrollBackwards();
            this.mvHelper.notifySelectedParameterPage();
            break;
        case 15:
            cursorDevice.getParameterBank().scrollForwards();
            this.mvHelper.notifySelectedParameterPage();
            break;
        default:
            // Not used
            break;
    }
    if (padIndex >= 8)
        return;
    // Flip row 2 and 1 to look the same as in the Bitwig device display
    final int selectedParameter = padIndex < 4 ? padIndex + 4 : padIndex - 4;
    ((SelectedDeviceMode<?, ?>) this.surface.getModeManager().get(Modes.DEVICE_PARAMS)).selectParameter(selectedParameter);
    this.model.getHost().scheduleTask(() -> {
        final StringBuilder message = new StringBuilder();
        final Optional<String> selectedPage = cursorDevice.getParameterPageBank().getSelectedItem();
        if (selectedPage.isEmpty())
            message.append("No parameters available.");
        else {
            message.append(selectedPage.get()).append(": ");
            final IParameter item = cursorDevice.getParameterBank().getItem(selectedParameter);
            if (item.doesExist())
                message.append(item.getName());
            else
                message.append("None");
        }
        host.showNotification(message.toString());
    }, 200);
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) IHost(de.mossgrabers.framework.daw.IHost) SelectedDeviceMode(de.mossgrabers.framework.mode.device.SelectedDeviceMode) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 32 with ICursorDevice

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

the class BrowseMode 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();
    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);
        }
        if (i == this.getSelectedParameter())
            name = ">" + name;
        d.setCell(0, i, name).setCell(1, i, value);
    }
    final String selectedResult = browser.getSelectedResult();
    String selectedContentType = browser.getSelectedContentType();
    if (this.getSelectedParameter() == 7)
        selectedContentType = ">" + selectedContentType;
    d.setCell(0, 7, selectedContentType).setCell(1, 7, selectedResult == null || selectedResult.length() == 0 ? "-" : selectedResult);
    d.allDone();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) ITextDisplay(de.mossgrabers.framework.controller.display.ITextDisplay) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 33 with ICursorDevice

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

the class DeviceConfigView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    if (velocity == 0)
        return;
    final int n = note - 36;
    final int page = n < 8 ? n + 8 : n - 8;
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    if (cursorDevice.doesExist())
        cursorDevice.getParameterPageBank().selectPage(page);
}
Also used : ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 34 with ICursorDevice

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

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

the class MaschineParametersMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    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 IParameterBank parameterBank = cd.getParameterBank();
    for (int i = 0; i < 8; i++) {
        final IParameter param = parameterBank.getItem(i);
        String name = param.doesExist() ? StringUtils.shortenAndFixASCII(param.getName(), 6) : "";
        if (i == this.getSelectedParameter())
            name = ">" + name;
        d.setCell(0, i, name).setCell(1, i, StringUtils.shortenAndFixASCII(param.getDisplayedValue(8), 8));
    }
    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)

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