Search in sources :

Example 46 with ViewManager

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

the class MaschineControllerSetup method createViews.

/**
 * {@inheritDoc}
 */
@Override
protected void createViews() {
    final MaschineControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    viewManager.register(Views.SCENE_PLAY, new SceneView(surface, this.model));
    viewManager.register(Views.CLIP, new ClipView(surface, this.model));
    final DrumView drumView = new DrumView(surface, this.model);
    viewManager.register(Views.DRUM, drumView);
    viewManager.register(Views.PLAY, new PlayView(surface, this.model, drumView));
    viewManager.register(Views.DEVICE, new ParameterView(surface, this.model));
    if (!this.maschine.hasGroupButtons()) {
        viewManager.register(Views.TRACK_SELECT, new SelectView(surface, this.model));
        viewManager.register(Views.TRACK_SOLO, new SoloView(surface, this.model));
        viewManager.register(Views.TRACK_MUTE, new MuteView(surface, this.model));
    }
    viewManager.register(Views.REPEAT_NOTE, new NoteRepeatView(surface, this.model));
    this.shiftView = new ShiftView(surface, this.model);
    viewManager.register(Views.SHIFT, this.shiftView);
}
Also used : SoloView(de.mossgrabers.controller.ni.maschine.mk3.view.SoloView) MuteView(de.mossgrabers.controller.ni.maschine.mk3.view.MuteView) ShiftView(de.mossgrabers.controller.ni.maschine.mk3.view.ShiftView) SceneView(de.mossgrabers.controller.ni.maschine.mk3.view.SceneView) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ClipView(de.mossgrabers.controller.ni.maschine.mk3.view.ClipView) MaschineControlSurface(de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface) ParameterView(de.mossgrabers.controller.ni.maschine.mk3.view.ParameterView) DrumView(de.mossgrabers.controller.ni.maschine.mk3.view.DrumView) PlayView(de.mossgrabers.controller.ni.maschine.mk3.view.PlayView) SelectView(de.mossgrabers.controller.ni.maschine.mk3.view.SelectView) NoteRepeatView(de.mossgrabers.controller.ni.maschine.mk3.view.NoteRepeatView)

Example 47 with ViewManager

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

the class LaunchkeyMk3ControllerSetup method registerTriggerCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerTriggerCommands() {
    final LaunchkeyMk3ControlSurface surface = this.getSurface();
    final ITransport t = this.model.getTransport();
    final ViewManager viewManager = surface.getViewManager();
    this.addButton(ButtonID.SHIFT, "Shift", NopCommand.INSTANCE, LaunchkeyMk3ControlSurface.LAUNCHKEY_SHIFT);
    this.addButton(ButtonID.PLAY, "Play", new LaunchkeyMk3PlayCommand(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_PLAY, t::isPlaying);
    this.addButton(ButtonID.STOP, "Stop", new StopCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_STOP, () -> !t.isPlaying());
    final ConfiguredRecordCommand<LaunchkeyMk3ControlSurface, LaunchkeyMk3Configuration> recordCommand = new ConfiguredRecordCommand<>(this.model, surface);
    this.addButton(ButtonID.RECORD, "Record", recordCommand, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_RECORD, recordCommand::isLit);
    this.addButton(ButtonID.REPEAT, "Repeat", new ToggleLoopCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_LOOP, t::isLoop);
    this.addButton(ButtonID.NEW, "Capture MIDI", new NewCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_CAPTURE_MIDI);
    this.addButton(ButtonID.QUANTIZE, "Quantize", new QuantizeCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_QUANTIZE);
    this.addButton(ButtonID.METRONOME, "Metronome", new MetronomeCommand<>(this.model, surface, true), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_CLICK, t::isMetronomeOn);
    this.addButton(ButtonID.UNDO, "Undo", new UndoCommand<>(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_UNDO);
    this.addDummyButton(ButtonID.F3, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DEVICE_SELECT);
    this.addButton(ButtonID.TOGGLE_DEVICE, "Device Lock", new DeviceLockCommand(this.model, surface), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DEVICE_LOCK, () -> this.model.getCursorDevice().isPinned() ? 127 : 40);
    this.addButton(ButtonID.MOVE_TRACK_LEFT, "Previous", new SelectPrevNextTrackCommand<>(this.model, surface, true), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_TRACK_LEFT);
    this.addButton(ButtonID.MOVE_TRACK_RIGHT, "Next", new SelectPrevNextTrackCommand<>(this.model, surface, false), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_TRACK_RIGHT);
    // Scene buttons
    this.addButton(ButtonID.SCENE1, "Scene 1", new ViewButtonCommand<>(ButtonID.SCENE1, surface), LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE1, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.SCENE1));
    this.addButton(ButtonID.SCENE2, "Scene 2", new ViewButtonCommand<>(ButtonID.SCENE2, surface), LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE2, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.SCENE2));
    this.addButton(surface, ButtonID.ARROW_UP, "Up", new ViewButtonCommand<>(ButtonID.ARROW_UP, surface), 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_ARROW_UP, -1, true, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.ARROW_UP));
    this.addButton(surface, ButtonID.ARROW_DOWN, "Down", new ViewButtonCommand<>(ButtonID.ARROW_DOWN, surface), 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_ARROW_DOWN, -1, true, new FeatureGroupButtonColorSupplier(viewManager, ButtonID.ARROW_DOWN));
    // Ignore redundant messages sent by arrow up/down buttons
    this.addDummyButton(ButtonID.F1, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE1);
    this.addDummyButton(ButtonID.F2, 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_SCENE2);
    // View selection with Pads in Shift mode
    this.createViewButton(ButtonID.ROW2_1, OutputID.LED_RING1, "Session", Views.SESSION, LaunchkeyMk3ControlSurface.PAD_MODE_SESSION);
    this.createViewButton(ButtonID.ROW2_2, OutputID.LED_RING2, "Drum", Views.DRUM, LaunchkeyMk3ControlSurface.PAD_MODE_DRUM);
    this.createViewButton(ButtonID.ROW2_3, OutputID.LED_RING3, "Scale Chords", Views.DUMMY1, LaunchkeyMk3ControlSurface.PAD_MODE_SCALE_CHORDS);
    this.createViewButton(ButtonID.ROW2_4, OutputID.LED_RING4, "User Chords", Views.DUMMY2, LaunchkeyMk3ControlSurface.PAD_MODE_USER_CHORDS);
    this.createViewButton(ButtonID.ROW2_5, OutputID.LED_RING5, NAME_CUSTOM_1, Views.DUMMY3, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE0);
    this.createViewButton(ButtonID.ROW2_6, OutputID.LED_RING6, NAME_CUSTOM_2, Views.DUMMY4, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE1);
    this.createViewButton(ButtonID.ROW2_7, OutputID.LED_RING7, NAME_CUSTOM_3, Views.DUMMY5, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE2);
    this.createViewButton(ButtonID.ROW2_8, OutputID.LED_RING8, NAME_CUSTOM_4, Views.DUMMY6, LaunchkeyMk3ControlSurface.PAD_MODE_CUSTOM_MODE3);
    this.createViewButton(ButtonID.DEVICE, OutputID.LED_RING9, "Device Select", Views.DEVICE, LaunchkeyMk3ControlSurface.PAD_MODE_DEVICE_SELECT);
    this.createViewButton(ButtonID.BROWSE, OutputID.LED_RING10, "Browser", Views.BROWSER, LaunchkeyMk3ControlSurface.PAD_MODE_NAVIGATION);
    // Knob mode selection with Pads in Shift mode
    this.createModeButton(ButtonID.ROW1_1, OutputID.LED1, "Device", Modes.DEVICE_PARAMS, LaunchkeyMk3ControlSurface.KNOB_MODE_PARAMS);
    this.createModeButton(ButtonID.ROW1_2, OutputID.LED2, "Volume", Modes.VOLUME, LaunchkeyMk3ControlSurface.KNOB_MODE_VOLUME);
    this.createModeButton(ButtonID.ROW1_3, OutputID.LED3, "Pan", Modes.PAN, LaunchkeyMk3ControlSurface.KNOB_MODE_PAN);
    this.createModeButton(ButtonID.ROW1_4, OutputID.LED4, "Send 1", Modes.SEND1, LaunchkeyMk3ControlSurface.KNOB_MODE_SEND1);
    this.createModeButton(ButtonID.ROW1_5, OutputID.LED5, "Send 2", Modes.SEND2, LaunchkeyMk3ControlSurface.KNOB_MODE_SEND2);
    this.createModeButton(ButtonID.ROW1_6, OutputID.LED6, NAME_CUSTOM_1, Modes.DEVICE_LAYER_SEND1, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM1);
    this.createModeButton(ButtonID.ROW1_7, OutputID.LED7, NAME_CUSTOM_2, Modes.DEVICE_LAYER_SEND2, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM2);
    this.createModeButton(ButtonID.ROW1_8, OutputID.LED8, NAME_CUSTOM_3, Modes.DEVICE_LAYER_SEND3, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM3);
    this.createModeButton(ButtonID.USER, OutputID.LED9, NAME_CUSTOM_4, Modes.DEVICE_LAYER_SEND4, LaunchkeyMk3ControlSurface.KNOB_MODE_CUSTOM4);
    // Fader mode selection with fader buttons in Shift mode
    this.createFaderModeButton(ButtonID.ROW3_1, OutputID.LIGHT_GUIDE1, "Device", Modes.DEVICE_PARAMS, LaunchkeyMk3ControlSurface.FADER_MODE_PARAMS);
    this.createFaderModeButton(ButtonID.ROW3_2, OutputID.LIGHT_GUIDE2, "Volume", Modes.VOLUME, LaunchkeyMk3ControlSurface.FADER_MODE_VOLUME);
    this.createFaderModeButton(ButtonID.ROW3_3, OutputID.LIGHT_GUIDE3, "Send 1", Modes.SEND1, LaunchkeyMk3ControlSurface.FADER_MODE_SEND1);
    this.createFaderModeButton(ButtonID.ROW3_4, OutputID.LIGHT_GUIDE4, "Send 2", Modes.SEND2, LaunchkeyMk3ControlSurface.FADER_MODE_SEND2);
    this.createFaderModeButton(ButtonID.ROW3_5, OutputID.LIGHT_GUIDE5, NAME_CUSTOM_1, Modes.DEVICE_LAYER_SEND1, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM1);
    this.createFaderModeButton(ButtonID.ROW3_6, OutputID.LIGHT_GUIDE6, NAME_CUSTOM_2, Modes.DEVICE_LAYER_SEND2, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM2);
    this.createFaderModeButton(ButtonID.ROW3_7, OutputID.LIGHT_GUIDE7, NAME_CUSTOM_3, Modes.DEVICE_LAYER_SEND3, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM3);
    this.createFaderModeButton(ButtonID.ROW3_8, OutputID.LIGHT_GUIDE8, NAME_CUSTOM_4, Modes.DEVICE_LAYER_SEND4, LaunchkeyMk3ControlSurface.FADER_MODE_CUSTOM4);
    // Fader mode buttons
    for (int i = 0; i < 8; i++) {
        final ButtonID row1ButtonID = ButtonID.get(ButtonID.ROW_SELECT_1, i);
        final IHwButton button = surface.createButton(row1ButtonID, "Select " + (i + 1));
        final ButtonAreaCommand command = new ButtonAreaCommand(i, this.model, surface);
        button.bind(command);
        final IMidiInput midiInput = surface.getMidiInput();
        final BindType triggerBindType = this.getTriggerBindType(row1ButtonID);
        final int midiControl = LaunchkeyMk3ControlSurface.LAUNCHKEY_SELECT1 + i;
        button.bind(midiInput, triggerBindType, 15, midiControl);
        final IntSupplier supplier = command::getButtonColor;
        surface.createLight(null, supplier::getAsInt, color -> surface.setTrigger(color >= 0x1000 ? 2 : 0, midiControl, color >= 0x1000 ? color - 0x1000 : color), state -> this.colorManager.getColor(state >= 0x1000 ? state - 0x1000 : state, row1ButtonID), button);
    }
    this.addButton(surface, ButtonID.MASTERTRACK, "Toggle Select/RecArm", (event, velocity) -> {
        if (event == ButtonEvent.DOWN)
            ButtonAreaCommand.toggleSelect();
    }, 15, 0, LaunchkeyMk3ControlSurface.LAUNCHKEY_TOGGLE_SELECT, -1, true, () -> ButtonAreaCommand.isSelect() ? 40 : 127);
    // Online state
    this.addButton(ButtonID.CONTROL, "DAW Online", (event, velocity) -> surface.setDAWConnected(velocity > 0), 15, LaunchkeyMk3ControlSurface.LAUNCHKEY_DAW_ONLINE, surface::isDAWConnected);
}
Also used : LaunchkeyMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface) IntSupplier(java.util.function.IntSupplier) ITransport(de.mossgrabers.framework.daw.ITransport) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ConfiguredRecordCommand(de.mossgrabers.framework.command.trigger.transport.ConfiguredRecordCommand) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) LaunchkeyMk3PlayCommand(de.mossgrabers.controller.novation.launchkey.maxi.command.trigger.LaunchkeyMk3PlayCommand) ButtonID(de.mossgrabers.framework.controller.ButtonID) BindType(de.mossgrabers.framework.controller.hardware.BindType) IHwButton(de.mossgrabers.framework.controller.hardware.IHwButton) ButtonAreaCommand(de.mossgrabers.controller.novation.launchkey.maxi.command.trigger.ButtonAreaCommand) DeviceLockCommand(de.mossgrabers.controller.novation.launchkey.maxi.command.trigger.DeviceLockCommand) ButtonEvent(de.mossgrabers.framework.utils.ButtonEvent) List(java.util.List) IMidiInput(de.mossgrabers.framework.daw.midi.IMidiInput) ArrayList(java.util.ArrayList) ITransport(de.mossgrabers.framework.daw.ITransport) IHost(de.mossgrabers.framework.daw.IHost) IHwLight(de.mossgrabers.framework.controller.hardware.IHwLight) IMidiOutput(de.mossgrabers.framework.daw.midi.IMidiOutput) FeatureGroupButtonColorSupplier(de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier)

Example 48 with ViewManager

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

the class LaunchkeyMk3ControllerSetup method createViews.

/**
 * {@inheritDoc}
 */
@Override
protected void createViews() {
    final LaunchkeyMk3ControlSurface surface = this.getSurface();
    final ViewManager viewManager = surface.getViewManager();
    viewManager.register(Views.SESSION, new SessionView(surface, this.model));
    viewManager.register(Views.CONTROL, new PadModeSelectView(surface, this.model));
    viewManager.register(Views.DRUM, new DrumView(surface, this.model));
    viewManager.register(Views.PLAY, new UserPadView(surface, this.model));
    viewManager.register(Views.SHIFT, new DrumConfigView(surface, this.model));
    viewManager.register(Views.DEVICE, new DeviceConfigView(surface, this.model));
    viewManager.register(Views.BROWSER, new BrowserView(surface, this.model));
    viewManager.register(Views.DUMMY1, new DummyView<>("Scale Chords", surface, this.model));
    viewManager.register(Views.DUMMY2, new DummyView<>("User Chords", surface, this.model));
    viewManager.register(Views.DUMMY3, new DummyView<>(NAME_CUSTOM_1, surface, this.model));
    viewManager.register(Views.DUMMY4, new DummyView<>(NAME_CUSTOM_2, surface, this.model));
    viewManager.register(Views.DUMMY5, new DummyView<>(NAME_CUSTOM_3, surface, this.model));
    viewManager.register(Views.DUMMY6, new DummyView<>(NAME_CUSTOM_4, surface, this.model));
}
Also used : LaunchkeyMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface) PadModeSelectView(de.mossgrabers.controller.novation.launchkey.maxi.view.PadModeSelectView) DeviceConfigView(de.mossgrabers.controller.novation.launchkey.maxi.view.DeviceConfigView) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) SessionView(de.mossgrabers.controller.novation.launchkey.maxi.view.SessionView) UserPadView(de.mossgrabers.controller.novation.launchkey.maxi.view.UserPadView) DrumConfigView(de.mossgrabers.controller.novation.launchkey.maxi.view.DrumConfigView) BrowserView(de.mossgrabers.controller.novation.launchkey.maxi.view.BrowserView) DrumView(de.mossgrabers.controller.novation.launchkey.maxi.view.DrumView)

Example 49 with ViewManager

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

the class BrowserView method onDeactivate.

/**
 * {@inheritDoc}
 */
@Override
public void onDeactivate() {
    // Close the browser if still open
    final IBrowser browser = this.model.getBrowser();
    if (browser.isActive())
        browser.stopBrowsing(false);
    final ViewManager viewManager = this.surface.getViewManager();
    final Views activeID = viewManager.getActiveID();
    if (activeID == Views.BROWSER) {
        // Browse (...) button does not send an 'up' event
        this.surface.getButton(ButtonID.BROWSE).clearState();
        final Views previousID = viewManager.getPreviousID();
        final Integer id = VIEW_COMMANDS.get(previousID);
        final int viewCommand = id == null || previousID == Views.BROWSER ? LaunchkeyMk3ControlSurface.PAD_MODE_SESSION : id.intValue();
        this.surface.getMidiOutput().sendCCEx(15, LaunchkeyMk3ControlSurface.LAUNCHKEY_VIEW_SELECT, viewCommand);
    }
}
Also used : IBrowser(de.mossgrabers.framework.daw.IBrowser) Views(de.mossgrabers.framework.view.Views) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager)

Example 50 with ViewManager

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

the class PadModeCommand method executeNormal.

/**
 * {@inheritDoc}
 */
@Override
public void executeNormal(final ButtonEvent event) {
    if (event != ButtonEvent.DOWN)
        return;
    final ViewManager viewManager = this.surface.getViewManager();
    if (viewManager.isActive(Views.DRUM)) {
        if (!this.surface.getMaschine().hasMCUDisplay())
            ((DrumView) viewManager.get(Views.DRUM)).toggleShifted();
        final ModeManager modeManager = this.surface.getModeManager();
        if (modeManager.isActive(Modes.PLAY_OPTIONS))
            modeManager.restore();
        else
            modeManager.setActive(Modes.PLAY_OPTIONS);
    } else {
        viewManager.setActive(Views.DRUM);
        ((INoteMode) this.surface.getModeManager().get(Modes.NOTE)).clearNotes();
    }
}
Also used : INoteMode(de.mossgrabers.framework.mode.INoteMode) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Aggregations

ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)58 ITrack (de.mossgrabers.framework.daw.data.ITrack)12 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)11 Views (de.mossgrabers.framework.view.Views)11 INoteMode (de.mossgrabers.framework.mode.INoteMode)5 BeatstepControlSurface (de.mossgrabers.controller.arturia.beatstep.controller.BeatstepControlSurface)4 MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)4 IView (de.mossgrabers.framework.featuregroup.IView)4 DrumView (de.mossgrabers.controller.ni.maschine.mk3.view.DrumView)3 ConfiguredRecordCommand (de.mossgrabers.framework.command.trigger.transport.ConfiguredRecordCommand)3 FeatureGroupButtonColorSupplier (de.mossgrabers.framework.command.trigger.view.FeatureGroupButtonColorSupplier)3 IHost (de.mossgrabers.framework.daw.IHost)3 ITransport (de.mossgrabers.framework.daw.ITransport)3 ITrackBank (de.mossgrabers.framework.daw.data.bank.ITrackBank)3 PlayView (de.mossgrabers.controller.arturia.beatstep.view.PlayView)2 LaunchkeyMk3ControlSurface (de.mossgrabers.controller.novation.launchkey.maxi.controller.LaunchkeyMk3ControlSurface)2 LaunchkeyMiniMk3ControlSurface (de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ControlSurface)2 SLMkIIIControlSurface (de.mossgrabers.controller.novation.slmkiii.controller.SLMkIIIControlSurface)2 DrumView (de.mossgrabers.controller.novation.slmkiii.view.DrumView)2 Configuration (de.mossgrabers.framework.configuration.Configuration)2