Search in sources :

Example 1 with HwButtonImpl

use of de.mossgrabers.bitwig.framework.hardware.HwButtonImpl 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 2 with HwButtonImpl

use of de.mossgrabers.bitwig.framework.hardware.HwButtonImpl in project DrivenByMoss by git-moss.

the class MidiInputImpl method unbind.

/**
 * {@inheritDoc}
 */
@Override
public void unbind(final IHwButton button) {
    final HardwareButton hardwareButton = ((HwButtonImpl) button).getHardwareButton();
    hardwareButton.pressedAction().setPressureActionMatcher(null);
    hardwareButton.releasedAction().setActionMatcher(null);
}
Also used : HwButtonImpl(de.mossgrabers.bitwig.framework.hardware.HwButtonImpl) HardwareButton(com.bitwig.extension.controller.api.HardwareButton)

Aggregations

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