Search in sources :

Example 16 with IBrowser

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

the class BrowserView method onGridNote.

/**
 * {@inheritDoc}
 */
@Override
public void onGridNote(final int note, final int velocity) {
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive())
        return;
    switch(note - 36) {
        // Cancel
        case 0:
            if (velocity == 0)
                return;
            browser.stopBrowsing(false);
            this.surface.getViewManager().restore();
            break;
        // OK
        case 7:
            if (velocity == 0)
                return;
            browser.stopBrowsing(true);
            this.surface.getViewManager().restore();
            break;
        // Notes for preview
        case 2:
            this.surface.sendMidiEvent(0x90, 12, velocity);
            break;
        case 3:
            this.surface.sendMidiEvent(0x90, 24, velocity);
            break;
        case 4:
            this.surface.sendMidiEvent(0x90, 36, velocity);
            break;
        case 5:
            this.surface.sendMidiEvent(0x90, 48, velocity);
            break;
        case 10:
            this.surface.sendMidiEvent(0x90, 60, velocity);
            break;
        case 11:
            this.surface.sendMidiEvent(0x90, 72, velocity);
            break;
        case 12:
            this.surface.sendMidiEvent(0x90, 84, velocity);
            break;
        case 13:
            this.surface.sendMidiEvent(0x90, 96, velocity);
            break;
        // Not used
        default:
            break;
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser)

Example 17 with IBrowser

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

the class DevicePresetsMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final ITextDisplay d = this.surface.getTextDisplay().clear();
    if (!this.model.hasSelectedDevice()) {
        d.setRow(0, "                       Please select a device...                       ");
        d.done(0).done(1);
        return;
    }
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive()) {
        d.setRow(0, "                     No active Browsing Session.                       ");
        d.setRow(1, "                        Press Browse again...                          ");
        d.done(0).done(1);
        return;
    }
    String selectedResult;
    switch(this.selectionMode) {
        case DevicePresetsMode.SELECTION_OFF:
            selectedResult = browser.getSelectedResult();
            d.setBlock(0, 0, "Preset:").setBlock(1, 0, selectedResult == null ? "None" : selectedResult);
            for (int i = 0; i < 6; i++) {
                final IBrowserColumn column = browser.getFilterColumn(i);
                final String columnName = column.doesExist() ? StringUtils.shortenAndFixASCII(column.getName() + ":", 8) : "";
                d.setCell(0, 2 + i, columnName).setCell(1, 2 + i, column.doesCursorExist() ? column.getCursorName() : "");
            }
            break;
        case DevicePresetsMode.SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            for (int i = 0; i < 16; i++) d.setCell(i % 2, i / 2, (results[i].isSelected() ? SLDisplay.RIGHT_ARROW : " ") + results[i].getName());
            break;
        case DevicePresetsMode.SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < 16; i++) {
                final String name = StringUtils.fixASCII(items[i].getName());
                String text = (items[i].isSelected() ? SLDisplay.RIGHT_ARROW : " ") + name + "                ";
                if (!name.isEmpty()) {
                    final String hitStr = "(" + items[i].getHitCount() + ")";
                    text = text.substring(0, 17 - hitStr.length()) + hitStr;
                }
                d.setCell(i % 2, i / 2, text);
            }
            break;
        default:
            // Not used
            break;
    }
    d.done(0).done(1);
}
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)

Example 18 with IBrowser

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

the class SelectDeviceViewCommand method execute.

/**
 * {@inheritDoc}
 */
@Override
public void execute(final ButtonEvent event, final int velocity) {
    if (event != ButtonEvent.DOWN)
        return;
    final ViewManager viewManager = this.surface.getViewManager();
    if (this.surface.isPro() && this.surface.isShiftPressed()) {
        if (viewManager.isActive(Views.SHIFT))
            viewManager.restore();
        viewManager.setTemporary(Views.TEMPO);
        this.surface.getDisplay().notify(viewManager.getActive().getName());
        return;
    }
    final IBrowser browser = this.model.getBrowser();
    if (viewManager.isActive(Views.BROWSER)) {
        browser.stopBrowsing(false);
        viewManager.setActive(Views.DEVICE);
        this.surface.getDisplay().notify(viewManager.getActive().getName());
        return;
    }
    if (viewManager.isActive(Views.DEVICE)) {
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        if (this.surface.isShiftPressed() || !cursorDevice.doesExist())
            browser.insertAfterCursorDevice();
        else
            browser.replace(cursorDevice);
        return;
    }
    viewManager.setActive(Views.DEVICE);
    this.surface.getDisplay().notify(viewManager.getActive().getName());
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice)

Example 19 with IBrowser

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

the class BrowserCommand method activateBrowser.

/**
 * Activate the browser depending on the parameters and the currently active mode.
 *
 * @param insertDevice Insert a device if true otherwise select preset
 * @param beforeCurrent Insert the device before the current device if any
 * @return True if activated
 */
private boolean activateBrowser(final boolean insertDevice, final boolean beforeCurrent) {
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final boolean hasCursorDevice = cursorDevice.doesExist();
    final IBrowser browser = this.model.getBrowser();
    if (hasCursorDevice) {
        // Replace the cursor device
        if (!insertDevice) {
            browser.replace(cursorDevice);
            return true;
        }
        if (Modes.isLayerMode(this.surface.getModeManager().getActiveID())) {
            final Optional<ILayer> layer = cursorDevice.getLayerBank().getSelectedItem();
            if (layer.isEmpty())
                return false;
            browser.addDevice(layer.get());
            return true;
        }
        if (beforeCurrent)
            browser.insertBeforeCursorDevice();
        else
            browser.insertAfterCursorDevice();
        return true;
    }
    // No cursor device, add to the selected channel, if any
    final Optional<ITrack> channel = this.model.getCurrentTrackBank().getSelectedItem();
    if (channel.isPresent()) {
        browser.addDevice(channel.get());
        return true;
    }
    final IMasterTrack master = this.model.getMasterTrack();
    if (!master.isSelected())
        return false;
    browser.addDevice(master);
    return true;
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ITrack(de.mossgrabers.framework.daw.data.ITrack) ILayer(de.mossgrabers.framework.daw.data.ILayer) ICursorDevice(de.mossgrabers.framework.daw.data.ICursorDevice) IMasterTrack(de.mossgrabers.framework.daw.data.IMasterTrack)

Example 20 with IBrowser

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

the class BrowserMode method selectPrevious.

private void selectPrevious(final int index, final int count) {
    final IBrowser browser = this.model.getBrowser();
    final int filterColumnCount = Math.min(browser.getFilterColumnCount(), 7);
    if (index < filterColumnCount) {
        final IBrowserColumn fc = browser.getFilterColumn(index);
        if (fc != null && fc.doesExist()) {
            final int fi = fc.getIndex();
            if (fi < 0)
                return;
            for (int j = 0; j < count; j++) browser.selectPreviousFilterItem(fi);
        }
    } else {
        for (int j = 0; j < count; j++) browser.selectPreviousResult();
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn)

Aggregations

IBrowser (de.mossgrabers.framework.daw.IBrowser)49 IBrowserColumn (de.mossgrabers.framework.daw.data.IBrowserColumn)21 IBrowserColumnItem (de.mossgrabers.framework.daw.data.IBrowserColumnItem)11 ICursorDevice (de.mossgrabers.framework.daw.data.ICursorDevice)5 ITextDisplay (de.mossgrabers.framework.controller.display.ITextDisplay)4 ViewManager (de.mossgrabers.framework.view.ViewManager)4 Display (de.mossgrabers.framework.controller.display.Display)3 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)3 ITrack (de.mossgrabers.framework.daw.data.ITrack)3 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)2 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)2 PushDisplay (de.mossgrabers.push.controller.PushDisplay)2 SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)1 ParametersMode (de.mossgrabers.controller.novation.slmkiii.mode.device.ParametersMode)1 UnknownCommandException (de.mossgrabers.controller.osc.exception.UnknownCommandException)1 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1 IGraphicDisplay (de.mossgrabers.framework.controller.display.IGraphicDisplay)1 ILayer (de.mossgrabers.framework.daw.data.ILayer)1 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)1 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)1