Search in sources :

Example 1 with TapTempoMkICommand

use of de.mossgrabers.controller.novation.sl.command.continuous.TapTempoMkICommand in project DrivenByMoss by git-moss.

the class SLControllerSetup method registerContinuousCommands.

/**
 * {@inheritDoc}
 */
@Override
protected void registerContinuousCommands() {
    final SLControlSurface surface = this.getSurface();
    for (int i = 0; i < 8; i++) {
        final int index = i;
        this.addFader(ContinuousID.get(ContinuousID.FADER1, i), "Fader " + (i + 1), null, BindType.CC, SLControlSurface.MKII_SLIDER1 + i);
        final IHwRelativeKnob relativeKnob = this.addRelativeKnob(ContinuousID.get(ContinuousID.DEVICE_KNOB1, i), "Device Knob " + (i + 1), null, SLControlSurface.MKII_KNOB_ROW1_1 + i, RelativeEncoding.SIGNED_BIT);
        relativeKnob.addOutput(() -> {
            final boolean hasDevice = this.model.hasSelectedDevice();
            final IParameterBank parameterBank = this.model.getCursorDevice().getParameterBank();
            return hasDevice ? parameterBank.getItem(index).getValue() : 0;
        }, value -> surface.getMidiOutput().sendCC(0x70 + index, Math.min(value * 11 / 127, 11)));
        this.addAbsoluteKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), null, SLControlSurface.MKII_KNOB_ROW2_1 + i);
    }
    this.addFader(ContinuousID.TOUCHPAD_X, "Touchpad X", new TouchpadCommand(true, this.model, surface), BindType.CC, SLControlSurface.MKII_TOUCHPAD_X);
    this.addFader(ContinuousID.TOUCHPAD_Y, "Touchpad Y", new TouchpadCommand(false, this.model, surface), BindType.CC, SLControlSurface.MKII_TOUCHPAD_Y);
    // These are no faders but cannot be mapped to any meaningful control anyway
    this.addFader(ContinuousID.HELLO, "Tap Init", new TapTempoInitMkICommand(this.model, surface), BindType.CC, SLControlSurface.MKI_BUTTON_TAP_TEMPO);
    this.addFader(ContinuousID.TEMPO, "Tap Tempo", new TapTempoMkICommand(this.model, surface), BindType.CC, SLControlSurface.MKI_BUTTON_TAP_TEMPO_VALUE);
    // Volume, Track and Parameter modes are always bound since they have dedicated controls
    final ModeManager modeManager = surface.getModeManager();
    modeManager.get(Modes.VOLUME).onActivate();
    modeManager.get(Modes.TRACK).onActivate();
    modeManager.get(Modes.DEVICE_PARAMS).onActivate();
}
Also used : IHwRelativeKnob(de.mossgrabers.framework.controller.hardware.IHwRelativeKnob) TapTempoMkICommand(de.mossgrabers.controller.novation.sl.command.continuous.TapTempoMkICommand) TapTempoInitMkICommand(de.mossgrabers.controller.novation.sl.command.continuous.TapTempoInitMkICommand) SLControlSurface(de.mossgrabers.controller.novation.sl.controller.SLControlSurface) IParameterBank(de.mossgrabers.framework.daw.data.bank.IParameterBank) TouchpadCommand(de.mossgrabers.controller.novation.sl.command.continuous.TouchpadCommand) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Aggregations

TapTempoInitMkICommand (de.mossgrabers.controller.novation.sl.command.continuous.TapTempoInitMkICommand)1 TapTempoMkICommand (de.mossgrabers.controller.novation.sl.command.continuous.TapTempoMkICommand)1 TouchpadCommand (de.mossgrabers.controller.novation.sl.command.continuous.TouchpadCommand)1 SLControlSurface (de.mossgrabers.controller.novation.sl.controller.SLControlSurface)1 IHwRelativeKnob (de.mossgrabers.framework.controller.hardware.IHwRelativeKnob)1 IParameterBank (de.mossgrabers.framework.daw.data.bank.IParameterBank)1 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)1