Search in sources :

Example 1 with PushControlSurface

use of de.mossgrabers.push.controller.PushControlSurface in project DrivenByMoss by git-moss.

the class PushControllerSetup method handleTrackChange.

/**
 * Handle a track selection change.
 *
 * @param index The index of the track
 * @param isSelected Has the track been selected?
 */
private void handleTrackChange(final int index, final boolean isSelected) {
    if (!isSelected)
        return;
    final PushControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final ModeManager modeManager = surface.getModeManager();
    // Recall last used view (if we are not in session mode)
    if (!viewManager.isActiveView(Views.VIEW_SESSION)) {
        final ITrack selectedTrack = this.model.getCurrentTrackBank().getSelectedTrack();
        if (selectedTrack != null) {
            final Integer preferredView = viewManager.getPreferredView(selectedTrack.getPosition());
            viewManager.setActiveView(preferredView == null ? this.configuration.getDefaultNoteView() : preferredView);
        }
    }
    if (modeManager.isActiveMode(Modes.MODE_MASTER))
        modeManager.setActiveMode(Modes.MODE_TRACK);
    if (viewManager.isActiveView(Views.VIEW_PLAY))
        viewManager.getActiveView().updateNoteMapping();
    // Reset drum octave because the drum pad bank is also reset
    this.scales.setDrumOctave(0);
    if (viewManager.isActiveView(Views.VIEW_DRUM))
        viewManager.getView(Views.VIEW_DRUM).updateNoteMapping();
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ViewManager(de.mossgrabers.framework.view.ViewManager) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 2 with PushControlSurface

use of de.mossgrabers.push.controller.PushControlSurface in project DrivenByMoss by git-moss.

the class PushControllerSetup method updateRibbonMode.

private void updateRibbonMode() {
    final PushControlSurface surface = this.getSurface();
    surface.setRibbonValue(0);
    switch(this.configuration.getRibbonMode()) {
        case PushConfiguration.RIBBON_MODE_CC:
        case PushConfiguration.RIBBON_MODE_FADER:
            surface.setRibbonMode(PushControlSurface.PUSH_RIBBON_VOLUME);
            break;
        default:
            surface.setRibbonMode(PushControlSurface.PUSH_RIBBON_PITCHBEND);
            break;
    }
}
Also used : PushControlSurface(de.mossgrabers.push.controller.PushControlSurface)

Example 3 with PushControlSurface

use of de.mossgrabers.push.controller.PushControlSurface in project DrivenByMoss by git-moss.

the class PushControllerSetup method startup.

/**
 * {@inheritDoc}
 */
@Override
public void startup() {
    final PushControlSurface surface = this.getSurface();
    surface.getViewManager().setActiveView(this.configuration.getDefaultNoteView());
    surface.sendPressureMode(true);
    surface.getOutput().sendIdentityRequest();
}
Also used : PushControlSurface(de.mossgrabers.push.controller.PushControlSurface)

Example 4 with PushControlSurface

use of de.mossgrabers.push.controller.PushControlSurface in project DrivenByMoss by git-moss.

the class PushControllerSetup method createObservers.

/**
 * {@inheritDoc}
 */
@Override
protected void createObservers() {
    final PushControlSurface surface = this.getSurface();
    if (this.configuration.isPush2()) {
        this.configuration.addSettingObserver(PushConfiguration.DISPLAY_BRIGHTNESS, surface::sendDisplayBrightness);
        this.configuration.addSettingObserver(PushConfiguration.LED_BRIGHTNESS, surface::sendLEDBrightness);
        this.configuration.addSettingObserver(PushConfiguration.PAD_SENSITIVITY, () -> {
            surface.sendPadVelocityCurve();
            surface.sendPadThreshold();
        });
        this.configuration.addSettingObserver(PushConfiguration.PAD_GAIN, () -> {
            surface.sendPadVelocityCurve();
            surface.sendPadThreshold();
        });
        this.configuration.addSettingObserver(PushConfiguration.PAD_DYNAMICS, () -> {
            surface.sendPadVelocityCurve();
            surface.sendPadThreshold();
        });
    } else {
        this.configuration.addSettingObserver(PushConfiguration.VELOCITY_CURVE, surface::sendPadSensitivity);
        this.configuration.addSettingObserver(PushConfiguration.PAD_THRESHOLD, surface::sendPadSensitivity);
    }
    surface.getModeManager().addModeListener((oldMode, newMode) -> {
        this.updateMode(null);
        this.updateMode(newMode);
    });
    surface.getViewManager().addViewChangeListener((previousViewId, activeViewId) -> {
        // Update button states
        final View view = surface.getViewManager().getActiveView();
        for (final int button : surface.getButtons()) {
            if (surface.shouldUpdateButton(button))
                surface.setButton(button, view.usesButton(button) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        }
        // Update ribbon mode
        if (Views.VIEW_SESSION.equals(activeViewId))
            surface.setRibbonMode(PushControlSurface.PUSH_RIBBON_PAN);
        else
            this.updateRibbonMode();
    });
    this.configuration.addSettingObserver(PushConfiguration.RIBBON_MODE, this::updateRibbonMode);
    this.configuration.addSettingObserver(PushConfiguration.SEND_PORT, () -> ((PushDisplay) surface.getDisplay()).setCommunicationPort(this.configuration.getSendPort()));
    this.configuration.addSettingObserver(PushConfiguration.DEBUG_MODE, () -> {
        final ModeManager modeManager = surface.getModeManager();
        final Integer debugMode = this.configuration.getDebugMode();
        if (modeManager.getMode(debugMode) != null)
            modeManager.setActiveMode(debugMode);
        else
            this.host.error("Mode " + debugMode + " not registered.");
    });
    this.createScaleObservers(this.configuration);
}
Also used : PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ColorView(de.mossgrabers.push.view.ColorView) PlayView(de.mossgrabers.push.view.PlayView) SequencerView(de.mossgrabers.push.view.SequencerView) ScenePlayView(de.mossgrabers.push.view.ScenePlayView) DrumView(de.mossgrabers.push.view.DrumView) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) ClipView(de.mossgrabers.push.view.ClipView) AbstractSequencerView(de.mossgrabers.framework.view.AbstractSequencerView) PrgChangeView(de.mossgrabers.push.view.PrgChangeView) PianoView(de.mossgrabers.push.view.PianoView) SessionView(de.mossgrabers.push.view.SessionView) RaindropsView(de.mossgrabers.push.view.RaindropsView) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 5 with PushControlSurface

use of de.mossgrabers.push.controller.PushControlSurface in project DrivenByMoss by git-moss.

the class PushControllerSetup method updateIndication.

private void updateIndication(final Integer mode) {
    final ITrackBank tb = this.model.getTrackBank();
    final IChannelBank tbe = this.model.getEffectTrackBank();
    final PushControlSurface surface = this.getSurface();
    final boolean isSession = surface.getViewManager().isActiveView(Views.VIEW_SESSION);
    final boolean isEffect = this.model.isEffectTrackBankActive();
    final boolean isPan = Modes.MODE_PAN.equals(mode);
    final boolean isVolume = Modes.MODE_VOLUME.equals(mode);
    tb.setIndication(!isEffect && isSession);
    if (tbe != null)
        tbe.setIndication(isEffect && isSession);
    final ICursorDevice cursorDevice = this.model.getCursorDevice();
    final ITrack selectedTrack = tb.getSelectedTrack();
    for (int i = 0; i < tb.getNumTracks(); i++) {
        final boolean hasTrackSel = selectedTrack != null && selectedTrack.getIndex() == i && Modes.MODE_TRACK.equals(mode);
        final ITrack track = tb.getTrack(i);
        track.setVolumeIndication(!isEffect && (isVolume || hasTrackSel));
        track.setPanIndication(!isEffect && (isPan || hasTrackSel));
        for (int j = 0; j < tb.getNumSends(); j++) track.getSend(j).setIndication(!isEffect && (mode.intValue() - Modes.MODE_SEND1.intValue() == j || hasTrackSel));
        if (tbe != null) {
            final ITrack fxTrack = tbe.getTrack(i);
            fxTrack.setVolumeIndication(isEffect);
            fxTrack.setPanIndication(isEffect && isPan);
        }
        cursorDevice.indicateParameter(i, true);
    }
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ITrackBank(de.mossgrabers.framework.daw.ITrackBank) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) PushControlSurface(de.mossgrabers.push.controller.PushControlSurface) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice)

Aggregations

PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)14 ModeManager (de.mossgrabers.framework.mode.ModeManager)5 ViewManager (de.mossgrabers.framework.view.ViewManager)5 PlayView (de.mossgrabers.push.view.PlayView)5 ScenePlayView (de.mossgrabers.push.view.ScenePlayView)5 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)4 ClipView (de.mossgrabers.push.view.ClipView)4 ColorView (de.mossgrabers.push.view.ColorView)4 DrumView (de.mossgrabers.push.view.DrumView)4 PianoView (de.mossgrabers.push.view.PianoView)4 PrgChangeView (de.mossgrabers.push.view.PrgChangeView)4 SceneView (de.mossgrabers.framework.view.SceneView)3 View (de.mossgrabers.framework.view.View)3 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)2 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)2 ITrack (de.mossgrabers.framework.daw.data.ITrack)2 AccentMode (de.mossgrabers.push.mode.AccentMode)2 AutomationMode (de.mossgrabers.push.mode.AutomationMode)2 ConfigurationMode (de.mossgrabers.push.mode.ConfigurationMode)2 FixedMode (de.mossgrabers.push.mode.FixedMode)2