Search in sources :

Example 1 with BindException

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

the class MidiInputImpl method bind.

/**
 * {@inheritDoc}
 */
@Override
public void bind(final IHwRelativeKnob knob, final BindType type, final int channel, final int control, final RelativeEncoding encoding) {
    if (type != BindType.CC)
        throw new BindException(type);
    final RelativeHardwareValueMatcher valueMatcher;
    switch(encoding) {
        case TWOS_COMPLEMENT:
            valueMatcher = this.port.createRelative2sComplementCCValueMatcher(channel, control, 127);
            break;
        case OFFSET_BINARY:
            valueMatcher = this.port.createRelativeBinOffsetCCValueMatcher(channel, control, 127);
            break;
        case SIGNED_BIT:
            valueMatcher = this.port.createRelativeSignedBitCCValueMatcher(channel, control, 127);
            break;
        case SIGNED_BIT2:
            valueMatcher = this.port.createRelativeSignedBit2CCValueMatcher(channel, control, 127);
            break;
        default:
            // Can never been reached
            throw new BindException(type);
    }
    ((HwRelativeKnobImpl) knob).getHardwareKnob().setAdjustValueMatcher(valueMatcher);
}
Also used : RelativeHardwareValueMatcher(com.bitwig.extension.controller.api.RelativeHardwareValueMatcher) BindException(de.mossgrabers.framework.controller.hardware.BindException)

Example 2 with BindException

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

the class MidiInputImpl method bind.

/**
 * {@inheritDoc}
 */
@Override
public void bind(final IHwButton button, final BindType type, final int channel, final int control) {
    final HardwareButton hardwareButton = ((HwButtonImpl) button).getHardwareButton();
    final AbsoluteHardwareValueMatcher pressedMatcher;
    final HardwareActionMatcher releasedMatcher;
    switch(type) {
        case CC:
            pressedMatcher = this.port.createAbsoluteCCValueMatcher(channel, control);
            releasedMatcher = this.port.createCCActionMatcher(channel, control, 0);
            break;
        case NOTE:
            pressedMatcher = this.port.createNoteOnVelocityValueMatcher(channel, control);
            releasedMatcher = this.port.createNoteOffActionMatcher(channel, control);
            break;
        default:
            throw new BindException(type);
    }
    final HardwareAction pressedAction = hardwareButton.pressedAction();
    pressedAction.setPressureActionMatcher(pressedMatcher);
    pressedAction.setShouldFireEvenWhenUsedAsNoteInput(true);
    setAction(hardwareButton.releasedAction(), releasedMatcher);
}
Also used : HwButtonImpl(de.mossgrabers.bitwig.framework.hardware.HwButtonImpl) HardwareButton(com.bitwig.extension.controller.api.HardwareButton) AbsoluteHardwareValueMatcher(com.bitwig.extension.controller.api.AbsoluteHardwareValueMatcher) HardwareActionMatcher(com.bitwig.extension.controller.api.HardwareActionMatcher) HardwareAction(com.bitwig.extension.controller.api.HardwareAction) BindException(de.mossgrabers.framework.controller.hardware.BindException)

Example 3 with BindException

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

the class MidiInputImpl method bindTouch.

private void bindTouch(final ContinuousHardwareControl<?> hardwareControl, final BindType type, final int channel, final int control) {
    final HardwareActionMatcher pressedMatcher;
    final HardwareActionMatcher releasedMatcher;
    switch(type) {
        case CC:
            pressedMatcher = this.port.createCCActionMatcher(channel, control, 127);
            releasedMatcher = this.port.createCCActionMatcher(channel, control, 0);
            break;
        case NOTE:
            pressedMatcher = this.port.createNoteOnActionMatcher(channel, control);
            releasedMatcher = this.port.createNoteOffActionMatcher(channel, control);
            break;
        default:
            throw new BindException(type);
    }
    setAction(hardwareControl.beginTouchAction(), pressedMatcher);
    setAction(hardwareControl.endTouchAction(), releasedMatcher);
}
Also used : HardwareActionMatcher(com.bitwig.extension.controller.api.HardwareActionMatcher) BindException(de.mossgrabers.framework.controller.hardware.BindException)

Aggregations

BindException (de.mossgrabers.framework.controller.hardware.BindException)3 HardwareActionMatcher (com.bitwig.extension.controller.api.HardwareActionMatcher)2 AbsoluteHardwareValueMatcher (com.bitwig.extension.controller.api.AbsoluteHardwareValueMatcher)1 HardwareAction (com.bitwig.extension.controller.api.HardwareAction)1 HardwareButton (com.bitwig.extension.controller.api.HardwareButton)1 RelativeHardwareValueMatcher (com.bitwig.extension.controller.api.RelativeHardwareValueMatcher)1 HwButtonImpl (de.mossgrabers.bitwig.framework.hardware.HwButtonImpl)1