Search in sources :

Example 1 with ContinuousID

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

the class KontrolProtocolControllerSetup method createModes.

/**
 * {@inheritDoc}
 */
@Override
protected void createModes() {
    final KontrolProtocolControlSurface surface = this.getSurface();
    final ModeManager modeManager = surface.getModeManager();
    final List<ContinuousID> controls = ContinuousID.createSequentialList(ContinuousID.KNOB1, 8);
    controls.addAll(ContinuousID.createSequentialList(ContinuousID.FADER1, 8));
    modeManager.register(Modes.VOLUME, new MixerMode(surface, this.model, controls));
    modeManager.register(Modes.SEND, new SendMode(surface, this.model, controls));
    modeManager.register(Modes.DEVICE_PARAMS, new ParamsMode(surface, this.model, controls));
}
Also used : ContinuousID(de.mossgrabers.framework.controller.ContinuousID) ParamsMode(de.mossgrabers.controller.ni.kontrol.mkii.mode.ParamsMode) SendMode(de.mossgrabers.controller.ni.kontrol.mkii.mode.SendMode) MixerMode(de.mossgrabers.controller.ni.kontrol.mkii.mode.MixerMode) KontrolProtocolControlSurface(de.mossgrabers.controller.ni.kontrol.mkii.controller.KontrolProtocolControlSurface) ModeManager(de.mossgrabers.framework.featuregroup.ModeManager)

Example 2 with ContinuousID

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

the class UserView method bindCurrentPage.

/**
 * Update the binding to the current page.
 */
private void bindCurrentPage() {
    for (int i = 0; i < 8; i++) {
        final ContinuousID faderID = ContinuousID.get(ContinuousID.FADER1, i);
        final IHwContinuousControl continuous = this.surface.getContinuous(faderID);
        if (continuous != null)
            continuous.bind(this.userParameterBank.getItem(i));
    }
}
Also used : ContinuousID(de.mossgrabers.framework.controller.ContinuousID) IHwContinuousControl(de.mossgrabers.framework.controller.hardware.IHwContinuousControl)

Example 3 with ContinuousID

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

the class UserView method onDeactivate.

/**
 * {@inheritDoc}
 */
@Override
public void onDeactivate() {
    for (int i = 0; i < 8; i++) {
        final ContinuousID faderID = ContinuousID.get(ContinuousID.FADER1, i);
        final IHwContinuousControl continuous = this.surface.getContinuous(faderID);
        if (continuous != null)
            continuous.bind((IParameter) null);
    }
    this.surface.rebindGrid();
    super.onDeactivate();
}
Also used : ContinuousID(de.mossgrabers.framework.controller.ContinuousID) IParameter(de.mossgrabers.framework.daw.data.IParameter) IHwContinuousControl(de.mossgrabers.framework.controller.hardware.IHwContinuousControl)

Example 4 with ContinuousID

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

the class Kontrol1ControlSurface method buttonChange.

/**
 * {@inheritDoc}
 */
@Override
public void buttonChange(final int usbControlNumber, final boolean isPressed) {
    final ButtonID buttonID = BUTTON_MAP.get(Integer.valueOf(usbControlNumber));
    if (buttonID == null) {
        // Simulate knob touch via CC
        final ContinuousID continuousID = CONTINUOUS_MAP.get(Integer.valueOf(usbControlNumber));
        if (continuousID == null)
            return;
        final IHwContinuousControl continuous = this.getContinuous(continuousID);
        if (isPressed) {
            if (!continuous.isTouched())
                continuous.triggerTouch(true);
        } else if (continuous.isTouched())
            continuous.triggerTouch(false);
        return;
    }
    // Simulate button press via CC
    if (isPressed) {
        if (!this.isPressed(buttonID))
            this.getButton(buttonID).trigger(ButtonEvent.DOWN);
    } else if (this.isPressed(buttonID))
        this.getButton(buttonID).trigger(ButtonEvent.UP);
}
Also used : ContinuousID(de.mossgrabers.framework.controller.ContinuousID) ButtonID(de.mossgrabers.framework.controller.ButtonID) IHwContinuousControl(de.mossgrabers.framework.controller.hardware.IHwContinuousControl)

Aggregations

ContinuousID (de.mossgrabers.framework.controller.ContinuousID)4 IHwContinuousControl (de.mossgrabers.framework.controller.hardware.IHwContinuousControl)3 KontrolProtocolControlSurface (de.mossgrabers.controller.ni.kontrol.mkii.controller.KontrolProtocolControlSurface)1 MixerMode (de.mossgrabers.controller.ni.kontrol.mkii.mode.MixerMode)1 ParamsMode (de.mossgrabers.controller.ni.kontrol.mkii.mode.ParamsMode)1 SendMode (de.mossgrabers.controller.ni.kontrol.mkii.mode.SendMode)1 ButtonID (de.mossgrabers.framework.controller.ButtonID)1 IParameter (de.mossgrabers.framework.daw.data.IParameter)1 ModeManager (de.mossgrabers.framework.featuregroup.ModeManager)1