Search in sources :

Example 1 with SLMkIIIDisplay

use of de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay in project DrivenByMoss by git-moss.

the class SLMkIIIVolumeMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final SLMkIIIDisplay d = this.surface.getDisplay();
    d.clear();
    d.setCell(0, 8, "Volume");
    final ITrackBank tb = this.model.getCurrentTrackBank();
    for (int i = 0; i < 8; i++) {
        final ITrack t = tb.getItem(i);
        if (t.doesExist())
            d.setCell(0, i, "Volume").setCell(1, i, t.getVolumeStr(9));
        this.setColumnColors(d, i, t, SLMkIIIColorManager.SLMKIII_BLUE);
    }
    final ITrack cursorTrack = this.model.getCursorTrack();
    d.setCell(1, 8, cursorTrack.doesExist() ? StringUtils.fixASCII(cursorTrack.getName(9)) : "");
    this.drawRow4();
    this.setButtonInfo(d);
    d.allDone();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) SLMkIIIDisplay(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)

Example 2 with SLMkIIIDisplay

use of de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay in project DrivenByMoss by git-moss.

the class BrowserMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final IBrowser browser = this.model.getBrowser();
    if (!browser.isActive())
        return;
    final SLMkIIIDisplay d = this.surface.getDisplay();
    d.clear();
    d.setCell(0, 0, StringUtils.fixASCII(browser.getSelectedContentType()));
    d.setPropertyColor(0, 0, SLMkIIIColorManager.SLMKIII_GREEN);
    d.setCell(3, 0, "<< Tab");
    d.setPropertyColor(0, 2, SLMkIIIColorManager.SLMKIII_GREEN);
    d.setPropertyValue(0, 1, 0);
    d.setPropertyColor(1, 0, SLMkIIIColorManager.SLMKIII_GREEN);
    d.setCell(3, 1, "Tab >>");
    d.setPropertyColor(1, 2, SLMkIIIColorManager.SLMKIII_GREEN);
    d.setPropertyValue(1, 1, 0);
    final IBrowserColumn selectedFilterColumn = browser.getSelectedFilterColumn();
    d.setCell(0, 2, selectedFilterColumn.doesExist() ? StringUtils.fixASCII(selectedFilterColumn.getName()) : "-");
    d.setPropertyColor(2, 0, SLMkIIIColorManager.SLMKIII_DARK_GREEN_HALF);
    d.setCell(3, 2, "<< Filter");
    d.setPropertyColor(2, 2, SLMkIIIColorManager.SLMKIII_DARK_GREEN_HALF);
    d.setPropertyValue(2, 1, 0);
    d.setPropertyColor(3, 0, SLMkIIIColorManager.SLMKIII_DARK_GREEN_HALF);
    d.setCell(3, 3, "Filter >>");
    d.setPropertyColor(3, 2, SLMkIIIColorManager.SLMKIII_DARK_GREEN_HALF);
    d.setPropertyValue(3, 1, 0);
    d.setCell(0, 4, selectedFilterColumn.doesExist() ? StringUtils.fixASCII(selectedFilterColumn.getCursorName()) : "-");
    d.setPropertyColor(4, 0, SLMkIIIColorManager.SLMKIII_GREEN_LIGHT);
    d.setCell(3, 4, "<< F-Sel");
    d.setPropertyColor(4, 2, SLMkIIIColorManager.SLMKIII_GREEN_LIGHT);
    d.setPropertyValue(4, 1, 0);
    d.setPropertyColor(5, 0, SLMkIIIColorManager.SLMKIII_GREEN_LIGHT);
    d.setCell(3, 5, "F-Sel >>");
    d.setPropertyColor(5, 2, SLMkIIIColorManager.SLMKIII_GREEN_LIGHT);
    d.setPropertyValue(5, 1, 0);
    final String resultName = StringUtils.pad(StringUtils.fixASCII(browser.getSelectedResult()), 18, ' ');
    final String name1 = resultName.substring(0, 9);
    final String name2 = resultName.substring(9, 18);
    d.setCell(0, 6, name1);
    d.setPropertyColor(6, 0, SLMkIIIColorManager.SLMKIII_GREEN_GRASS);
    d.setCell(3, 6, "<< Result");
    d.setPropertyColor(6, 2, SLMkIIIColorManager.SLMKIII_GREEN_GRASS);
    d.setPropertyValue(6, 1, 0);
    d.setCell(0, 7, name2);
    d.setPropertyColor(7, 0, SLMkIIIColorManager.SLMKIII_GREEN_GRASS);
    d.setCell(3, 7, "Result >>");
    d.setPropertyColor(7, 2, SLMkIIIColorManager.SLMKIII_GREEN_GRASS);
    d.setPropertyValue(7, 1, 0);
    d.setCell(0, 8, "Browser");
    this.setButtonInfo(d);
    d.allDone();
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) IBrowserColumn(de.mossgrabers.framework.daw.data.IBrowserColumn) SLMkIIIDisplay(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)

Example 3 with SLMkIIIDisplay

use of de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay in project DrivenByMoss by git-moss.

the class SequencerResolutionMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final SLMkIIIDisplay d = this.surface.getDisplay();
    d.clear();
    final DrumView drumView = (DrumView) this.surface.getViewManager().get(Views.DRUM);
    final int match = Resolution.getMatch(drumView.getClip().getStepLength());
    for (int i = 0; i < 8; i++) {
        d.setCell(3, i, Resolution.getNameAt(i));
        d.setPropertyColor(i, 2, SLMkIIIColorManager.SLMKIII_PINK);
        d.setPropertyValue(i, 1, match == i ? 1 : 0);
    }
    d.setCell(0, 8, "Sequencer");
    d.setCell(1, 8, "Resolutin");
    this.setButtonInfo(d);
    d.allDone();
}
Also used : SLMkIIIDisplay(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay) DrumView(de.mossgrabers.controller.novation.slmkiii.view.DrumView)

Example 4 with SLMkIIIDisplay

use of de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay in project DrivenByMoss by git-moss.

the class UserMode method updateDisplay.

/**
 * {@inheritDoc}
 */
@Override
public void updateDisplay() {
    final SLMkIIIDisplay d = this.surface.getDisplay();
    d.clear();
    final String[] userPageNames = this.surface.getConfiguration().getUserPageNames();
    final int pageSize = this.bank.getPageSize();
    final int selectedPage = this.bank.getScrollPosition() / pageSize;
    d.setCell(0, 8, "User Prms").setCell(1, 8, userPageNames[selectedPage]);
    // Row 1 & 2
    for (int i = 0; i < 8; i++) {
        final IParameter param = this.bank.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_WHITE : SLMkIIIColorManager.SLMKIII_BLACK;
        d.setPropertyColor(i, 0, color);
        d.setPropertyColor(i, 1, color);
    }
    // Row 4
    this.drawRow4(d);
    this.setButtonInfo(d);
    d.allDone();
}
Also used : IParameter(de.mossgrabers.framework.daw.data.IParameter) SLMkIIIDisplay(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)

Example 5 with SLMkIIIDisplay

use of de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay in project DrivenByMoss by git-moss.

the class SLMkIIIControllerSetup method registerTriggerCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerTriggerCommands() {
    final SLMkIIIControlSurface surface = this.getSurface();
    final ModeManager modeManager = surface.getModeManager();
    final ViewManager viewManager = surface.getViewManager();
    final ITransport t = this.model.getTransport();
    final ITrackBank tb = this.model.getTrackBank();
    final WindCommand<SLMkIIIControlSurface, SLMkIIIConfiguration> rewindCommand = new WindCommand<>(this.model, surface, false);
    final WindCommand<SLMkIIIControlSurface, SLMkIIIConfiguration> forwardCommand = new WindCommand<>(this.model, surface, true);
    this.addButton(ButtonID.REWIND, "<<", rewindCommand, 15, SLMkIIIControlSurface.MKIII_TRANSPORT_REWIND, () -> rewindCommand.isRewinding() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_WIND_ON, SLMkIIIColorManager.BUTTON_STATE_WIND_HI);
    this.addButton(ButtonID.FORWARD, ">>", forwardCommand, 15, SLMkIIIControlSurface.MKIII_TRANSPORT_FORWARD, () -> forwardCommand.isForwarding() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_WIND_ON, SLMkIIIColorManager.BUTTON_STATE_WIND_HI);
    this.addButton(ButtonID.LOOP, "Loop", new SLMkIIIToggleLoopCommand(this.model, surface), 15, SLMkIIIControlSurface.MKIII_TRANSPORT_LOOP, () -> t.isLoop() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_LOOP_ON, SLMkIIIColorManager.BUTTON_STATE_LOOP_HI);
    this.addButton(ButtonID.STOP, "Stop", new StopCommand<>(this.model, surface), 15, SLMkIIIControlSurface.MKIII_TRANSPORT_STOP, () -> !t.isPlaying() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_STOP_ON, SLMkIIIColorManager.BUTTON_STATE_STOP_HI);
    this.addButton(ButtonID.PLAY, "Play", new SLMkIIIPlayCommand(this.model, surface), 15, SLMkIIIControlSurface.MKIII_TRANSPORT_PLAY, () -> t.isPlaying() ? 1 : 0, SLMkIIIColorManager.BUTTON_STATE_PLAY_ON, SLMkIIIColorManager.BUTTON_STATE_PLAY_HI);
    this.addButton(ButtonID.RECORD, "Record", new RecordCommand<>(this.model, surface), 15, SLMkIIIControlSurface.MKIII_TRANSPORT_RECORD, () -> {
        final boolean isOn = this.isRecordShifted(surface) ? t.isLauncherOverdub() : t.isRecording();
        return isOn ? 1 : 0;
    }, SLMkIIIColorManager.BUTTON_STATE_REC_ON, SLMkIIIColorManager.BUTTON_STATE_REC_HI, SLMkIIIColorManager.BUTTON_STATE_OVR_ON, SLMkIIIColorManager.BUTTON_STATE_OVR_HI);
    for (int i = 0; i < 8; i++) {
        final int index = i;
        final ButtonID buttonID = ButtonID.get(ButtonID.ROW1_1, i);
        this.addButton(buttonID, "Select " + (i + 1), new ButtonRowModeCommand<>(0, i, this.model, surface), 15, SLMkIIIControlSurface.MKIII_DISPLAY_BUTTON_1 + i, new FeatureGroupButtonColorSupplier(modeManager, buttonID));
        this.addButton(ButtonID.get(ButtonID.ROW2_1, i), "Mute/Monitor " + (i + 1), new ButtonAreaCommand(0, i, this.model, surface), 15, SLMkIIIControlSurface.MKIII_BUTTON_ROW1_1 + i, () -> {
            final ITrack track = tb.getItem(index);
            if (!track.doesExist())
                return SLMkIIIColorManager.SLMKIII_BLACK;
            if (surface.isMuteSolo())
                return track.isMute() ? SLMkIIIColorManager.SLMKIII_ORANGE : SLMkIIIColorManager.SLMKIII_ORANGE_HALF;
            return track.isMonitor() ? SLMkIIIColorManager.SLMKIII_GREEN : SLMkIIIColorManager.SLMKIII_GREEN_HALF;
        });
        this.addButton(ButtonID.get(ButtonID.ROW3_1, i), "Solo/Arm" + (i + 1), new ButtonAreaCommand(1, i, this.model, surface), 15, SLMkIIIControlSurface.MKIII_BUTTON_ROW2_1 + i, () -> {
            final ITrack track = tb.getItem(index);
            if (!track.doesExist())
                return SLMkIIIColorManager.SLMKIII_BLACK;
            if (surface.isMuteSolo())
                return track.isSolo() ? SLMkIIIColorManager.SLMKIII_YELLOW : SLMkIIIColorManager.SLMKIII_YELLOW_HALF;
            return track.isRecArm() ? SLMkIIIColorManager.SLMKIII_RED : SLMkIIIColorManager.SLMKIII_RED_HALF;
        });
    }
    this.addButton(ButtonID.ARROW_UP, "Up", new DeviceModeCommand(this.model, surface), 15, SLMkIIIControlSurface.MKIII_DISPLAY_UP, () -> getDeviceModeColor(modeManager));
    this.addButton(ButtonID.ARROW_DOWN, "Down", new TrackModeCommand(this.model, surface), 15, SLMkIIIControlSurface.MKIII_DISPLAY_DOWN, () -> getTrackModeColor(modeManager));
    this.addButton(ButtonID.SHIFT, "Shift", new ShiftCommand<>(this.model, surface), 15, SLMkIIIControlSurface.MKIII_SHIFT);
    this.addButton(ButtonID.USER, "Options", new ModeSelectCommand<>(this.model, surface, Modes.FUNCTIONS, true), 15, SLMkIIIControlSurface.MKIII_OPTIONS, () -> modeManager.isActive(Modes.FUNCTIONS) ? SLMkIIIColorManager.SLMKIII_DARK_BROWN : SLMkIIIColorManager.SLMKIII_DARK_GREY);
    this.addButton(ButtonID.OCTAVE_UP, "Up", (event, value) -> {
        if (event == ButtonEvent.UP)
            surface.toggleMuteSolo();
    }, 15, SLMkIIIControlSurface.MKIII_BUTTONS_UP, () -> surface.isMuteSolo() ? SLMkIIIColorManager.SLMKIII_ORANGE : SLMkIIIColorManager.SLMKIII_ORANGE_HALF);
    this.addButton(ButtonID.OCTAVE_DOWN, "Down", (event, value) -> {
        if (event == ButtonEvent.UP)
            surface.toggleMuteSolo();
    }, 15, SLMkIIIControlSurface.MKIII_BUTTONS_DOWN, () -> !surface.isMuteSolo() ? SLMkIIIColorManager.SLMKIII_RED : SLMkIIIColorManager.SLMKIII_RED_HALF);
    final ModeCursorCommand<SLMkIIIControlSurface, SLMkIIIConfiguration> cursorLeftCommand = new ModeCursorCommand<>(Direction.LEFT, this.model, surface, true);
    this.addButton(ButtonID.ARROW_LEFT, "Left", cursorLeftCommand, 15, SLMkIIIControlSurface.MKIII_TRACK_LEFT, () -> getCursorColor(modeManager, cursorLeftCommand));
    final ModeCursorCommand<SLMkIIIControlSurface, SLMkIIIConfiguration> cursorRightCommand = new ModeCursorCommand<>(Direction.RIGHT, this.model, surface, true);
    this.addButton(ButtonID.ARROW_RIGHT, "Right", cursorRightCommand, 15, SLMkIIIControlSurface.MKIII_TRACK_RIGHT, () -> getCursorColor(modeManager, cursorRightCommand));
    for (int i = 0; i < 2; i++) {
        final ButtonID sceneButtonID = ButtonID.get(ButtonID.SCENE1, i);
        this.addButton(sceneButtonID, "Scene " + (i + 1), new ViewButtonCommand<>(sceneButtonID, surface), 15, SLMkIIIControlSurface.MKIII_SCENE_1 + i, new FeatureGroupButtonColorSupplier(viewManager, sceneButtonID));
    }
    this.addButton(ButtonID.SCENE7, "Scene Up", (event, value) -> {
        if (event != ButtonEvent.DOWN)
            return;
        if (viewManager.isActive(Views.SESSION))
            this.model.getSceneBank().scrollBackwards();
        else if (viewManager.isActive(Views.DRUM)) {
            final DrumView drumView = (DrumView) viewManager.get(Views.DRUM);
            if (drumView.isPlayMode())
                drumView.onOctaveUp(ButtonEvent.DOWN);
            else
                drumView.onLeft(ButtonEvent.DOWN);
        } else if (viewManager.isActive(Views.COLOR))
            ((ColorView<?, ?>) viewManager.get(Views.COLOR)).setPage(0);
    }, 15, SLMkIIIControlSurface.MKIII_SCENE_UP, this::getSceneUpColor);
    this.addButton(ButtonID.SCENE8, "Scene Down", (event, value) -> {
        if (event != ButtonEvent.DOWN)
            return;
        if (viewManager.isActive(Views.SESSION))
            this.model.getSceneBank().scrollForwards();
        else if (viewManager.isActive(Views.DRUM)) {
            final DrumView drumView = (DrumView) viewManager.get(Views.DRUM);
            if (drumView.isPlayMode())
                drumView.onOctaveDown(ButtonEvent.DOWN);
            else
                drumView.onRight(ButtonEvent.DOWN);
        } else if (viewManager.isActive(Views.COLOR))
            ((ColorView<?, ?>) viewManager.get(Views.COLOR)).setPage(1);
    }, 15, SLMkIIIControlSurface.MKIII_SCENE_DOWN, this::getSceneDownColor);
    this.addButton(ButtonID.SESSION, "Grid", (event, value) -> {
        if (event != ButtonEvent.DOWN)
            return;
        viewManager.setActive(viewManager.isActive(Views.SESSION) ? Views.DRUM : Views.SESSION);
        this.getSurface().getDisplay().notify(viewManager.isActive(Views.SESSION) ? "Session" : "Sequencer");
    }, 15, SLMkIIIControlSurface.MKIII_GRID, () -> viewManager.isActive(Views.SESSION) ? SLMkIIIColorManager.SLMKIII_GREEN : SLMkIIIColorManager.SLMKIII_BLUE);
    this.addButton(ButtonID.DUPLICATE, "Duplicate", NopCommand.INSTANCE, 15, SLMkIIIControlSurface.MKIII_DUPLICATE, () -> surface.isPressed(ButtonID.DUPLICATE) ? SLMkIIIColorManager.SLMKIII_AMBER : SLMkIIIColorManager.SLMKIII_AMBER_HALF);
    final SLMkIIIDisplay display = surface.getDisplay();
    for (int i = 0; i < 8; i++) {
        final int index = i;
        surface.createLight(OutputID.get(OutputID.LED1, i), () -> {
            final ITrack track = tb.getItem(index);
            return track.getColor().dim(this.valueChanger.toNormalizedValue(track.getVolume()));
        }, color -> display.setFaderLEDColor(SLMkIIIControlSurface.MKIII_FADER_LED_1 + index, color));
        surface.createLight(OutputID.get(OutputID.LED_RING1, i), () -> {
            // Note: On mode change the color does not change if the value is the same,
            // let's ignore that since it is only visible in the simulation GUI
            final IMode mode = modeManager.getActive();
            if (mode == null)
                return 0;
            final int value = Math.max(0, mode.getKnobValue(index));
            return this.valueChanger.toMidiValue(value);
        }, color -> surface.setTrigger(SLMkIIIControlSurface.MKIII_KNOB_1 + index, color), state -> {
            // On the device, the send value is displayed on the display as a knob
            // On the simulation GUI represent it as a dimmed color of the mode
            final BaseMode<?> mode = (BaseMode<?>) modeManager.getActive();
            if (mode == null)
                return ColorEx.BLACK;
            final ColorEx c = this.colorManager.getColor(mode.getModeColor(), null);
            return c.dim(this.valueChanger.toNormalizedValue(this.valueChanger.toDAWValue(state)));
        }, null);
    }
}
Also used : ITrackBank(de.mossgrabers.framework.daw.data.bank.ITrackBank) ITransport(de.mossgrabers.framework.daw.ITransport) ColorEx(de.mossgrabers.framework.controller.color.ColorEx) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) DeviceModeCommand(de.mossgrabers.controller.novation.slmkiii.command.trigger.DeviceModeCommand) SLMkIIIControlSurface(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface) BaseMode(de.mossgrabers.controller.novation.slmkiii.mode.BaseMode) WindCommand(de.mossgrabers.framework.command.trigger.transport.WindCommand) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) SLMkIIIToggleLoopCommand(de.mossgrabers.controller.novation.slmkiii.command.trigger.SLMkIIIToggleLoopCommand) ButtonID(de.mossgrabers.framework.controller.ButtonID) SLMkIIIPlayCommand(de.mossgrabers.controller.novation.slmkiii.command.trigger.SLMkIIIPlayCommand) ITrack(de.mossgrabers.framework.daw.data.ITrack) TrackModeCommand(de.mossgrabers.controller.novation.slmkiii.command.trigger.TrackModeCommand) IMode(de.mossgrabers.framework.featuregroup.IMode) SLMkIIIDisplay(de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay) DrumView(de.mossgrabers.controller.novation.slmkiii.view.DrumView) ButtonAreaCommand(de.mossgrabers.controller.novation.slmkiii.command.trigger.ButtonAreaCommand) ModeCursorCommand(de.mossgrabers.framework.command.trigger.mode.ModeCursorCommand) FeatureGroupButtonColorSupplier(de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier)

Aggregations

SLMkIIIDisplay (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIDisplay)12 ITrack (de.mossgrabers.framework.daw.data.ITrack)6 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)5 DrumView (de.mossgrabers.controller.novation.slmkiii.view.DrumView)2 ITransport (de.mossgrabers.framework.daw.ITransport)2 IParameter (de.mossgrabers.framework.daw.data.IParameter)2 ISend (de.mossgrabers.framework.daw.data.ISend)2 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)2 ButtonAreaCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.ButtonAreaCommand)1 DeviceModeCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.DeviceModeCommand)1 SLMkIIIPlayCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.SLMkIIIPlayCommand)1 SLMkIIIToggleLoopCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.SLMkIIIToggleLoopCommand)1 TrackModeCommand (de.mossgrabers.controller.novation.slmkiii.command.trigger.TrackModeCommand)1 SLMkIIIControlSurface (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface)1 BaseMode (de.mossgrabers.controller.novation.slmkiii.mode.BaseMode)1 ModeCursorCommand (de.mossgrabers.framework.command.trigger.mode.ModeCursorCommand)1 WindCommand (de.mossgrabers.framework.command.trigger.transport.WindCommand)1 FeatureGroupButtonColorSupplier (de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier)1 ButtonID (de.mossgrabers.framework.controller.ButtonID)1 ColorEx (de.mossgrabers.framework.controller.color.ColorEx)1