Search in sources :

Example 46 with ViewManager

use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.

the class APCControllerSetup 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 APCControlSurface surface = this.getSurface();
    // Recall last used view (if we are not in session mode)
    final ViewManager viewManager = surface.getViewManager();
    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 ? Views.VIEW_PLAY : preferredView);
        }
    }
    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 : APCControlSurface(de.mossgrabers.apc.controller.APCControlSurface) ITrack(de.mossgrabers.framework.daw.data.ITrack) ViewManager(de.mossgrabers.framework.view.ViewManager)

Example 47 with ViewManager

use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.

the class APCControllerSetup method updateButtons.

private void updateButtons() {
    final APCControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    final View activeView = viewManager.getActiveView();
    if (activeView != null) {
        ((APCCursorCommand) activeView.getTriggerCommand(Commands.COMMAND_ARROW_DOWN)).updateArrows();
        ((SceneView) activeView).updateSceneButtons();
    }
    final boolean isShift = surface.isShiftPressed();
    final boolean isSendA = surface.isPressed(APCControlSurface.APC_BUTTON_SEND_A);
    final ITransport t = this.model.getTransport();
    surface.updateButton(APCControlSurface.APC_BUTTON_PLAY, t.isPlaying() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    surface.updateButton(APCControlSurface.APC_BUTTON_RECORD, t.isRecording() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    // Activator, Solo, Record Arm
    final IChannelBank tb = this.model.getCurrentTrackBank();
    final ITrack selTrack = tb.getSelectedTrack();
    final int selIndex = selTrack == null ? -1 : selTrack.getIndex();
    final int clipLength = surface.getConfiguration().getNewClipLength();
    final ModeManager modeManager = surface.getModeManager();
    for (int i = 0; i < 8; i++) {
        final ITrack track = tb.getTrack(i);
        boolean isOn;
        if (isShift)
            isOn = i == clipLength;
        else
            isOn = isSendA ? modeManager.isActiveMode(Integer.valueOf(Modes.MODE_SEND1.intValue() + i)) : i == selIndex;
        surface.updateButtonEx(APCControlSurface.APC_BUTTON_TRACK_SELECTION, i, isOn ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButtonEx(APCControlSurface.APC_BUTTON_SOLO, i, track.doesExist() && (isShift ? track.isAutoMonitor() : track.isSolo()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButtonEx(APCControlSurface.APC_BUTTON_ACTIVATOR, i, track.doesExist() && (isShift ? track.isMonitor() : !track.isMute()) ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        if (this.isMkII) {
            surface.updateButtonEx(APCControlSurface.APC_BUTTON_A_B, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
            surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        } else {
            if (isShift)
                surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && !"AB".equals(track.getCrossfadeMode()) ? "A".equals(track.getCrossfadeMode()) ? ColorManager.BUTTON_STATE_ON : APCColors.BUTTON_STATE_BLINK : ColorManager.BUTTON_STATE_OFF);
            else
                surface.updateButtonEx(APCControlSurface.APC_BUTTON_RECORD_ARM, i, track.doesExist() && track.isRecArm() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        }
    }
    surface.updateButton(APCControlSurface.APC_BUTTON_MASTER, this.model.getMasterTrack().isSelected() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    final ICursorDevice device = this.model.getCursorDevice();
    if (this.isMkII) {
        surface.updateButton(APCControlSurface.APC_BUTTON_SESSION, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_SEND_C, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_BANK, this.model.getBrowser().isActive() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
    } else {
        surface.updateButton(APCControlSurface.APC_BUTTON_DETAIL_VIEW, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_REC_QUANT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_MIDI_OVERDUB, t.isLauncherOverdub() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_METRONOME, t.isMetronomeOn() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_CLIP_TRACK, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_ON_OFF, device.isEnabled() ? ColorManager.BUTTON_STATE_ON : ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_LEFT, ColorManager.BUTTON_STATE_OFF);
        surface.updateButton(APCControlSurface.APC_BUTTON_DEVICE_RIGHT, ColorManager.BUTTON_STATE_OFF);
    }
    this.updateDeviceKnobs();
}
Also used : APCControlSurface(de.mossgrabers.apc.controller.APCControlSurface) ITrack(de.mossgrabers.framework.daw.data.ITrack) APCCursorCommand(de.mossgrabers.apc.command.trigger.APCCursorCommand) ITransport(de.mossgrabers.framework.daw.ITransport) IChannelBank(de.mossgrabers.framework.daw.IChannelBank) SceneView(de.mossgrabers.framework.view.SceneView) ViewManager(de.mossgrabers.framework.view.ViewManager) SessionView(de.mossgrabers.apc.view.SessionView) ShiftView(de.mossgrabers.apc.view.ShiftView) SceneView(de.mossgrabers.framework.view.SceneView) View(de.mossgrabers.framework.view.View) DrumView(de.mossgrabers.apc.view.DrumView) SequencerView(de.mossgrabers.apc.view.SequencerView) PlayView(de.mossgrabers.apc.view.PlayView) RaindropsView(de.mossgrabers.apc.view.RaindropsView) ICursorDevice(de.mossgrabers.framework.daw.ICursorDevice) ModeManager(de.mossgrabers.framework.mode.ModeManager)

Example 48 with ViewManager

use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.

the class ShiftView method onScene.

/**
 * {@inheritDoc}
 */
@Override
public void onScene(final int scene, final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final Integer viewID = Integer.valueOf(Views.VIEW_SESSION.intValue() + scene);
    final ViewManager viewManager = this.surface.getViewManager();
    viewManager.setActiveView(viewID);
    this.surface.getDisplay().notify(viewManager.getView(viewID).getName());
    if (Views.VIEW_SESSION.equals(viewID))
        return;
    final ITrack selectedTrack = this.model.getCurrentTrackBank().getSelectedTrack();
    if (selectedTrack != null)
        viewManager.setPreferredView(selectedTrack.getPosition(), viewID);
}
Also used : ITrack(de.mossgrabers.framework.daw.data.ITrack) ViewManager(de.mossgrabers.framework.view.ViewManager)

Example 49 with ViewManager

use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.

the class APCminiControllerSetup method createViews.

/**
 * {@inheritDoc}
 */
@Override
protected void createViews() {
    final APCminiControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    viewManager.registerView(Views.VIEW_PLAY, new PlayView(surface, this.model));
    viewManager.registerView(Views.VIEW_SHIFT, new ShiftView(surface, this.model));
    viewManager.registerView(Views.VIEW_BROWSER, new BrowserView(surface, this.model));
    if (this.host.hasClips()) {
        viewManager.registerView(Views.VIEW_SESSION, new SessionView(surface, this.model));
        viewManager.registerView(Views.VIEW_SEQUENCER, new SequencerView(surface, this.model));
        viewManager.registerView(Views.VIEW_DRUM, new DrumView(surface, this.model));
        viewManager.registerView(Views.VIEW_RAINDROPS, new RaindropsView(surface, this.model));
    }
}
Also used : SequencerView(de.mossgrabers.apcmini.view.SequencerView) RaindropsView(de.mossgrabers.apcmini.view.RaindropsView) APCminiControlSurface(de.mossgrabers.apcmini.controller.APCminiControlSurface) ShiftView(de.mossgrabers.apcmini.view.ShiftView) ViewManager(de.mossgrabers.framework.view.ViewManager) SessionView(de.mossgrabers.apcmini.view.SessionView) BrowserView(de.mossgrabers.apcmini.view.BrowserView) DrumView(de.mossgrabers.apcmini.view.DrumView) PlayView(de.mossgrabers.apcmini.view.PlayView)

Example 50 with ViewManager

use of de.mossgrabers.framework.view.ViewManager in project DrivenByMoss by git-moss.

the class APCminiControllerSetup 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 APCminiControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    if (viewManager.isActiveView(Views.VIEW_PLAY))
        viewManager.getActiveView().updateNoteMapping();
    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 : APCminiControlSurface(de.mossgrabers.apcmini.controller.APCminiControlSurface) ViewManager(de.mossgrabers.framework.view.ViewManager)

Aggregations

ViewManager (de.mossgrabers.framework.view.ViewManager)64 ITrack (de.mossgrabers.framework.daw.data.ITrack)16 IChannelBank (de.mossgrabers.framework.daw.IChannelBank)10 View (de.mossgrabers.framework.view.View)9 ICursorDevice (de.mossgrabers.framework.daw.ICursorDevice)8 ModeManager (de.mossgrabers.framework.mode.ModeManager)7 DrumView (de.mossgrabers.launchpad.view.DrumView)7 PlayView (de.mossgrabers.launchpad.view.PlayView)7 RaindropsView (de.mossgrabers.launchpad.view.RaindropsView)7 SequencerView (de.mossgrabers.launchpad.view.SequencerView)7 AbstractSequencerView (de.mossgrabers.framework.view.AbstractSequencerView)6 ColorView (de.mossgrabers.push.view.ColorView)6 APCControlSurface (de.mossgrabers.apc.controller.APCControlSurface)5 PushControlSurface (de.mossgrabers.push.controller.PushControlSurface)5 IBrowser (de.mossgrabers.framework.daw.IBrowser)4 ITrackBank (de.mossgrabers.framework.daw.ITrackBank)4 MCUControlSurface (de.mossgrabers.mcu.controller.MCUControlSurface)4 ColorManager (de.mossgrabers.framework.controller.color.ColorManager)3 Scales (de.mossgrabers.framework.scale.Scales)3 SceneView (de.mossgrabers.framework.view.SceneView)3