Search in sources :

Example 6 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class MCUControllerSetup method updateFaders.

private void updateFaders(final IMidiOutput output, final int index, final int channel, final ITrack track) {
    int value = track.getVolume();
    if (this.configuration.useFadersAsKnobs()) {
        final ModeManager modeManager = this.getSurface().getModeManager();
        if (modeManager.isActiveMode(Modes.MODE_VOLUME))
            value = track.getVolume();
        else if (modeManager.isActiveMode(Modes.MODE_PAN))
            value = track.getPan();
        else if (modeManager.isActiveMode(Modes.MODE_TRACK)) {
            final IChannelBank tb = this.model.getCurrentTrackBank();
            final ITrack selectedTrack = tb.getSelectedTrack();
            if (selectedTrack == null)
                value = 0;
            else {
                final ITrack selTrack = tb.getTrack(selectedTrack.getIndex());
                switch(index) {
                    case 0:
                        value = selTrack.getVolume();
                        break;
                    case 1:
                        value = selTrack.getPan();
                        break;
                    default:
                        final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
                        if (index == 2) {
                            if (this.configuration.isDisplayCrossfader()) {
                                final int crossfadeMode = selectedTrack.getCrossfadeModeAsNumber();
                                value = crossfadeMode == 2 ? this.valueChanger.getUpperBound() : crossfadeMode == 1 ? this.valueChanger.getUpperBound() / 2 : 0;
                            } else if (!effectTrackBankActive)
                                value = selTrack.getSend(0).getValue();
                        } else if (!effectTrackBankActive)
                            value = selTrack.getSend(index - (this.configuration.isDisplayCrossfader() ? 3 : 2)).getValue();
                        break;
                }
            }
        } else if (modeManager.isActiveMode(Modes.MODE_SEND1))
            value = track.getSend(0).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND2))
            value = track.getSend(1).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND3))
            value = track.getSend(2).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND4))
            value = track.getSend(3).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND5))
            value = track.getSend(4).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND6))
            value = track.getSend(5).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND7))
            value = track.getSend(6).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_SEND8))
            value = track.getSend(7).getValue();
        else if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS))
            value = this.model.getCursorDevice().getFXParam(channel).getValue();
    }
    if (value != this.faderValues[channel]) {
        this.faderValues[channel] = value;
        output.sendPitchbend(index, value % 127, value / 127);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 7 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class MCUControllerSetup method createModes.

/**
 * {@inheritDoc}
 */
@Override
protected void createModes() {
    for (int index = 0; index < this.numMCUDevices; index++) {
        final MCUControlSurface surface = this.getSurface(index);
        final ModeManager modeManager = surface.getModeManager();
        modeManager.registerMode(Modes.MODE_TRACK, new TrackMode(surface, this.model));
        modeManager.registerMode(Modes.MODE_VOLUME, new VolumeMode(surface, this.model));
        modeManager.registerMode(Modes.MODE_PAN, new PanMode(surface, this.model));
        final SendMode modeSend = new SendMode(surface, this.model);
        for (int i = 0; i < 8; i++) modeManager.registerMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + i), modeSend);
        modeManager.registerMode(Modes.MODE_DEVICE_PARAMS, new DeviceParamsMode(surface, this.model));
        modeManager.registerMode(Modes.MODE_BROWSER, new DeviceBrowserMode(surface, this.model));
        modeManager.registerMode(Modes.MODE_MASTER, new MasterMode(surface, this.model, false));
    }
}
Also used : TrackMode(de.mossgrabers.mcu.mode.track.TrackMode) MasterMode(de.mossgrabers.mcu.mode.track.MasterMode) VolumeMode(de.mossgrabers.mcu.mode.track.VolumeMode) SendMode(de.mossgrabers.mcu.mode.track.SendMode) PanMode(de.mossgrabers.mcu.mode.track.PanMode) DeviceParamsMode(de.mossgrabers.mcu.mode.device.DeviceParamsMode) MCUControlSurface(de.mossgrabers.mcu.controller.MCUControlSurface) DeviceBrowserMode(de.mossgrabers.mcu.mode.device.DeviceBrowserMode) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 8 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class LaunchpadControllerSetup method updateButtons.

private void updateButtons() {
    final LaunchpadControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final View activeView = viewManager.getActiveView();
    if (activeView != null) {
        ((LaunchpadCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
        ((SceneView) activeView).updateSceneButtons();
    }
    if (!this.isPro) {
        surface.setButton(LaunchpadControlSurface.LAUNCHPAD_MKII_BUTTON_USER, surface.isUserPressed() ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
        return;
    }
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_PRO_BUTTON_USER, LaunchpadColors.LAUNCHPAD_COLOR_BLACK);
    final boolean isShift = surface.isShiftPressed();
    final ITrack selTrack = this.model.getCurrentTrackBank().getSelectedTrack();
    final int index = selTrack == null ? -1 : selTrack.getIndex();
    final ModeManager modeManager = surface.getModeManager();
    final ITransport transport = this.model.getTransport();
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SHIFT, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_CLICK, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : transport.isMetronomeOn() ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_HI : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_UNDO, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DELETE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_QUANTIZE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_BLACK : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DUPLICATE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_DOUBLE, isShift ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN_SPRING : LaunchpadColors.LAUNCHPAD_COLOR_GREEN_LO);
    final boolean flipRecord = surface.getConfiguration().isFlipRecord();
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_RECORD, isShift && !flipRecord || !isShift && flipRecord ? transport.isLauncherOverdub() ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : LaunchpadColors.LAUNCHPAD_COLOR_RED_AMBER : transport.isRecording() ? LaunchpadColors.LAUNCHPAD_COLOR_RED_HI : LaunchpadColors.LAUNCHPAD_COLOR_RED_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_REC_ARM, modeManager.isActiveMode(Modes.MODE_REC_ARM) ? LaunchpadColors.LAUNCHPAD_COLOR_RED : index == 0 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_TRACK, modeManager.isActiveMode(Modes.MODE_TRACK_SELECT) ? LaunchpadColors.LAUNCHPAD_COLOR_GREEN : index == 1 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_MUTE, modeManager.isActiveMode(Modes.MODE_MUTE) ? LaunchpadColors.LAUNCHPAD_COLOR_YELLOW : index == 2 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SOLO, modeManager.isActiveMode(Modes.MODE_SOLO) ? LaunchpadColors.LAUNCHPAD_COLOR_BLUE : index == 3 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_VOLUME, viewManager.isActiveView(Views.VIEW_VOLUME) ? LaunchpadColors.LAUNCHPAD_COLOR_CYAN : index == 4 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_PAN, viewManager.isActiveView(Views.VIEW_PAN) ? LaunchpadColors.LAUNCHPAD_COLOR_SKY : index == 5 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_SENDS, viewManager.isActiveView(Views.VIEW_SENDS) ? LaunchpadColors.LAUNCHPAD_COLOR_ORCHID : index == 6 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    surface.setButton(LaunchpadControlSurface.LAUNCHPAD_BUTTON_STOP_CLIP, modeManager.isActiveMode(Modes.MODE_STOP_CLIP) ? LaunchpadColors.LAUNCHPAD_COLOR_ROSE : index == 7 ? LaunchpadColors.LAUNCHPAD_COLOR_WHITE : LaunchpadColors.LAUNCHPAD_COLOR_GREY_LO);
    // Update the front LED with the color of the current track
    final ITrack track = index == -1 ? null : this.model.getCurrentTrackBank().getTrack(index);
    final int color = track != null && track.doesExist() ? this.colorManager.getColor(BitwigColors.getColorIndex(track.getColor())) : 0;
    surface.sendLaunchpadSysEx("0A 63 " + StringUtils.toHexStr(color));
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITransport(de.mossgrabers.framework.daw.ITransport) SceneView(de.mossgrabers.framework.view.SceneView) ViewManager(de.mossgrabers.framework.view.ViewManager) VolumeView(de.mossgrabers.launchpad.view.VolumeView) SessionView(de.mossgrabers.launchpad.view.SessionView) SequencerView(de.mossgrabers.launchpad.view.SequencerView) SceneView(de.mossgrabers.framework.view.SceneView) DeviceView(de.mossgrabers.launchpad.view.DeviceView) View(de.mossgrabers.framework.view.View) PanView(de.mossgrabers.launchpad.view.PanView) RaindropsView(de.mossgrabers.launchpad.view.RaindropsView) BrowserView(de.mossgrabers.launchpad.view.BrowserView) DrumView(de.mossgrabers.launchpad.view.DrumView) SendsView(de.mossgrabers.launchpad.view.SendsView) ShiftView(de.mossgrabers.launchpad.view.ShiftView) PlayView(de.mossgrabers.launchpad.view.PlayView) LaunchpadControlSurface(de.mossgrabers.launchpad.controller.LaunchpadControlSurface) LaunchpadCursorCommand(de.mossgrabers.launchpad.command.trigger.LaunchpadCursorCommand) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 9 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class AbstractTrackCommand method onModeButton.

protected void onModeButton(final ButtonEvent event, final Integer controlMode, final String notification) {
    final ModeManager modeManager = this.surface.getModeManager();
    switch(event) {
        case DOWN:
            this.firstRowUsed = false;
            if (modeManager.isActiveMode(controlMode)) {
                modeManager.setActiveMode(null);
                return;
            }
            modeManager.setActiveMode(controlMode);
            this.surface.getViewManager().setActiveView(Views.VIEW_SESSION);
            this.surface.getDisplay().notify(notification);
            break;
        case LONG:
            this.firstRowUsed = true;
            break;
        case UP:
            if (this.firstRowUsed)
                modeManager.setActiveMode(null);
            break;
    }
}
Also used : ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 10 with ModeManager

use of de.mossgrabers.framework.mode.ModeManager in project DrivenByMoss by git-moss.

the class PitchbendVolumeCommand method onPitchbend.

/**
 * {@inheritDoc}
 */
@Override
public void onPitchbend(final int channel, final int data1, final int data2) {
    final double value = Math.min(data2 * 127 + (double) data1, this.model.getValueChanger().getUpperBound() - 1);
    if (channel == 8) {
        if (this.surface.isShiftPressed())
            this.model.getTransport().setMetronomeVolume(value);
        else
            this.model.getMasterTrack().setVolume(value);
        return;
    }
    final int extenderOffset = this.surface.getExtenderOffset();
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack track = tb.getTrack(extenderOffset + channel);
    if (this.surface.getConfiguration().useFadersAsKnobs()) {
        final ModeManager modeManager = this.surface.getModeManager();
        if (modeManager.isActiveMode(Modes.MODE_VOLUME))
            track.setVolume(value);
        else if (modeManager.isActiveMode(Modes.MODE_PAN))
            track.setPan(value);
        else if (modeManager.isActiveMode(Modes.MODE_TRACK))
            this.handleTrack(channel, value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND1))
            track.getSend(0).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND2))
            track.getSend(1).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND3))
            track.getSend(2).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND4))
            track.getSend(3).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND5))
            track.getSend(4).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND6))
            track.getSend(5).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND7))
            track.getSend(6).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_SEND8))
            track.getSend(7).setValue(value);
        else if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS))
            this.model.getCursorDevice().setParameter(extenderOffset + channel, (int) value);
        return;
    }
    track.setVolume(value);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Aggregations

ModeManager (de.mossgrabers.framework.mode.ModeManager)67 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)20 ITrack (de.mossgrabers.framework.daw.data.ITrack)18 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)9 ViewManager (de.mossgrabers.framework.view.ViewManager)7 PushConfiguration (de.mossgrabers.push.PushConfiguration)7 View (de.mossgrabers.framework.view.View)6 SceneView (de.mossgrabers.framework.view.SceneView)5 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)5 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)4 IChannel (de.mossgrabers.framework.daw.data.IChannel)4 ITransport (de.mossgrabers.framework.daw.ITransport)3 DeviceBrowserMode (de.mossgrabers.push.mode.device.DeviceBrowserMode)3 DeviceParamsMode (de.mossgrabers.push.mode.device.DeviceParamsMode)3 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)2 APCminiControlSurface (de.mossgrabers.apcmini.controller.APCminiControlSurface)2 ICursorClip (de.mossgrabers.framework.daw.ICursorClip)2 IMasterTrack (de.mossgrabers.framework.daw.data.IMasterTrack)2 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)2 LaunchpadControlSurface (de.mossgrabers.launchpad.controller.LaunchpadControlSurface)2