Search in sources :

Example 31 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();
    final ViewManager viewManager = this.surface.getViewManager();
    if (!browser.isActive()) {
        if (viewManager.isActiveView(Views.VIEW_BROWSER))
            viewManager.restoreView();
        return;
    }
    switch(note) {
        // Cancel
        case 0:
            if (velocity == 0)
                return;
            this.model.getBrowser().stopBrowsing(false);
            viewManager.restoreView();
            break;
        // OK
        case 7:
            if (velocity == 0)
                return;
            this.model.getBrowser().stopBrowsing(true);
            viewManager.restoreView();
            break;
        case 2:
            this.surface.sendMidiEvent(0x90, 48, velocity);
            break;
        case 3:
            this.surface.sendMidiEvent(0x90, 60, velocity);
            break;
        case 4:
            this.surface.sendMidiEvent(0x90, 72, velocity);
            break;
        case 5:
            this.surface.sendMidiEvent(0x90, 84, velocity);
            break;
    }
    if (velocity == 0)
        return;
    if (note >= 16 && note < 48) {
        final int n = note - 16;
        final int row = n / 8;
        final int col = n % 8;
        switch(col) {
            case 6:
                return;
            case 7:
                if (row == 0)
                    browser.selectNextResult();
                else if (row == 1) {
                    for (int i = 0; i < 8; i++) browser.selectNextResult();
                } else if (row == 2) {
                    for (int i = 0; i < 8; i++) browser.selectPreviousResult();
                } else if (row == 3)
                    browser.selectPreviousResult();
                break;
            default:
                if (row == 0)
                    browser.selectNextFilterItem(col);
                else if (row == 1) {
                    for (int i = 0; i < 8; i++) browser.selectNextFilterItem(col);
                } else if (row == 2) {
                    for (int i = 0; i < 8; i++) browser.selectPreviousFilterItem(col);
                } else if (row == 3)
                    browser.selectPreviousFilterItem(col);
                break;
        }
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ViewManager(de.mossgrabers.framework.view.ViewManager)

Example 32 with IBrowser

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

the class BrowserMode method setValue.

/**
 * {@inheritDoc}
 */
@Override
public void setValue(final int index, final int value) {
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive())
        return;
    final int diff = value - this.lastValue;
    final boolean isLeft = value == 0 || diff < 0;
    this.lastValue = value;
    switch(index) {
        case 0:
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 6:
            if (isLeft)
                browser.selectPreviousFilterItem(BrowserMode.COLUMN_ORDER[index]);
            else
                browser.selectNextFilterItem(BrowserMode.COLUMN_ORDER[index]);
            break;
        case 7:
            if (isLeft)
                browser.selectPreviousResult();
            else
                browser.selectNextResult();
            break;
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser)

Example 33 with IBrowser

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

the class LaunchpadCursorCommand method updateArrowStates.

/**
 * {@inheritDoc}
 */
@Override
protected void updateArrowStates() {
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ViewManager viewManager = this.surface.getViewManager();
    if (viewManager.isActiveView(Views.VIEW_PLAY)) {
        final Scales scales = this.model.getScales();
        final int octave = scales.getOctave();
        this.canScrollUp = octave < 3;
        this.canScrollDown = octave > -3;
        final int scale = scales.getScale().ordinal();
        this.canScrollLeft = scale > 0;
        this.canScrollRight = scale < Scale.values().length - 1;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_DRUM)) {
        final int octave = this.model.getScales().getDrumOctave();
        this.canScrollUp = octave < 5;
        this.canScrollDown = octave > -3;
        this.canScrollLeft = this.model.getCursorClip().getEditPage() > 0;
        // TODO API extension required - We do not know the number of steps
        this.canScrollRight = true;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_DRUM64)) {
        final DrumView64 drumView64 = (DrumView64) viewManager.getView(Views.VIEW_DRUM64);
        final int octave = drumView64.getDrumOctave();
        this.canScrollUp = octave < 1;
        this.canScrollDown = octave > -2;
        this.canScrollLeft = false;
        this.canScrollRight = false;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_SEQUENCER) || viewManager.isActiveView(Views.VIEW_RAINDROPS)) {
        final int octave = this.model.getScales().getOctave();
        this.canScrollUp = octave < Scales.OCTAVE_RANGE;
        this.canScrollDown = octave > -Scales.OCTAVE_RANGE;
        this.canScrollLeft = this.model.getCursorClip().getEditPage() > 0;
        // TODO API extension required - We do not know the number of steps
        this.canScrollRight = true;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_DEVICE)) {
        final ICursorDevice cursorDevice = this.model.getCursorDevice();
        this.canScrollUp = cursorDevice.canSelectNextFX();
        this.canScrollDown = cursorDevice.canSelectPreviousFX();
        this.canScrollLeft = cursorDevice.hasPreviousParameterPage();
        this.canScrollRight = cursorDevice.hasNextParameterPage();
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_BROWSER)) {
        final IBrowser browser = this.model.getBrowser();
        final int index = browser.getSelectedContentTypeIndex();
        this.canScrollUp = false;
        this.canScrollDown = false;
        this.canScrollLeft = index > 0;
        this.canScrollRight = index < browser.getContentTypeNames().length - 1;
        return;
    }
    if (viewManager.isActiveView(Views.VIEW_SHIFT) || viewManager.isActiveView(Views.VIEW_DRUM4) || viewManager.isActiveView(Views.VIEW_DRUM8)) {
        this.canScrollUp = false;
        this.canScrollDown = false;
        this.canScrollLeft = false;
        this.canScrollRight = false;
        return;
    }
    // VIEW_SESSION, VIEW_VOLUME, VIEW_PAN, VIEW_SENDS
    final ITrack sel = tb.getSelectedTrack();
    final int selIndex = sel != null ? sel.getIndex() : -1;
    this.canScrollLeft = selIndex > 0 || tb.canScrollTracksUp();
    this.canScrollRight = selIndex >= 0 && selIndex < 7 && tb.getTrack(selIndex + 1).doesExist() || tb.canScrollTracksDown();
    this.canScrollUp = tb.canScrollScenesUp();
    this.canScrollDown = tb.canScrollScenesDown();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ViewManager(de.mossgrabers.framework.view.ViewManager) Scales(de.mossgrabers.framework.scale.Scales) DrumView64(de.mossgrabers.launchpad.view.DrumView64) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Example 34 with IBrowser

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

the class DeviceBrowserMode method updateDisplay1.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay1() {
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive()) {
        this.surface.getModeManager().restoreMode();
        return;
    }
    final Display d = this.surface.getDisplay().clear();
    switch(this.selectionMode) {
        case DeviceBrowserMode.SELECTION_OFF:
            final String selectedResult = browser.getSelectedResult();
            final String deviceName = this.model.getCursorDevice().getName();
            String selectedContentType = browser.getSelectedContentType();
            if (this.filterColumn == -1)
                selectedContentType = PushDisplay.RIGHT_ARROW + selectedContentType;
            d.setCell(0, 7, selectedContentType).setBlock(3, 0, " Selected Device:").setBlock(3, 1, deviceName.length() == 0 ? "None" : deviceName);
            final boolean isPresetSession = browser.isPresetContentType();
            d.setBlock(3, 2, isPresetSession ? " Selected Preset:" : "").setBlock(3, 3, isPresetSession ? selectedResult == null || selectedResult.length() == 0 ? "None" : selectedResult : "");
            for (int i = 0; i < 7; i++) {
                final IBrowserColumn column = this.getFilterColumn(i);
                String name = column == null ? "" : StringUtils.shortenAndFixASCII(column.getName(), 8);
                if (i == this.filterColumn)
                    name = PushDisplay.RIGHT_ARROW + name;
                d.setCell(0, i, name).setCell(1, i, getColumnName(column));
            }
            break;
        case DeviceBrowserMode.SELECTION_PRESET:
            final IBrowserColumnItem[] results = browser.getResultColumnItems();
            if (!results[0].doesExist()) {
                d.clear().setBlock(1, 1, "       No results").setBlock(1, 2, "available...").allDone();
                return;
            }
            for (int i = 0; i < 16; i++) {
                if (i < results.length)
                    d.setBlock(i % 4, i / 4, (results[i].isSelected() ? PushDisplay.RIGHT_ARROW : " ") + results[i].getName(16));
                else
                    d.setBlock(i % 4, i / 4, "");
            }
            break;
        case DeviceBrowserMode.SELECTION_FILTER:
            final IBrowserColumnItem[] items = browser.getFilterColumn(this.filterColumn).getItems();
            for (int i = 0; i < 16; i++) {
                String text = (items[i].isSelected() ? PushDisplay.RIGHT_ARROW : " ") + items[i].getName() + "                ";
                if (!items[i].getName().isEmpty()) {
                    final String hitStr = "(" + items[i].getHitCount() + ")";
                    text = text.substring(0, 17 - hitStr.length()) + hitStr;
                }
                d.setBlock(i % 4, i / 4, text);
            }
            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) Display(de.mossgrabers.framework.controller.display.Display) PushDisplay(de.mossgrabers.push.controller.PushDisplay)

Example 35 with IBrowser

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

the class DeviceBrowserMode method getFilterColumn.

private IBrowserColumn getFilterColumn(final int index) {
    final IBrowser browser = this.model.getBrowser();
    int column = -1;
    final boolean[] browserDisplayFilter = this.surface.getConfiguration().getBrowserDisplayFilter();
    for (int i = 0; i < browser.getFilterColumnCount(); i++) {
        if (browserDisplayFilter[i]) {
            column++;
            if (column == index)
                return browser.getFilterColumn(i);
        }
    }
    return null;
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser)

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