Search in sources :

Example 1 with IHwAbsoluteKnob

use of de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob in project DrivenByMoss by git-moss.

the class MaschineControllerSetup method registerContinuousCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerContinuousCommands() {
    final MaschineControlSurface surface = this.getSurface();
    final ModeManager modeManager = surface.getModeManager();
    final ViewManager viewManager = surface.getViewManager();
    final IHwRelativeKnob knob = this.addRelativeKnob(ContinuousID.MASTER_KNOB, "Encoder", new MainKnobRowModeCommand(this.model, surface), MaschineControlSurface.ENCODER);
    knob.bindTouch((event, velocity) -> {
        final IMode mode = modeManager.getActive();
        if (mode != null && event != ButtonEvent.LONG)
            mode.onKnobTouch(8, event == ButtonEvent.DOWN);
    }, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.ENCODER_TOUCH);
    if (this.maschine.hasMCUDisplay()) {
        for (int i = 0; i < 8; i++) {
            final int index = i;
            final IHwRelativeKnob modeKnob = this.addRelativeKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), new KnobRowModeCommand<>(i, this.model, surface), MaschineControlSurface.MODE_KNOB_1 + i);
            modeKnob.bindTouch((event, velocity) -> {
                final IMode mode = modeManager.getActive();
                if (mode != null && event != ButtonEvent.LONG)
                    mode.onKnobTouch(index, event == ButtonEvent.DOWN);
            }, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.MODE_KNOB_TOUCH_1 + i);
            modeKnob.setIndexInGroup(i);
        }
    }
    final TouchstripCommand touchstripCommand = new TouchstripCommand(this.model, surface);
    this.addFader(ContinuousID.CROSSFADER, "Touchstrip", touchstripCommand, BindType.CC, MaschineControlSurface.TOUCHSTRIP, false);
    surface.getContinuous(ContinuousID.CROSSFADER).bindTouch(touchstripCommand, surface.getMidiInput(), BindType.CC, 0, MaschineControlSurface.TOUCHSTRIP_TOUCH);
    // Enable aftertouch
    final Views[] views = { Views.PLAY, Views.DRUM };
    for (final Views viewID : views) {
        final IView view = viewManager.get(viewID);
        view.registerAftertouchCommand(new AftertouchViewCommand<>(view, this.model, surface));
    }
    if (this.maschine == Maschine.STUDIO) {
        final IHwAbsoluteKnob masterKnob = this.addAbsoluteKnob(ContinuousID.MONITOR_KNOB, "Encoder", null, MaschineControlSurface.MONITOR_ENCODER);
        this.encoderManager = new StudioEncoderModeManager(masterKnob, this.model, surface);
        masterKnob.bind(this.encoderManager);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMaster = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.MASTER_VOLUME, this.model, surface);
        this.addButton(ButtonID.ROW4_1, "MST", encoderCommandMaster, MaschineControlSurface.MONITOR_MST, encoderCommandMaster::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandSelectedTrack = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.SELECTED_TRACK_VOLUME, this.model, surface);
        this.addButton(ButtonID.ROW4_2, "GRP", encoderCommandSelectedTrack, MaschineControlSurface.MONITOR_GRP, encoderCommandSelectedTrack::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMetronome = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.METRONOME_VOLUME, this.model, surface);
        this.addButton(ButtonID.ROW4_3, "SND", encoderCommandMetronome, MaschineControlSurface.MONITOR_SND, encoderCommandMetronome::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandCue = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.CUE_VOLUME, this.model, surface);
        this.addButton(ButtonID.ROW4_4, "CUE", encoderCommandCue, MaschineControlSurface.MONITOR_CUE, encoderCommandCue::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandMasterPan = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.MASTER_PANORAMA, this.model, surface);
        this.addButton(ButtonID.ROW4_5, "IN1", encoderCommandMasterPan, MaschineControlSurface.MONITOR_IN1, encoderCommandMasterPan::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandSelectedTrackPan = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.SELECTED_TRACK_PANORAMA, this.model, surface);
        this.addButton(ButtonID.ROW4_6, "IN2", encoderCommandSelectedTrackPan, MaschineControlSurface.MONITOR_IN2, encoderCommandSelectedTrackPan::isLit);
        final MaschineMonitorEncoderCommand<MaschineControlSurface, MaschineConfiguration> encoderCommandCueMix = new MaschineMonitorEncoderCommand<>(this.encoderManager, EncoderMode.CUE_MIX, this.model, surface);
        this.addButton(ButtonID.ROW4_8, "IN4", encoderCommandCueMix, MaschineControlSurface.MONITOR_IN4, encoderCommandCueMix::isLit);
        this.addButton(ButtonID.TOGGLE_VU, "IN3", (event, value) -> {
            if (event == ButtonEvent.UP)
                this.encoderManager.toggleMode();
        }, MaschineControlSurface.MONITOR_IN3, this.encoderManager::isParameterMode);
        // Activate the default mode
        this.encoderManager.setActiveEncoderMode(EncoderMode.MASTER_VOLUME);
    }
}
Also used : MainKnobRowModeCommand(de.mossgrabers.controller.ni.maschine.mk3.command.continuous.MainKnobRowModeCommand) ViewManager(de.mossgrabers.framework.featuregroup.ViewManager) MaschineControlSurface(de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface) IHwRelativeKnob(de.mossgrabers.framework.controller.hardware.IHwRelativeKnob) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager) StudioEncoderModeManager(de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager) MaschineMonitorEncoderCommand(de.mossgrabers.controller.ni.maschine.core.command.trigger.MaschineMonitorEncoderCommand) Views(de.mossgrabers.framework.view.Views) IView(de.mossgrabers.framework.featuregroup.IView) IMode(de.mossgrabers.framework.featuregroup.IMode) TouchstripCommand(de.mossgrabers.controller.ni.maschine.mk3.command.continuous.TouchstripCommand) IHwAbsoluteKnob(de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob) StudioEncoderModeManager(de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)

Example 2 with IHwAbsoluteKnob

use of de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob in project DrivenByMoss by git-moss.

the class LaunchkeyMiniMk3ControllerSetup method registerContinuousCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerContinuousCommands() {
    final LaunchkeyMiniMk3ControlSurface surface = this.getSurface();
    for (int i = 0; i < 8; i++) {
        this.addAbsoluteKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), null, BindType.CC, 15, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_KNOB_1 + i).setIndexInGroup(i);
        // Knobs in user mode send on the keys input on MIDI channel 1 (instead of 16), command
        // is not needed since it is mapped to IParameter when user mode is activated
        final IHwAbsoluteKnob userKnob = surface.createAbsoluteKnob(ContinuousID.get(ContinuousID.DEVICE_KNOB1, i), "User Knob " + (i + 1));
        userKnob.bind(this.inputKeys, BindType.CC, 0, LaunchkeyMiniMk3ControlSurface.LAUNCHKEY_KNOB_1 + i);
        userKnob.setIndexInGroup(i);
    }
}
Also used : LaunchkeyMiniMk3ControlSurface(de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ControlSurface) IHwAbsoluteKnob(de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob)

Example 3 with IHwAbsoluteKnob

use of de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob in project DrivenByMoss by git-moss.

the class AbstractControllerSetup method addAbsoluteKnob.

/**
 * Create a hardware knob proxy on a controller, which sends absolute values, bind a continuous
 * command to it and bind it to a MIDI CC.
 *
 * @param surface The control surface
 * @param continuousID The ID of the control (for later access)
 * @param label The label of the fader
 * @param command The command to bind
 * @param bindType The MIDI bind type
 * @param midiChannel The MIDI channel
 * @param midiControl The MIDI CC or note
 * @return The created knob
 */
protected IHwAbsoluteKnob addAbsoluteKnob(final S surface, final ContinuousID continuousID, final String label, final ContinuousCommand command, final BindType bindType, final int midiChannel, final int midiControl) {
    final IHwAbsoluteKnob knob = surface.createAbsoluteKnob(continuousID, label);
    if (command != null)
        knob.bind(command);
    knob.bind(surface.getMidiInput(), bindType, midiChannel, midiControl);
    return knob;
}
Also used : IHwAbsoluteKnob(de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob)

Aggregations

IHwAbsoluteKnob (de.mossgrabers.framework.controller.hardware.IHwAbsoluteKnob)3 MaschineMonitorEncoderCommand (de.mossgrabers.controller.ni.maschine.core.command.trigger.MaschineMonitorEncoderCommand)1 MainKnobRowModeCommand (de.mossgrabers.controller.ni.maschine.mk3.command.continuous.MainKnobRowModeCommand)1 TouchstripCommand (de.mossgrabers.controller.ni.maschine.mk3.command.continuous.TouchstripCommand)1 MaschineControlSurface (de.mossgrabers.controller.ni.maschine.mk3.controller.MaschineControlSurface)1 StudioEncoderModeManager (de.mossgrabers.controller.ni.maschine.mk3.controller.StudioEncoderModeManager)1 LaunchkeyMiniMk3ControlSurface (de.mossgrabers.controller.novation.launchkey.mini.controller.LaunchkeyMiniMk3ControlSurface)1 IHwRelativeKnob (de.mossgrabers.framework.controller.hardware.IHwRelativeKnob)1 IMode (de.mossgrabers.framework.featuregroup.IMode)1 IView (de.mossgrabers.framework.featuregroup.IView)1 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)1 ViewManager (de.mossgrabers.framework.featuregroup.ViewManager)1 Views (de.mossgrabers.framework.view.Views)1